addressing the issue #34611 to make FlaxDinov2 compatible with any batch size #35138
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.
This PR solves the batch size issue with FlaxDinov2 model #34611. The commonly used tests across the transformers library could not detect the error in the "interpolate_position_encoding" method, which only worked for single images. The issue has been fixed using jnp.tile for it's simplicity, although jnp.repeat could also be used.
The slow tests have also been modified to pass a batch of images instead of just one.
@amyeroberts could you please review the changes.
P.S. this pr does exactly what #34620 aimed to do, however, with a few more improvements.