-
Notifications
You must be signed in to change notification settings - Fork 95
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
torch.jit support #25
Comments
I haven't messed with PyTorch 1.0 tracing features yet. However, this is something that interests me and that I would like very much to support. Both modules will have indeed to be converted to TorchScript due to control flow. I'll have a look today to see if I can get any progress. |
@mdraw I'm surprised you had no errors tracing the |
I think it might not be possible to trace the I have to investigate this, however. |
In my (limited) experience, implementing things as
Yes, I also don't know how this could be done. Besides this issue, your implementation in #27 looks good to me. |
Yes, the DropBlock modules are now working fine. I didn't merge yet due to the LinearScheduler. I will do some more research but I really think it is not possible at the moment |
closing this as DropBlock does not benefit from JIT scripting, as it can be traced for inference time without problems. |
All network layers in this repo can be traced with
torch.jit.trace()
, but their control flow won't work correctly in traced modules (e.g. training/eval mode is not respected and the check indropblock/dropblock/scheduler.py
Line 16 in 16a518a
Since tracing this code does not necessarily emit warnings (see example below), I think this incompatibility should be documented here to make sure no one mistakenly trains traced networks. OTOH networks that are traced in eval mode after a complete training should work as intended, as long as they are not put in training mode again.
Example code that produces a wrong
TracedModule
without any warning (using PyTorch 1.0.0):The text was updated successfully, but these errors were encountered: