Skip to content
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

Set greater_is_better to False if metric_for_best_model ends with "loss" #31142

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

miivanov90
Copy link
Contributor

@miivanov90 miivanov90 commented May 30, 2024

Prior to this PR greater_is_better (used for determining if the best checkpoint, for example) would be set to False if users didn't set it explicitly and either metric_for_best_model is unset or it's one of "loss" or "eval_loss".

This PR simplifies the logic to simply check if metric_for_best_model ends with loss.

Background: Despite having read the documentation a while back I forgot about this behavior and updated my script to evaluate against multiple datasets, for each one I compute the "eval_dataset-name_loss" metric. You can imagine my surprise that after 7h of training I realized that the worst model was saved and all work was lost :)

@ArthurZucker @muellerzr

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@miivanov90
Copy link
Contributor Author

Hey! I was wondering if there were questions/concerns with this small refactor/fix?

@muellerzr

Copy link
Contributor

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think overall this change makes sense, since we need to be able to support any metric name.

cc @amyeroberts for final approval!

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A lot more flexible 🤗

@amyeroberts amyeroberts merged commit df5abae into huggingface:main Jun 3, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants