Skip to content

fix(lifelong): avoid indexing beyond dataset splits - #980

Open
ali-raza-7 wants to merge 2 commits into
kubeedge:mainfrom
ali-raza-7:fix-lifelong-split-index
Open

fix(lifelong): avoid indexing beyond dataset splits#980
ali-raza-7 wants to merge 2 commits into
kubeedge:mainfrom
ali-raza-7:fix-lifelong-split-index

Conversation

@ali-raza-7

Copy link
Copy Markdown

Summary

Fix the lifelong learning paradigm to iterate over the actual number of dataset splits returned by split_dataset() instead of relying on the rounds value.

Changes

  • Replace range(rounds + 1) with range(len(dataset_files)).
  • Replace evaluation loop bounds based on rounds with len(dataset_files).
  • Apply the same correction to both affected lifelong-learning execution paths.

Validation

  • python3 -m py_compile core/testcasecontroller/algorithm/paradigm/lifelong_learning/lifelong_learning.py — PASS
  • git diff --check — PASS
  • Dataset splitting regression test with times=2 — PASS
  • PR diff contains only lifelong_learning.py.

Rationale

The dataset splitting logic determines the actual number of dataset files returned by split_dataset(). Using rounds for indexing can result in accessing a dataset split that does not exist.

Iterating over len(dataset_files) keeps the lifelong-learning loops aligned with the dataset splits actually returned by the dataset splitter.

@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ali-raza-7
To complete the pull request process, please assign jaypume after the PR has been reviewed.
You can assign the PR to them by writing /assign @jaypume in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 28, 2026
@ali-raza-7

Copy link
Copy Markdown
Author

Validation

I verified the fix locally with the following checks:

  • python3 -m py_compile core/testcasecontroller/algorithm/paradigm/lifelong_learning/lifelong_learning.py — PASS
  • git diff --check — PASS
  • Regression test for Dataset.split_dataset(times=2) — PASS
  • Verified that the actual diff against origin/main contains only lifelong_learning.py with 4 additions and 4 deletions.

The fix updates the lifelong-learning loops to use len(dataset_files) instead of rounds, ensuring iteration stays within the dataset splits the dataset splitter actually returns.

@ali-raza-7

Copy link
Copy Markdown
Author

/assign @jaypume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants