-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: sync added image tokens with transformers #2080
Conversation
99be263
to
9ce4552
Compare
router/src/validation.rs
Outdated
.. | ||
})) | ||
) { | ||
tokens = tokens.repeat(5); |
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.
Careful about the removal of contiguous <fake>
tokens in the preprocessor.
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.
Done. I'm now doing it in the same way as transformers. First add the duplicate tokens, then substitute them away.
I first wanted to make the image token processing aware of preceding chunks and only add a preceding fake token if there was not a preceding image (and then only intersperse the image splits with a single fake token). But that seemed like a bit of premature optimization of the image token processing.
1f1f4be
to
8cafd28
Compare
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.
LGTM. Let's merge we should probably add a unit test for the adversarial fixup
.
(2 consecutive images showing the fixup removed 1 fake token).
Before this change, the number of reserved image tokens was not the same as the number of images. Fixes #2029. While at it, also remove all the image token handling duplication in `prepare_input`.
8cafd28
to
80b448c
Compare
Before this change, the number of reserved image tokens was not the same as the number of images. Fixes #2029. While at it, also remove all the image token handling duplication in `prepare_input`.
Before this change, the number of reserved image tokens was not the same as the number of images. Fixes huggingface#2029. While at it, also remove all the image token handling duplication in `prepare_input`.
What does this PR do?
Before this change, the number of reserved image tokens was not the same as the number of images. Fixes #2029.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.