export model to Torch Script #959
-
How to export my model to torch script? For example, transformers export model to torch script: https://huggingface.co/docs/transformers/torchscript |
Beta Was this translation helpful? Give feedback.
Answered by
BenjaminBossan
Apr 26, 2023
Replies: 1 comment
-
In general, the PyTorch net = NeuralNet(MyModule, ...) # MyModule is your custom or pretrained pt module
net.fit(X, y)
module = net.module_ # this is the trained MyModule instance
traced_module = torch.jit.trace(module, ...) It is not possible to trace the I haven't worked with torch script, so if the provided solution not work, please report back. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
fouvy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In general, the PyTorch
Module
is available as an attribute calledmodule_
on the skorch net. So e.g.:It is not possible to trace the
net
itself, only the PyTorchModule
.I haven't worked with torch script, so if the provided solution not work, please report back.