Any help please
def load_model(model,epoch,model_type):
path = models_path + 'saved_'+model_type+'_epoch'+str(epoch)+'.txt'
print("Loading model from %s" % path)
model.load_state_dict(torch.load(path)['model_state_dict'])
return model
# load model
embed_epoch = 1
model_embed = load_model(model_embed,embed_epoch,'embed')
model_embed.to(device)
Loading model from /content/drive/MyDrive/Models/saved_embed_epoch1.txt
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-64-da43c88e687e> in <module>()
1 # load model
2 embed_epoch = 1
----> 3 model_embed = load_model(model_embed,embed_epoch,'embed')
4 model_embed.to(device)
5 # load model
<ipython-input-63-7b862763f577> in load_model(model, epoch, model_type)
3 print("Loading model from %s" % path)
4
----> 5 model.load_state_dict(state_dict['state_dict'])
6
7
AttributeError: 'str' object has no attribute 'load_state_dict'