-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Make vitdet jit trace complient #30065
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.
Thanks!
@@ -441,8 +441,8 @@ def window_unpartition(windows, window_size, pad_height_width, height_width): | |||
) | |||
hidden_state = hidden_state.permute(0, 1, 3, 2, 4, 5).contiguous().view(batch_size, patch_height, patch_width, -1) | |||
|
|||
if patch_height > height or patch_width > width: | |||
hidden_state = hidden_state[:, :height, :width, :].contiguous() | |||
# We always have height <= patch_height and width <= patch_width |
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 think this was a victim of terrible variable naming - it should really be padded_height
and padded_width
. Patch height should always be less that or equal to height. I know it's not related to tracing, but could you update these for the sake of future readers?
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, would indeed be great to update the variable names
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.
LGTM
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. |
Fixes huggingface/optimum#1795 & huggingface/optimum#1582 (comment)