Hi there, I got an error when I call torch.save to save my pickle file but I got an error below, please let me know what’s does this mean and how to fix it. Thanks!
TypeError                                 Traceback (most recent call last)
 in 
----> 1 ssd.export(‘123.pkl’)
 in export(self, name_or_path)
191
192     def export(self, name_or_path):
–> 193         torch.save(self.learn,name_or_path)
194
195     def load(self, name_or_path):
D:\Software\envs\data245\lib\site-packages\torch\serialization.py in save(obj, f, pickle_module, pickle_protocol)
222         >>> torch.save(x, buffer)
223     “”"
–> 224     return _with_file_like(f, “wb”, lambda f: _save(obj, f, pickle_module, pickle_protocol))
225
226
D:\Software\envs\data245\lib\site-packages\torch\serialization.py in _with_file_like(f, mode, body)
147         f = open(f, mode)
148     try:
–> 149         return body(f)
150     finally:
151         if new_fd:
D:\Software\envs\data245\lib\site-packages\torch\serialization.py in (f)
222         >>> torch.save(x, buffer)
223     “”"
–> 224     return _with_file_like(f, “wb”, lambda f: _save(obj, f, pickle_module, pickle_protocol))
225
226
D:\Software\envs\data245\lib\site-packages\torch\serialization.py in _save(obj, f, pickle_module, pickle_protocol)
295     pickler = pickle_module.Pickler(f, protocol=pickle_protocol)
296     pickler.persistent_id = persistent_id
–> 297     pickler.dump(obj)
298
299     serialized_storage_keys = sorted(serialized_storages.keys())
TypeError: can’t pickle weakref objects