I am trying to save and load a model, but there is always an error. I save the model with:
torch.save(model.state_dict(),'01.Code/models/SNNNotEncoded.pth' )
and I try to load the model with
model.load_state_dict('01.Code/models/SNNNotEncoded.pth')
Then, the following error will come up:
Traceback (most recent call last): File "/home/demaisch/git/ros_workspaces/demaisch_ws/PythonFIles/SNNtrainNotEncoded.py", line 26, in model.load_state_dict('01.Code/models/SNNNotEncoded.pth') File "/home/demaisch/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1994, in load_state_dict raise TypeError("Expected state_dict to be dict-like, got {}.".format(type(state_dict))) TypeError: Expected state_dict to be dict-like, got <class 'str'>
Thanks in advance