-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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 tracing dinov2 #27561
Fix tracing dinov2 #27561
Conversation
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.
Nice catch! 🤗
Would it make sense to add the tracing snippet to the dinov2.md
? 🤗
@ArthurZucker - nice idea, I'll add it! |
@@ -25,6 +25,37 @@ The abstract from the paper is the following: | |||
This model was contributed by [nielsr](https://huggingface.co/nielsr). | |||
The original code can be found [here](https://github.com/facebookresearch/dinov2). | |||
|
|||
## Usage tips |
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.
@ArthurZucker WDYT of this addition to the model page?
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.
Love it!
We often have people asking how xx model can be compiled / traced so great to be careful when we add support for this! 😉
What does this PR do?
Tracing currently fails for DinoV2 due to an issue when calling torch's
torch._C._nn._upsample_bicubic
function through nn.functional.interpolate. There is an issue if the passed inscale_factor
is(tensor(float), tensor(float))
so we must convert to a tuple of floats(float, float)
as per this PR to enable tracing.I have run the slow tracing tests to make sure everything works.
The following now works:
Note: although the model outputs are close, they still have a significant absolute difference on the order of ~1e-4.
Fixes #27537
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.