I have done a small experiment:
Using torch.save
and torch.load
works as expected
l = [1, 2, 3]
torch.save(l, 'test.pkl')
l = torch.load('test.pkl')
But when I try torch.save
with pickle.load
I got an error. Is it wrong approach?
l = [1, 2, 3]
torch.save(l, 'test.pkl')
with open('test.pkl', mode='rb') as f:
l = pickle.load(f)
Traceback is:
UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
Is it wrong to use torch.save
with pickle.load
?