ltp icon indicating copy to clipboard operation
ltp copied to clipboard

运行报错:FileNotFoundError: config.json not found in LTP/small

Open chenhz2284 opened this issue 2 years ago • 9 comments

我在运行 from ltp import LTP ltp = LTP() 的时候报错: config.json not found in HuggingFace Hub Traceback (most recent call last): File "C:\setup\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\setup\PyCharm Community Edition 2021.2.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/test/python/jieba_test/main.py", line 6, in <module> ltp = LTP() # 默认加载 Small 模型 File "D:\test\python\jieba_test\venv\lib\site-packages\ltp\interface.py", line 122, in LTP raise FileNotFoundError(f"{CONFIG_NAME} not found in {model_id}") FileNotFoundError: config.json not found in LTP/small 这个问题要怎么解决?

chenhz2284 avatar Mar 09 '23 13:03 chenhz2284

是不是网络不太好,或者你可以先下载下来

AlongWY avatar Mar 11 '23 16:03 AlongWY

我也遇到了这样的问题,请问您最后怎么解决的呢?

dujuanjuan-svg avatar Sep 13 '23 01:09 dujuanjuan-svg

同问,试了好多方法还是不行

xuhaozheh avatar Sep 24 '23 12:09 xuhaozheh

ltp4.0及以上版本的模型是上传在huggingface平台上的,目前该平台不支持包括港澳在内国内节点的访问。程序中直接执行ltp=LTP()默认加载时,会自动去模型链接下载该模型到本地,由于访问失败导致下载模型失败有可能产生该问题。 你可以使用其他地区的节点(American)来访问以下链接下载模型到本地,然后使用ltp=LTP(path="********")来加载模型。 链接如下:https://huggingface.co/LTP

WingFLY000 avatar Oct 11 '23 01:10 WingFLY000

@WingFLY000 似乎是每次都会连接huggingface尝试下载 如果已经下载,这么不合适吧? 每次都在卡在那里

wencan avatar Oct 15 '23 14:10 wencan

@WingFLY000 似乎是每次都会连接huggingface尝试下载 如果已经下载,这么不合适吧? 每次都在卡在那里 如果你给定了正确的模型文件路径,它会使用本地模型

WingFLY000 avatar Oct 17 '23 00:10 WingFLY000

怎么解决 我也卡了一下午了

litterairplane avatar Oct 30 '23 08:10 litterairplane

https://blog.csdn.net/weixin_44671324/article/details/134872757 这个问题解法如下,但是速度无比的慢,有无大哥分享下载好的数据

pioneerRick avatar Jan 15 '24 09:01 pioneerRick

我即使指定了绝对路径,也还是不行,有人知道为什么吗?

xy1137030414 avatar Mar 22 '24 07:03 xy1137030414