-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Add tests for batching support #29297
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. |
@zucchini-nlp Running your test script on my setup I get
Could it be due to different hardware and/or versions? 🤔 For context, I'm running with CUDA 12.1, |
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.
Thank you for working on this important test case 🔥
src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py
Outdated
Show resolved
Hide resolved
src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py
Outdated
Show resolved
Hide resolved
tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py
Outdated
Show resolved
Hide resolved
…ech2_conformer.py Co-authored-by: Joao Gante <[email protected]>
…ech2_conformer.py Co-authored-by: Joao Gante <[email protected]>
Co-authored-by: Joao Gante <[email protected]>
Co-authored-by: Joao Gante <[email protected]>
Co-authored-by: Joao Gante <[email protected]>
Using cosine distance to check cv/audio models helped to solve the issue. The way we check if the model is conv-based or not might not be the best option, I will see if I can make it better. Now everything is passing the test, yay! |
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.
The end result is very cool! Thank you for iterating on this 🔥
Next steps:
Then:
|
Co-authored-by: Joao Gante <[email protected]>
@amyeroberts @ArthurZucker ready for review |
@amyeroberts: you're not on rotation, but this PR includes a new test that, to make CI green, @zucchini-nlp had to a) make minor CV model changes; b) add skips on CV models 🤗 Let us know if you find anything wrong! If the skips are not supposed to be skips, then I'd like to ask to keep them as TODOs so as to be tended by someone with CV expertise 🙏 |
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 this - this is a great addition to making sure our models are well behaved 💪
Just a few small comments
Co-authored-by: amyeroberts <[email protected]>
This reverts commit 525f3a0.
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 - great work! 💪
tests/test_modeling_common.py
Outdated
if "head_mask" in key: | ||
single_row_input[key] = value |
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.
I don't think we need this condition given the if/elif structure and L776
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, fixed the cases when batch_size == num_hidden_layers
in certain testers, so there's no need for extra check now. Removed this if
Co-authored-by: amyeroberts <[email protected]>
Co-authored-by: amyeroberts <[email protected]>
@zucchini-nlp the change in batch size has made the whisper tests unhappy :D after that is cleared up, we can merge this PR 🤗 |
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.
Very nice PR! Thanks
FYI @ydshieh 😉
This PR is now ready to be merged. An unexpected bug was found yesterday, but it's fixed already. I will also merge |
@zucchini-nlp needs a |
Hi @zucchini-nlp Thank you for your work. Our CI reports 2 failing tests:
and
If you can take a look on these, that would be great 🙏 Thank you. |
@ydshieh (and @amyeroberts, since you're working on the test fetcher): in this case, the new failures arise because the branch merged in this PR, which adds a new mixin test, was out of sync with I'm not seeing an automated way to do it. The only thing that comes to mind is to ask to rebase before merging this type of PRs :D |
@gante Yeah, I don't see an satisfying way neither. One possibility is to change circleCI config file to rebase (on the fly) on the latest main during the CI runs. |
@ydshieh That could be... interesting! Try to rebase with |
I'm not sure this is a great idea, for two reasons:
To test this out, I'd rather have an optional feature, similar to the run all tests command we can have in commits e.g. run-with-base, than we can comment on github, or ask users to run asa final step. |
That would also be quite cool -- and could save some time from the core maintainers, if the other reviewers diligently test against |
Totally agree with @amyeroberts that's why I say |
* add tests for batching support * Update src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py Co-authored-by: Joao Gante <[email protected]> * Update src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py Co-authored-by: Joao Gante <[email protected]> * Update tests/test_modeling_common.py Co-authored-by: Joao Gante <[email protected]> * Update tests/test_modeling_common.py Co-authored-by: Joao Gante <[email protected]> * Update tests/test_modeling_common.py Co-authored-by: Joao Gante <[email protected]> * fixes and comments * use cosine distance for conv models * skip mra model testing * Update tests/models/vilt/test_modeling_vilt.py Co-authored-by: Joao Gante <[email protected]> * finzalize and make style * check model type by input names * Update tests/models/vilt/test_modeling_vilt.py Co-authored-by: amyeroberts <[email protected]> * fixed batch size for all testers * Revert "fixed batch size for all testers" This reverts commit 525f3a0. * add batch_size for all testers * dict from model output * do not skip layoutlm * bring back some code from git revert * Update tests/test_modeling_common.py Co-authored-by: amyeroberts <[email protected]> * Update tests/test_modeling_common.py Co-authored-by: amyeroberts <[email protected]> * clean-up * where did minus go in tolerance * make whisper happy * deal with consequences of losing minus * deal with consequences of losing minus * maskformer needs its own test for happiness * fix more models * tag flaky CV models from Amy's approval * make codestyle --------- Co-authored-by: Joao Gante <[email protected]> Co-authored-by: amyeroberts <[email protected]>
What does this PR do?
Fixes #29179 . Currently the tests are passing for all models, and batched and unbatched outputs have nearly same outputs.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@gante