Hi, for a neural style problem, Im trying to deepcopy a pre-trained model. The pre-trained model is a jit.traced model.
While performing the deepcopy, its failing with Pickle error. Request you help in debugging this error.
Stack trace-
4 # Deep copy vgg model
----> 5 cnn = copy.deepcopy(cnn)
6 normalization = Normalization(normalization_mean, normalization_std).to(device)
7 # Collect metrics
/usr/lib/python3.6/copy.py in deepcopy(x, memo, _nil)
167 reductor = getattr(x, "__reduce_ex__", None)
168 if reductor:
--> 169 rv = reductor(4)
170 else:
171 reductor = getattr(x, "__reduce__", None)
/usr/local/lib/python3.6/dist-packages/torch/jit/__init__.py in __getstate__(self)
1746 "ScriptModules cannot be deepcopied using copy.deepcopy or saved using torch.save. " +
1747 "Mixed serialization of script and non-script modules is not supported. " +
-> 1748 "For purely script modules use my_script_module.save(<filename>) instead.")
1749
1750 # Python magic methods do method lookups on an object's class type, instead of looking up
PickleError: ScriptModules cannot be deepcopied using copy.deepcopy or saved using torch.save. Mixed serialization of script and non-script modules is not supported. For purely script modules use my_script_module.save(<filename>) instead.