PaddleNLP [问题]:Ernie分类模型训练完成后,使用taskflow进行预测却没有结果,

r9f1avp5  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(59)

paddlenlp版本为2.5.1
代码

from paddlenlp import Taskflow
cls = Taskflow("text_classification", task_path='./output/nano_9w/export', is_static_model=True)
cls(["黑苦荞茶的功效与作用及食用方法","幼儿挑食的生理原因是"])

输出

/root/paddlejob/workspace/env_run/python37-gcc820/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py:943: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  collections.MutableMapping.register(ParseResults)
/root/paddlejob/workspace/env_run/python37-gcc820/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py:3226: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  elif isinstance( exprs, collections.Iterable ):
/root/paddlejob/workspace/env_run/python37-gcc820/lib/python3.7/site-packages/setuptools/depends.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
[2023-07-20 11:36:05,754] [    INFO] - We are using <class 'paddlenlp.transformers.ernie.tokenizer.ErnieTokenizer'> to load './output/nano_9w/export'.
[2023-07-20 11:36:09,522] [    INFO] - Load id2label from ./output/nano_9w/export/id2label.json.

没有输出任何结果

mdfafbf1

mdfafbf11#

print(cls(["黑苦荞茶的功效与作用及食用方法","幼儿挑食的生理原因是"]))
uklbhaso

uklbhaso2#

出现了同样的问题,运行之后Python程序自己结束了,没有输出结果。

vlju58qv

vlju58qv3#

paddlepaddle装2.3.0,paddlenlp装2.3.4,应该就能跑出结果了。怀疑是paddlenlp最新版本有bug

相关问题