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 QA example #30580

Merged
merged 2 commits into from May 1, 2024
Merged

Fix QA example #30580

merged 2 commits into from May 1, 2024

Conversation

Rocketknight1
Copy link
Member

The QA example assumes the model has a CLS token, but many newer models don't. This PR falls back to the BOS token if one isn't present, and finally falls back to the start of the sequence if that doesn't work either.

Fixes #30570

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 for the quick fix on this!

Just a request to do a quick test run on the old default models, and then with one of the newer ones on just one of these scripts to make sure it all runs smoothly

@Rocketknight1
Copy link
Member Author

Will do now before merging!

@Rocketknight1
Copy link
Member Author

Tried running it on Falcon myself, but it turns out there are multiple other issues here - in particular, the code also assumes a PAD token is present. Fundamentally, this example just isn't suited to fine-tuning a CLM like Falcon!

I think we can maybe still merge the PR (since there are likely MLM models either now or in the future that will be missing CLS), but @ananegru you'll probably need to use a masked language model as a base rather than a causal language model! Maybe one of the DeBERTa models?

@Rocketknight1
Copy link
Member Author

Just confirmed that the example still works with this branch and microsoft/deberta-v3-base

My bad for going through all this before realizing the root of the problems was a CLM being used in MLM examples, though!

@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.

@amyeroberts
Copy link
Collaborator

My bad for going through all this before realizing the root of the problems was a CLM being used in MLM examples, though!

I didn't notice either! Happy for this to be merged in if it still works with existing models. Thanks again for adapting the scripts so quickly

@Rocketknight1 Rocketknight1 merged commit 1e05671 into main May 1, 2024
8 checks passed
@Rocketknight1 Rocketknight1 deleted the fix_qa_example branch May 1, 2024 07:43
itazap pushed a commit that referenced this pull request May 14, 2024
* Handle cases when CLS token is absent

* Use BOS token as a fallback
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.

ValueError Reason
3 participants