I am trying to deploy the pix2pix model in an android app, I need to trace the model with torch.jit.script() but it doesnt seem to work.
Here is my code:
model = create_model(opt) model.setup(opt) model.eval() a = torch.jit.script(model) torch.jit.save(a,'optmodel.pt')
and the full stacktrace is as follows:
File "toScript.py", line 58, in <module> a = torch.jit.script(model) File "/local-scratch/Anaconda3/envs/pix2pix/lib/python3.7/site-packages/torch/jit/__init__.py", line 1263, in script qualified_name = _qualified_name(obj) File "/local-scratch/Anaconda3/envs/pix2pix/lib/python3.7/site-packages/torch/_jit_internal.py", line 760, in _qualified_name name = obj.__name__ AttributeError: 'Pix2PixModel' object has no attribute '__name__'
Any help would really be really appreciated.