-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
🚨 [Idefics2] Update ignore index #30898
🚨 [Idefics2] Update ignore index #30898
Conversation
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. |
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.
Thanks for adding!
Two things to update before merging:
- Docstring info to match this logic
- Add an example in on modeling pad on how to mask, as users will likely not know to mask the images
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.
thanks!
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.
Thanks for updating and providing an example!
Added a 🚨 to flag that this is a breaking change
Thanks, btw @VictorSanh could you update the DocVQA notebook to account for this change? |
good point! done! |
What does this PR do?
This PR proposes to set the ignore index of the loss function of Idefics2 like the value of any other LLM/multimodal in the Transformers library, which is -100 (the default ignore index of PyTorch's cross-entropy loss).
It's up to users to create the labels and set whatever they don't want to be included in the loss calculation to -100. In the case of Idefics2, this could look like so:
which means, it's up to the user to make sure padding and image tokens are ignored.