Fix ValueError: Assign retain set to eval in unlearn mode #154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add logic to retain evaluation data during unlearning.
What does this PR do?
This PR fixes a
ValueErrorthat occurs when running the unlearning process witheval_strategy="epoch"or"steps".Problem
Currently, in
src/data/__init__.py, whenmode="unlearn", the code merges the splits into a singletraindataset and then pops (removes) the original splits (includingretain) from thedatadictionary.As a result, when the
Trainertries to accesseval_dataset(typically the retain set), it findsNone, causing the following error:ValueError: You have set args.eval_strategy to IntervalStrategy.EPOCH but you didn't pass an eval_dataset to Trainer.Solution
I added logic to assign the
retainsplit todata["eval"]before popping the splits. This ensures that the Trainer has access to evaluation data during the unlearning process.Fixes # (issue)
N/A
Before submitting