-
Notifications
You must be signed in to change notification settings - Fork 27.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update doc for metric_for_best_model
when save_strategy="best"
.
#35389
Merged
ArthurZucker
merged 8 commits into
huggingface:main
from
seanswyi:fix/update-metric-for-best-model-default
Jan 8, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4364621
Updated docstring for _determine_best_metric.
seanswyi c1147f6
Updated docstring for metric_for_best_model.
seanswyi 8164e20
Added test case for save strategy.
seanswyi 7f0cf3f
Updated incorrect test case.
seanswyi 94cab05
Changed eval_strategy to match save_strategy.
seanswyi 029fe93
Separated test cases for metric.
seanswyi 4a70f4c
Allow load_best_model when save_strategy == "best".
seanswyi 32b8631
Updated docstring for metric_for_best_model.
seanswyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not critical / minor: tbh, it seems a bit out of place for the
test_save_best_checkpoint
(as well as the previous case). I would probably move it into a separate test. Or should it otherwise call at least train and test actual checkpoint saved?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I agree that it logically does seem a bit out of place. I think cases 3 and 4 could be grouped into their own methods since the point isn't so much to test the
save_strategy = "best"
itself but more to test the behavior related tometric_for_best_model
.I'm not sure if actually running training would be necessary, though. Case 3 is simply to check whether a ValueError is being properly thrown at Trainer initialization time, and case 4 is also simply to check whether the
__post_init__
method ofTrainingArguments
properly initializesmetric_for_best_model
to"loss"
whensave_strategy != "best"
andload_best_model_at_end = True
. To me, neither of these seem to require training/evaluation and Trainer instantiation seems sufficient.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I would also split it into a separate test (or two test). And, yes, we are testing the init here, that's why it was looking out of place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no strong opinion. We can split it into a separate test for case 3 and 4.