在做Fine-tune保存的模型转化为一个PaddleHub Module时报了错
Created by: zhuyingjun-zyj
使用fine-tune后的RENIE模型做文本分类后,将其转化为Paddle Hub Module时报错了 具体错误信息:
[2020-06-11 16:48:50,307] [ INFO] - Load the best model from D:\project\test\textPaddle\finetuned_model_to_module\modle.ckpt\best_model
C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\paddle\fluid\executor.py:1093: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used.
warnings.warn(error_info)
[2020-06-11 16:49:00,985] [ INFO] - PaddleHub predict finished.
Traceback (most recent call last):
File "D:/project/test/textPaddle/finetuned_model_to_module/module.py", line 91, in <module>
predictions = ernie_tiny.predict(data=data)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\paddlehub\module\module.py", line 72, in _wrapper
return func(*args, **kwargs)
File "D:\project\test\textPaddle\finetuned_model_to_module\module.py", line 82, in predict
accelerate_mode=accelerate_mode)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\paddlehub\finetune\task\base_task.py", line 1024, in predict
return self._postprocessing(run_states)
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\paddlehub\finetune\task\classifier_task.py", line 156, in _postprocessing
results += [id2label[sample_infer] for sample_infer in batch_infer]
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\paddlehub\finetune\task\classifier_task.py", line 156, in <listcomp>
results += [id2label[sample_infer] for sample_infer in batch_infer]
KeyError: 1