我正在spaCy中安装法国变压器模型,安装法语版本"fr_dep_news_trf“时出错。
我在英国和法国的变压器模型上都尝试了以下方法,下面是我得到的。每种方法都安装了英文版本,但法文本没有安装。
我看到的唯一其他途径是导入meta.json文件,但到目前为止我还没有找到语法。
如果有人有办法解决这个问题,我们将不胜感激。我可以过得去,但我对Python相对来说还是比较新的。抱歉,下面的错误信息太长了。
从命令行导入方法:python -m spacy download fr_dep_news_trf
错误:
Building wheels for collected packages: sentencepiece
Building wheel for sentencepiece (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]有更多的错误,但它们都是关于句子。
从命令行导入方法:pip install https://github.com/explosion/spacy-models/releases/download/fr_dep_news_trf-3.2.0/fr_dep_news_trf-3.2.0.tar.gz
错误:
cl : Command line warning D9025 : overriding '/MD' with '/MT'
sentencepiece_wrap.cxx
src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for sentencepiece
Running setup.py clean for sentencepiece
Successfully built fr-dep-news-trf
Failed to build sentencepiece
Installing collected packages: sentencepiece, protobuf, fr-dep-news-trf
Running setup.py install for sentencepiece ... error
error: subprocess-exited-with-error
× Running setup.py install for sentencepiece did not run successfully.
│ exit code: 1
╰─> [23 lines of output]从Python导入方法:
import spacy
spacy.cli.download("en_core_web_sm")错误: python窗口在到达句子后关闭,所以我尝试在setup(中运行它,并在第104行的setup(之后得到了这个错误。同样,它提到了sentencepiece。
Exception has occurred: SystemExit (note: full exception trace is shown but execution is paused at: <module>)
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
File "C:\Users\mariejjn\AppData\Local\Temp\pip-install-qzfw8naf\sentencepiece_040c07904fab42a4afd6e3aa257f72da\setup.py", line 104, in <module>
setup(
File "<string>", line 2, in <module> (Current frame)从Python导入方法:
>>> nlp4 = Language().from_disk("E:\MyDocuments-New\LannguageModels\fr_dep_news_trf\fr_dep_news_trf-3.2.0")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\mariejjn\AppData\Local\Programs\Python\Python310\lib\site-packages\spacy\language.py", line 2039, in from_disk
util.from_disk(path, deserializers, exclude) # type: ignore[arg-type]
File "C:\Users\mariejjn\AppData\Local\Programs\Python\Python310\lib\site-packages\spacy\util.py", line 1300, in from_disk
reader(path / key)
File "C:\Users\mariejjn\AppData\Local\Programs\Python\Python310\lib\site-packages\spacy\language.py", line 2025, in <lambda>
deserializers["tokenizer"] = lambda p: self.tokenizer.from_disk( # type: ignore[union-attr]
File "spacy\tokenizer.pyx", line 752, in spacy.tokenizer.Tokenizer.from_disk
File "C:\Users\mariejjn\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1117, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
OSError: [Errno 22] Invalid argument: 'E:\\MyDocuments-New\\LannguageModels\x0cr_dep_news_trf\x0cr_dep_news_trf-3.2.0\\tokenizer'我还得到了一个错误与nlp = nlp.from_disk("E:\MyDocuments-New\LannguageModels\fr_dep_news_trf\fr_dep_news_trf-3.2.0")
发布于 2022-04-05 16:19:54
根据polm23的一条提示,我尝试在python3.7和3.9中安装哨兵表和fr_dep_news_trf,它们都起作用了。只有3.10不起作用。
发布于 2022-06-23 05:49:00
您可以使用基于内核的python解释器,如conda,用于windows及其良好的Mac和Linux环境。Spacy是用C语言构建的,因此在最新的python环境中可能会出现故障。
https://stackoverflow.com/questions/71739751
复制相似问题