-
Notifications
You must be signed in to change notification settings - Fork 499
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
[fx_importer] Convert non-persistent buffers lifted as tensor constants #2902
Conversation
Set PyTorch and TorchVision version to nightly release 2024-02-07. Signed-Off By: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
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.
If the CI passes, this lgtm and can land. Once it does, let's close the original PR.
You'll need to If doing that, I would probably make it fully conditional with a note about where the change happened: If there is no "constants" attribute, consult the "state_dict". Otherwise, only look at "constants". Future us will thank us because the freezing of states will be something we want to undo eventually (just like the upstream patch had to fix this). |
Done. Just a clarification that we will need to continue using |
I think that how you have this now gets this in the safe state. If we were unconditionally looking at |
The investigation is largely recorded in #2881, but this change allows us to capture non-persistent buffers that were lifted as tensor constants (after pytorch/pytorch#118969 landed in upstream PyTorch), and propagate them to
Torch
dialect as "frozen"torch.vtensor.literal
. I believe this patch should work with both nightly and stable PyTorch, but will let CI confirm the same. Thanks @stellaraccident for the valuable pointers and guidance.