Skip to main content
 首页 » 编程设计

python之"thinc.extra.MaxViolation has wrong size"的 Spacy-nightly (spacy 2.0) 问题

2024年10月01日6bhlsheji

在显然成功安装 spacy-nightly (spacy-nightly-2.0.0a14) 和英语模型 (en_core_web_sm) 之后,我在尝试运行它时仍然收到错误消息

import spacy 
nlp = spacy.load('en_core_web_sm') 
 
ValueError: thinc.extra.search.MaxViolation has the wrong size, try recompiling. Expected 104, got 128 

我也尝试重新安装 spacy 和 model,但没有帮助。在新的 venv (Python 3.6) 中再次尝试

请您参考如下方法:

问题可能与 thinc 包有关,spacy-nightly 需要 thinc<6.9.0,>=6.8.1 但版本 6.8.2 导致了一些问题 --> 如何解决t在安装 spacy-nightly 之前 运行命令

pip install thinc==6.8.1 

在此之后一切对我来说都很好。

后来我发现我不是唯一面临这个问题的人https://github.com/explosion/spaCy/issues/1374