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

Fix run_glue evaluation when model has a label correspondence #10401

Merged
merged 2 commits into from
Feb 25, 2021

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Feb 25, 2021

What does this PR do?

The run_glue script uses the correspondence id to label stored in a given model but when using

AutoModelForSequenceClassication.from_pretrained(xxx, num_labels=x)

that correspondence is reset. This PR fixes that, along with a few other bugs in the script. To confirm MNLI evaluation does take the correspondence in a model config

python examples/text-classification/run_glue.py --model_name_or_path roberta-large-mnli --task_name mnli --max_seq_length 128 --output_dir ~/tmp/test-mnli --do_eval

gices 90.6%/90.1% accuracy (matched/mismatched) after this PR, vs 4.28%/4.86% accuracy on current master.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Yes, LGTM!

@sgugger sgugger merged commit 17b6e0d into master Feb 25, 2021
@sgugger sgugger deleted the mnli_script branch February 25, 2021 20:30
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.

2 participants