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

Change no trainer image_classification test #17635

Merged
merged 6 commits into from
Jun 23, 2022
Merged

Conversation

muellerzr
Copy link
Contributor

What does this PR do?

I noticed that this test has been failing for the last few months, and it's due to the fact that on a single GPU or CPU the tests pass (we hit 50% accuracy), but on multi GPU it's a hit or miss whether or not it does (each epoch/batch is either 50% or 0%, and we happen to miss that coin flip each time).

This PR modifies the no_trainer test to mimic the equivalent pytorch example tests, and I can confirm it passes repeatedly on a single GPU, CPU, and multi GPU: https://github.com/huggingface/transformers/blob/main/examples/pytorch/test_pytorch_examples.py#L390-L417

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

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.

@sgugger @NielsRogge

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 9, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger 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 fixing (and making the test stronger!)

However I'm noticing it now takes 68s for the test (the longest time) so can we lower the threshold and the number of steps somehow?

@muellerzr
Copy link
Contributor Author

@sgugger I've addressed the speed concern in the test, but you won't actually see it show up due to a bug in the scheduler step recalculation. I'll open up another PR for that fix and then merge this one after that's done

@muellerzr muellerzr merged commit acb709d into main Jun 23, 2022
@muellerzr muellerzr deleted the muellerzr-fix-test-failure branch June 23, 2022 15:11
younesbelkada pushed a commit to younesbelkada/transformers that referenced this pull request Jun 25, 2022
* Adjust test arguments and use a new example test
younesbelkada pushed a commit to younesbelkada/transformers that referenced this pull request Jun 29, 2022
* Adjust test arguments and use a new example test
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.

3 participants