load模型checkpoint, 第二次预测出问题
Created by: xfyu1999
https://github.com/PaddlePaddle/models/blob/v1.6/PaddleNLP/emotion_detection/run_classifier.py 照这个改的预测代码,就是load模型checkpoints,我们想做成那种api形式的,load一次模型,多次预测,第二次预测出问题:
Load model from ../inference_model_v5/cnn/step_220000 现 在 怎 么 办 <paddle.fluid.reader.GeneratorLoader object at 0x7fda24345450> bb [array([[6.2673175e-01, 6.5273693e-04, 6.8719119e-02, ..., 2.0736305e-14, 1.4468053e-13, 1.3849883e-12]], dtype=float32)] {"sentence":"现在怎么办"} {"topic": "DFT", "prob": 0.626732} 怎 么 办 <paddle.fluid.reader.GeneratorLoader object at 0x7fda24345450> bb Traceback (most recent call last): File "topic_api_init.py", line 326, in b = a.inference(input_json) File "topic_api_init.py", line 308, in inference [label_key, prob] = main(args, test_exe, test_prog, infer_loader, probs) File "topic_api_init.py", line 203, in main "infer") TypeError: 'NoneType' object is not iterable
我们的预测代码可私聊。