我正在尝试将OpenNMT-py与 python 2.7 一起使用。OpenNMT-py 需要torchtext
,所以我安装了它,但现在当我运行我的程序时,我收到以下错误消息。
Traceback (most recent call last):
File "examples/StackPointerParser.py", line 23, in <module>
from neuronlp2.io import get_logger, conllx_stacked_data
File "./neuronlp2/__init__.py", line 7, in <module>
from . import models
File "./neuronlp2/models/__init__.py", line 4, in <module>
from .parsing import *
File "./neuronlp2/models/parsing.py", line 15, in <module>
from onmt.modules import LayerNorm, Transformer
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/onmt/__init__.py", line 1, in <module>
import onmt.io
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/onmt/io/__init__.py", line 1, in <module>
from onmt.io.IO import collect_feature_vocabs, make_features, \
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/onmt/io/IO.py", line 8, in <module>
import torchtext.data
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/torchtext/__init__.py", line 1, in <module>
from . import data
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/torchtext/data/__init__.py", line 4, in <module>
from .field import RawField, Field, ReversibleField, SubwordField, NestedField, LabelField
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/torchtext/data/field.py", line 61, in <module>
class Field(RawField):
File "/home/wasiahmad/software/anaconda2/lib/python2.7/site-packages/torchtext/data/field.py", line 115, in Field
torch.float32: float,
AttributeError: 'module' object has no attribute 'float32'
我试图寻找解决此问题的解决方案,但找不到任何解决方案。任何帮助,将不胜感激。