几天来,我一直在尝试在不同的机器上安装和运行 pytext,并一直(最终)遇到相同的错误:
Python 3.8.0 (default, Feb 25 2021, 22:10:10)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import pytext
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/joshnoble/pytext/pytext/__init__.py", line 12, in <module>
from pytext.data.sources.data_source import DataSource
File "/home/joshnoble/pytext/pytext/data/__init__.py", line 12, in <module>
from .data import Batcher, Data, PoolingBatcher, generator_iterator
File "/home/joshnoble/pytext/pytext/data/data.py", line 20, in <module>
from .tensorizers import MetricTensorizer, Tensorizer, initialize_tensorizers
File "/home/joshnoble/pytext/pytext/data/tensorizers.py", line 24, in <module>
from pytext.data.tokenizers import Token, Tokenizer
File "/home/joshnoble/pytext/pytext/data/tokenizers/__init__.py", line 4, in <module>
from .tokenizer import (
File "/home/joshnoble/pytext/pytext/data/tokenizers/tokenizer.py", line 15, in <module>
from pytext.torchscript.tokenizer import ScriptDoNothingTokenizer, ScriptWordTokenizer
File "/home/joshnoble/pytext/pytext/torchscript/tokenizer/__init__.py", line 4, in <module>
from .bpe import ScriptBPE
File "/home/joshnoble/pytext/pytext/torchscript/tokenizer/bpe.py", line 8, in <module>
from pytext.torchscript.utils import utf8_chars
File "/home/joshnoble/pytext/pytext/torchscript/utils.py", line 10, in <module>
torch.ops.load_library("//caffe2/torch/fb/nlp/operators:padded_sequences")
File "/home/joshnoble/.local/lib/python3.8/site-packages/torch/_ops.py", line 104, in load_library
ctypes.CDLL(path)
File "/usr/lib/python3.8/ctypes/__init__.py", line 369, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /caffe2/torch/fb/nlp/operators:padded_sequences: cannot open shared object file: No such file or directory
我以为我已经在 virtualenv 中成功构建了 pytext 并使用此处的说明安装了它,也只需运行setup.py install发行版附带的,但最终我都在同一个地方。我不确定我可能需要哪些其他软件包?我确实安装了火炬,我可以检查它是否工作,有 CUDA,并且似乎或多或少地工作,但 pytext 本身似乎难以捉摸。非常感谢任何提示或建议。