shibing624 / pycorrector

pycorrector is a toolkit for text error correction. 文本纠错,实现了Kenlm,T5,MacBERT,ChatGLM3,Qwen2.5等模型应用在纠错场景,开箱即用。
https://www.mulanai.com/product/corrector/
Apache License 2.0
5.61k stars 1.1k forks source link

运行ernie_csc_demo.py 报错,The models name: csc-ernie-1.0 is not in task:[text_correction] #400

Closed coder-2014 closed 1 year ago

coder-2014 commented 1 year ago
/opt/miniconda3/envs/pycorrector_ernie/lib/python3.8/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
  File "/home/house365ai/pycorrector/examples/ernie_csc_demo.py", line 27, in <module>
    corrector = ErnieCSCCorrector("csc-ernie-1.0")
  File "/home/house365ai/pycorrector/pycorrector/ernie_csc/ernie_csc_corrector.py", line 19, in __init__
    self.text_correction = Taskflow("text_correction", model=model)
  File "/opt/miniconda3/envs/pycorrector_ernie/lib/python3.8/site-packages/paddlenlp/taskflow/taskflow.py", line 822, in __init__
    assert self.model in set(TASKS[task][tag].keys()), f"The {tag} name: {model} is not in task:[{task}]"
AssertionError: The models name: csc-ernie-1.0 is not in task:[text_correction]
Yazooliu commented 1 year ago

it seems that your running environment is NOT corrected installed, it seems no model file

CroceCanale commented 1 year ago

Change "csc-ernie-1.0" into "ernie-csc", then the code could run.... See taskflow.py for detail