-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
fixes bugs to handle non-dict output #18897
Conversation
Hi, @alaradirik Thank you for the fix. However, I am wondering if we can let |
The documentation is not available anymore as the PR was closed or merged. |
H
Hi @ydshieh, self.owlvit already returns |
This line
could pass return_dict=True , and we can keep using the named outputs in the code.
This doesn't change the method's input and output, but make things easier to read/understand. Of course, the method This is merely a suggestion (for the readability/debugging in the future). Let's see if @sgugger has any comment, and I let you make the final call :-) |
That makes sense, and it's only a single line of code. I updated the PR, could you take a second look @ydshieh ? |
LGTM! Thanks @alaradirik for the fix :-) |
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.
Great! Let's make sure the tests pass before merge. Notice that the failing tests are slow tests, so they won't be run on CircleCI. We have to check it manually.
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.
You can't force return_dict=True
in any part of the model as this mode is not compatible with torchscript (see here).
So this change will make Owl-ViT irremediably incompatible with torchscript I believe.
Thanks. Sorry about that, @alaradirik, we have to change it back to tuple sadly due to the limitation of |
30d40a4
to
4447142
Compare
I don't mean to bother here (i.e. not saying we should change again): but @sgugger I tried the commit that with However it I changed (just FYI only) |
Oh in that case, feel free to use the dict outputs! |
@alaradirik Let's not change again (back to I can open a separate PR to use |
I'm merging this for now but yes, |
What does this PR do?
Fixes OWL-ViT's failing slow tests:
test_torchscript_simple
,test_torchscript_output_attentions
,test_torchscript_output_hidden_state
.The failures were due to explicitly calling output keys instead of calling by the index. The bugs were introduced in this PR. Switching to indexing to fix the issue:
output.last_hidden_state
->output[0]
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.