AttributeError: module 'torchtext.data' has no attribute 'Field'


前言

伴随着 3月5日TorchText 0.9.0更新,一些API调用也发生变化


之前我们调用Field,TabularDataset,Iterator,BucketIterator是通过torchtext.data

代码如下(示例):

import torch
import torchtext
from torchtext.data import Field,TabularDataset,Iterator,BucketIterator

在torchtext0.9环境下,会报AttributeError: module ‘torchtext.data’ has no attribute ‘Field’

新的API调用代码如下(示例):

import torch
import torchtext
from torchtext.legacy.data import Field,TabularDataset,Iterator,BucketIterator

官方文档:https://github.com/pytorch/text/releases/tag/v0.9.0-rc5

AttributeError: module ‘torchtext.data‘ has no attribute ‘Field‘ 解决相关推荐

  1. 解决方法:AttributeError: module ‘torchtext.data‘ has no attribute ‘Field‘

    将 from torchtext.data import Field 改为 from torchtext.legacy.data import Field 同理,对于 from torchtext.d ...

  2. 【Flask】flask-bootstrap报错AttributeError: module ‘dominate.tags‘ has no attribute ‘input‘解决方法

    问题 在使用flask-bootstrap渲染表单时,报错AttributeError: module 'dominate.tags' has no attribute 'input'. 解决方法 修 ...

  3. AttributeError: module ‘cv2.cv2‘ has no attribute ‘xfeatures2d‘解决方法

    运行一段关于图像拼接的代码时,出现问题 AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' def __init__(sel ...

  4. module ‘torchtext.data‘ has no attribute ‘LabelField‘

    吐槽一句,torchtext比较垃圾,却不知道为啥这么多人用. 言归正传,原因是:torchtext更新了,新版本不这么用了. 解决办法: 将 from torchtext import data 改 ...

  5. 成功解决AttributeError: module ‘tornado.web‘ has no attribute ‘asynchronous‘

    成功解决AttributeError: module 'tornado.web' has no attribute 'asynchronous' 目录 解决问题 解决思路 解决方法 解决问题 Attr ...

  6. 成功解决AttributeError: module tensorflow.sets has no attribute intersection

    成功解决AttributeError: module tensorflow.sets   has no attribute intersection 目录 解决问题 解决思路 解决方法 T1.更新 t ...

  7. 成功解决AttributeError: module tensorflow.image has no attribute resize

    成功解决AttributeError: module tensorflow.image has no attribute resize 目录 解决问题 解决思路 解决方法 解决问题 Attribute ...

  8. 成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'

    成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' 目录 解决问题 解决思路 解决方法 解决问题 Attribute ...

  9. AttributeError: module ‘scipy.signal‘ has no attribute ‘correlation_lags‘

    一般这种问题,都是版本号不匹配的问题,通过 pip 更新安装包即可 我原来scipy的版本号是 1.5.2,执行代码 lags = signal.correlation_lags(len(u), le ...

最新文章

  1. 报名 | 数据科学研究院五周年系列论坛之“人文社科专场
  2. AWS — AWS 上的 5G 网络切片
  3. 利刃 MVVMLight 7:命令深入
  4. Androidstudio如何正确导入和移出jar包
  5. python批量新建文件夹_python根据txt文本批量创建文件夹
  6. ssh主机之间建立互信 --免密码
  7. CodeForces - 1332D Walk on Matrix(构造)
  8. HRBUST 1909——理工门外的树——————【离线处理,差分前缀和】
  9. 将Vue+Nodejs项目部署到阿里云服务器
  10. 秒半价,限四天!Vostro极致轻薄全能本,助你全能全开!
  11. 日志log4j配置详情,日志log具体到你想不到
  12. 【Siddhi】Siddhi 4.2.40版本之前的一个Bug
  13. 深入浅出裸测之道---单元测试的单元化
  14. Codeforces Round #467 (Div. 2)
  15. pycharm OpenCV代码补全失效解决方法
  16. PHP踩坑:对象的引用
  17. Ajax 重新绑定 webgrid 数据,绑定的WebGrid形式AJAX(Bind WebGrid form AJAX)
  18. UE4 C++最基础的API
  19. 分享CFA二级优质复习方法!
  20. 转载:破解DR.COM实现共享上网方法大搜罗(抱歉,直接转载

热门文章

  1. 医院管理php,医院管理系统接入php短信接口的应用
  2. 国外破解组织宣布《星际2》破解失败
  3. Java ASP Post
  4. linux查看pci设备c语言,linux 系统 查看pci设备的命令lspci
  5. DR平板探测器常识——非晶硒和非晶硅平板探测器的区别
  6. ANSVCC无功补偿装置在南京某高等院校中的应用——安科瑞崔远航
  7. 跟李沐学AI之注意力机制+transformer
  8. MakeCode图形编程应用在micro:bit上的多工性能实测
  9. golang pprof工具
  10. VS+QT 无法打开源文件解决方案