I just realized that I might be using the wrong approach according to this explanation 48
I actually need to save the whole model, so I simply tried:
torch.save(dual_encoder, 'SAVED_MODEL.pt')
dual_encoder = torch.load('SAVED_MODEL.pt')
dual_encoder.eval()

this gives me a strange error:
File “/home/janinanu/anaconda3/lib/python3.5/inspect.py”, line 618, in getfile
raise TypeError(’{!r} is a built-in class’.format(object))
TypeError: <module ‘main’> is a built-in class