ltp icon indicating copy to clipboard operation
ltp copied to clipboard

ltp = LTP()时报错

Open chenjie97 opened this issue 3 years ago • 10 comments

image 为啥会报这个错误呢?

chenjie97 avatar Jun 28 '21 08:06 chenjie97

蹲一个解答,同样的错误

GuohyCoding avatar Jun 29 '21 03:06 GuohyCoding

看上去是路径解析出现了问题,应该是 transformers 那边没有考虑 windows 环境导致的,也许可以尝试手动加载本地模型?

AlongWY avatar Jun 30 '21 08:06 AlongWY

给个解答,不是路径冲突,而是 LTP 4.1.x 目前发布的模型文件不兼容 transformers 4.8.x,临时的解决方法:

pip install transformers==4.7.0

spindensity avatar Jul 01 '21 08:07 spindensity

按照上面说的改了,但是又出现#527的错误,而且是在能运行一段时间后。

liuyunwww avatar Jul 11 '21 07:07 liuyunwww

同样报这个错误。。。

lycz91 avatar Jul 13 '21 05:07 lycz91

安装以下版本的包可以正常运行,ltp版本号为4.1.5.post2: huggingface-hub-0.0.8 ltp-4.1.5.post2 pygtrie-2.4.2 sacremoses-0.0.45 tokenizers-0.10.3 transformers-4.7.0

MySilentCat avatar Jul 27 '21 03:07 MySilentCat

安装以下版本的包可以正常运行,ltp版本号为4.1.5.post2: huggingface-hub-0.0.8 ltp-4.1.5.post2 pygtrie-2.4.2 sacremoses-0.0.45 tokenizers-0.10.3 transformers-4.7.0

transformer 仍然显示 ImportError: cannot import name 'AutoModel'

MrYxJ avatar Aug 12 '21 01:08 MrYxJ

安装以下版本的包可以正常运行,ltp版本号为4.1.5.post2: huggingface-hub-0.0.8 ltp-4.1.5.post2 pygtrie-2.4.2 sacremoses-0.0.45 tokenizers-0.10.3 transformers-4.7.0

transformer 仍然显示 ImportError: cannot import name 'AutoModel'

这个问题我也遇到了,我这边是由于torch的版本低了,transformers需要torch >=1.3.0。希望对你有帮助

zy614582280 avatar Aug 17 '21 02:08 zy614582280

安装以下版本的包可以正常运行,ltp版本号为4.1.5.post2: huggingface-hub-0.0.8 ltp-4.1.5.post2 pygtrie-2.4.2 sacremoses-0.0.45 tokenizers-0.10.3 transformers-4.7.0

transformer 仍然显示 ImportError: cannot import name 'AutoModel'

这个问题我也遇到了,我这边是由于torch的版本低了,transformers需要torch >=1.3.0。希望对你有帮助

Yes,我后来将torch 1.2 -> torch 1.4,transformer 4.7后,报错解决。

MrYxJ avatar Aug 24 '21 07:08 MrYxJ

提供一组macos catalina 可行的组合:

pip install torch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0
pip install tensorflow==1.15
pip install ltp==4.1.0

python -c "from ltp import LTP"

shm007g avatar Sep 29 '21 05:09 shm007g

谢谢,MrYx已经收到您的邮件!

MrYxJ avatar Oct 11 '22 07:10 MrYxJ

mac Monterey 组合:

python version 3.8.8

pip install torch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 pip install transformer==3.5.1 pip install ltp==4.1.0

试了一个多小时才试出来......

zxmei1 avatar Feb 05 '23 05:02 zxmei1

谢谢,MrYx已经收到您的邮件!

MrYxJ avatar Feb 05 '23 05:02 MrYxJ