pytorch - ImportError:无法导入名称“warmup_linear”
问题描述
尝试导入warmup_linear
时,出现此错误
ImportError: cannot import name 'warmup_linear'
进口 -
from pytorch_pretrained_bert.optimization import BertAdam, warmup_linear
需求文件
boto3==1.9.198
botocore==1.12.198
certifi==2019.6.16
chardet==3.0.4
docutils==0.14
h5py==2.9.0
idna==2.8
jmespath==0.9.4
Keras==2.2.4
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
numpy==1.17.0
Pillow==6.1.0
python-dateutil==2.8.0
pytorch-pretrained-bert==0.6.2
PyYAML==5.1.1
regex==2019.6.8
requests==2.22.0
s3transfer==0.2.1
scipy==1.3.0
seqeval==0.0.12
six==1.12.0
torch==1.1.0
torchvision==0.3.0
tqdm==4.32.2
urllib3==1.25.3
导入“warmup_linear”需要做什么?
解决方案
将导入行更改为:
from pytorch_pretrained_bert.optimization import BertAdam, WarmupLinearSchedule
因为脚本中没有命名类warmup_linear
。optimization.py
推荐阅读
- java - 找不到构建工具修订版 29.0.2 - Android Studio
- flutter - 对齐小部件的中心
- iis - 在 IIS 站点中添加绑定特定的 CSP 框架祖先 HTTP 标头
- mysql - 分组方式无法创建查询
- html - 使用 CSS flexbox 制作一个四方形的照片库
- javascript - 如何在 php 中获取 http 请求上传文件名?
- php - PHP 如果 $_GET 为空,则从数据库中选择所有内容
- python - Group Vars 中的 Ansible Lookup Plugin 被多次调用
- laravel - 如何在 vue js 上循环
- java - 当我重新加载我的 bukkit 服务器时,为什么会收到关于 plugin.yml 的错误?