Pix2pix model tracing

Hi all,
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)     
    a = torch.jit.script(model)

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__'

What’s wrong?
Any help would really be really appreciated.

I found the solution, the generator should only be scripted.