-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[jit] Support for modules that have hooks when compiling #17571
Comments
Hi, could you explain a little bit more about your use case? For example, would it be possible as a workaround to inline the hook into the |
Sure. It is similar to U-net style skip connections but I also pass these features through another conv layer. It is actually in the
|
has this been addressed elsewhere ? |
@suo It's for getting U-nets to work where hooks are used to store activations from the forward pass. See code here for the model that many people in the fast.ai course are trying to compile. It turns out that if you just comment out that error the compilation works. So it would be great if there was some option that we could pass to bypass that exception, and perhaps just get a warning. You can follow some of the discussion in this forum thread here for some more context. Thanks for your great work! |
FYI this issue is related to this issue also. |
@zdevito do you remember why we explicitly disallow hooks? |
I can't remember. We should revisit it and see if wean just enable it. |
torch.jit.trace(nn.utils.spectral_norm(nn.Linear(8,8)), torch.rand(4,8))
|
weight norm also. Are models using these just unexportable? https://pytorch.org/docs/stable/_modules/torch/nn/utils/weight_norm.html |
Thank you @eellison ! 馃帀 馃憦 |
馃殌 Feature
Currently forward or backward hooks (i.e concatenation of features in UNET) are not supported in jit tracing.
Run into this error when attempting:
ValueError: Modules that have hooks assigned can't be compiled
source: torch.jit.TracedModule(ScriptModule)
The text was updated successfully, but these errors were encountered: