[MNLI example] Prevent overwriting matched with mismatched metrics#16475
Merged
sgugger merged 2 commits intohuggingface:mainfrom Mar 29, 2022
eldarkurtic:fix-mnli-example
Merged
[MNLI example] Prevent overwriting matched with mismatched metrics#16475sgugger merged 2 commits intohuggingface:mainfrom eldarkurtic:fix-mnli-example
sgugger merged 2 commits intohuggingface:mainfrom
eldarkurtic:fix-mnli-example
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
approved these changes
Mar 29, 2022
Comment on lines
+522
to
+525
| if task == "mnli-mm": | ||
| metrics = {k + "_mm": v for k, v in metrics.items()} | ||
| if "mnli" in task: | ||
| combined.update(metrics) |
Collaborator
There was a problem hiding this comment.
I'd regroup this slightly differently:
Suggested change
| if task == "mnli-mm": | |
| metrics = {k + "_mm": v for k, v in metrics.items()} | |
| if "mnli" in task: | |
| combined.update(metrics) | |
| if task == "mnli-mm": | |
| combined.update({k + "_mm": v for k, v in metrics.items()}) | |
| elif task == "mnli": | |
| combined.update(metrics) |
Contributor
Author
There was a problem hiding this comment.
With this regrouping, the trainer.log_metrics("eval", metrics) won't have the "_mm" , so the stdout will be the same as before (that's the main reason why keys in metrics are updated). Given this, should we still regroup and affect only the json log files, but not the stdout?
Collaborator
There was a problem hiding this comment.
Ah understood. LGTM as is then :-)
Collaborator
|
The CI failure is unrelated to this PR (actually investigating it right now), so we can merge safely :-) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes #16474.
The fix appends
_mmto the metrics formnli-mmevaluation dataset to prevent overwriting eval metrics from themnlidataset, and writes them together ineval_results.jsonandall_results.json. The MNLI-metrics look like this:{ "eval_accuracy": 0.36067244014263883, "eval_accuracy_mm": 0.35506509357200977, "eval_loss": 1.158889889717102, "eval_loss_mm": 1.1670204401016235, "eval_runtime": 16.4691, "eval_runtime_mm": 15.9496, "eval_samples": 9815, "eval_samples_mm": 9832, "eval_samples_per_second": 595.964, "eval_samples_per_second_mm": 616.44, "eval_steps_per_second": 18.641, "eval_steps_per_second_mm": 19.311 }@sgugger, @patil-suraj