Closed s1162276945 closed 4 years ago
Trainer的sava_path不为None的时候,会出现: UserWarning: Couldn't retrieve source code for container of type ConditionalRandomField. It won't be checked for correctness upon loading. 虽然也保存了模型,但是加载之后会报错,请问这个怎么处理呢?
因为当前Trainer用的torch.save直接save整个model,所以需要在训练时相同路径下加载才能正确运行。如果只保存参数,请使用https://fastnlp.readthedocs.io/zh/latest/fastNLP.core.callback.html#fastNLP.core.callback.SaveModelCallback这个Callback。
Trainer的sava_path不为None的时候,会出现: UserWarning: Couldn't retrieve source code for container of type ConditionalRandomField. It won't be checked for correctness upon loading. 虽然也保存了模型,但是加载之后会报错,请问这个怎么处理呢?