-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Fix OwlViT torchscript tests #18347
Fix OwlViT torchscript tests #18347
Conversation
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.
Left some comments.
@@ -1153,7 +1153,6 @@ def forward( | |||
|
|||
class OwlViTForObjectDetection(OwlViTPreTrainedModel): | |||
config_class = OwlViTConfig | |||
main_input_name = "pixel_values" |
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 have to remove this since the arguments are swapped.
@@ -1383,6 +1382,8 @@ def forward( | |||
text_model_last_hidden_states, | |||
vision_model_last_hidden_states, | |||
) | |||
output = tuple(x for x in output if x is not None) |
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.
We need to remove the None
elements from the outputs if return_dict=False
.
This is what we do for all models.
And it is also necessary for jit.trace
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, ran the tests and everything looks good!
The documentation is not available anymore as the PR was closed or merged. |
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.
Let's double check with @alaradirik but LGTM!
What does this PR do?
Fix
OwlViTForObjectDetection
torchscript tests. The main problem comes from the fact that we providebut
OwlViTForObjectDetection
has different order of arguments.I could simply change the order in the test method, but probably it is better to have
OwlViTForObjectDetection
andOwlViTModel
have the same argument order .current failed job run