-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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 doctests to Perceiver examples #19129
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Thank you a lot for the PR! Currently the test will fail for the following FAILED src/transformers/models/perceiver/modeling_perceiver.py::transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationConvProcessing.forward
FAILED src/transformers/models/perceiver/modeling_perceiver.py::transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationFourier.forward
FAILED src/transformers/models/perceiver/modeling_perceiver.py::transformers.models.perceiver.modeling_perceiver.PerceiverForImageClassificationLearned.forward We should add the expected outputs in the doc examples.
without output and the expected value. We can have something like >>> list(logits .shape)
expected shapes Would you like to fix and enhance those doc examples? Once you have a change (staged or commited), you can run the test like
Once the test is run, you can clean up the git status before further changes or push. Thanks! |
@ydshieh thanks for the quick feedback! Yes, I noticed those tests were failing, but I thought it might be something about my local environment and the extra newline stuff. I just pushed a fix, which passes locally. By the way, how did you know those tests were failing? The CI pipelines all seemed to be passing. Did you have to checkout my branch and run it locally? |
@stevenmanton Thanks for the push. However, instead of changing to >>> predicted_class = model.config.id2label[predicted_class_idx] we should change it to >>> print("Predicted class:", model.config.id2label[predicted_class_idx])
add some output here - so the doctest will test again it You can find similar work is done transformers/src/transformers/models/deit/modeling_deit.py Lines 735 to 736 in d5848a5
Otherwise, the example has nothing to be tested.
Yes. The PR CI on CircleCI does not run doctest :-). It is run after the PR being merged. |
b82ce0d
to
bebcb95
Compare
@ydshieh Thanks for your feedback and patience. I believe I've corrected it. The extra newline stuff is confusing, but if you run |
Thanks! As we are going to run the doctest for this model, would you like to add some expected outputs at the following places?
And a few places in this doc example (for
For
|
When running |
@ydshieh Ok, I added some more checks for the sizes of logits. They all pass for me locally. |
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.
Hi @stevenmanton Thanks a lot of this PR and the follow-up effort :-). It's great, and I just added an extra expected loss value for PerceiverForMaskedLM
.
@sgugger As I am not sure if this PR is classified as a PR that I can merge myself, tagging you for a review or let me know if I can merge the doctest PR in the future. 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 a lot for this PR!
@ydshieh Always good to have another pair of eyes :-)
Don't hesitate to merge such PRs without my approval in the future if I take too long to review, but I'd appreciate the opportunity to review!
* Fix bug in example and add to tests * Fix failing tests * Check the size of logits * Code style * Try again... * Add expected loss for PerceiverForMaskedLM doctest Co-authored-by: Steven Anton <antonstv@amazon.com> Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
What does this PR do?
Related to #16292
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Taken from #16292 : @patrickvonplaten @ydshieh @patil-suraj