ERNIE finetune模型加载
收藏
paddlehub的ERNIE通过finetune得到的模型下次使用时如何加载
0
收藏
请登录后评论
用预测脚本时,指定存储的模型路径
使用finetune下次预测时候加载模型的函数是哪一个呢
你好,我也遇到了这个问题,请问您解决了吗。
已解决:
我的checkpoint保存路径如下:
model:/home/nlp306/xgt/sentiment_analysis/checkpoint/model_checkpoint
tokenizer:/home/nlp306/xgt/sentiment_analysis/checkpoint/tokenizer_checkpoint
则想要在预测时加载这些参数只需如下操作(模型初始化时指定参数文件路径):
model = ppnlp.transformers.ErnieForSequenceClassification.from_pretrained(
'/home/nlp306/xgt/sentiment_analysis/checkpoint/model_checkpoint', num_classes=2)
tokenizer = ppnlp.transformers.ErnieTokenizer.from_pretrained(
'/home/nlp306/xgt/sentiment_analysis/checkpoint/tokenizer_checkpoint')
赞,可以指定路径