我正在尝试实现这篇文章的https://towardsdatascience.com/bert-text-classification-using-pytorch-723dfb8b6b5b,但我有以下问题。
# Preliminaries
from torchtext.data import Field, TabularDataset, BucketIterator, Iterator错误
ImportError: cannot import name 'Field' from 'torchtext.data' (/usr/local/lib/python3.7/dist-packages/torchtext/data/__init__.py)
OSError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZNK3c104Type14isSubtypeOfExtESt10shared_ptrIS0_EPSo发布于 2021-11-01 02:55:46
试一试
from torchtext.legacy.data import Field, TabularDataset, BucketIterator, Iterator字段是自0.9版本以来Torchtext的遗留功能。你链接的那篇文章来自那次发布之前。如果您获得了最新的torchtext,但正在尝试使用旧版功能,则需要使用torchtext.Legendage。*
有关更多信息,请查看this tutorial。
https://stackoverflow.com/questions/69765669
复制相似问题