MECT4CNER icon indicating copy to clipboard operation
MECT4CNER copied to clipboard

无法使用torch.load加载保存下来的model

Open yysirs opened this issue 3 years ago • 2 comments

Trainer训练完成后,使用torch.load,无法加载保存下来的模型 报错:

ModuleNotFoundError: No module named 'model'

我查看了Fastnlp中Trainer保存best model的代码,是

model.cpu()
torch.save(model,model_path)

使用torch.load应该没有问题的,请问作者大大怎么加载训练完成的best model

yysirs avatar Mar 27 '22 03:03 yysirs

Trainer训练完成后,使用torch.load,无法加载保存下来的模型 报错:

ModuleNotFoundError: No module named 'model'

我查看了Fastnlp中Trainer保存best model的代码,是

model.cpu()
torch.save(model,model_path)

使用torch.load应该没有问题的,请问作者大大怎么加载训练完成的best model

同问

houyuchao avatar Apr 15 '24 13:04 houyuchao

我在加载模型的时候报错模型对象不可迭代,请问有大佬知道原因吗?

JustinPeanut avatar May 23 '24 12:05 JustinPeanut