Pytorch——报错解决:‘torchtext.data‘ has no attribute ‘Iterator‘

报错截图

在这里插入图片描述

'torchtext.data' has no attribute 'Iterator'

解决方法

from torchtext.data import Iterator

改成:

from torchtext.legacy.data import Iterator

参考文章:

  • module ‘torchtext.data’ has no attribute ‘Iterator’ #1275

你可能感兴趣的:(pytorch,pytorch,人工智能,python)