Hi,
Unfortunately this is a python limitation. You cannot save the code easily and in a portable way.
You can try to save a torchscript model that you get from the jit if your model can be handled by torchscript.