Dear all,
The following code was working fine with pytorch 1.5.0 and is now failing:
with open('test.pkl', 'wb') as f:
torch.save(4, f)
torch.save(5, f)
with open('test.pkl', 'rb') as f:
assert torch.load(f) == 4
assert torch.load(f) == 5
I get the following error
~/anaconda3/envs/env38/lib/python3.8/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
583 return torch.jit.load(opened_file)
584 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
--> 585 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
586
587
~/anaconda3/envs/env38/lib/python3.8/site-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
753 "functionality.".format(type(f)))
754
--> 755 magic_number = pickle_module.load(f, **pickle_load_args)
756 if magic_number != MAGIC_NUMBER:
757 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.