Skip to content

ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' #8232

Description

@yuchenlin

Environment info

  • transformers version:
  • Platform: ubuntu 18.04
  • Python version: 3.7
  • PyTorch version (GPU?): 1.4.0
  • Tensorflow version (GPU?):
  • Using GPU in script?: no
  • Using distributed or parallel set-up in script?:no

Who can help

Trainer: @sgugger

Information

This import is not compatible with PyTorch 1.4.0

The problem arises when using:

  • [ *] the official example scripts: (give details below)

The tasks I am working on is:

  • [ *] an official GLUE/SQUaD task: (give the name)

To reproduce

Steps to reproduce the behavior:

>>> from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuchenlin/anaconda3/envs/mcqa/lib/python3.7/site-packages/transformers/__init__.py", line 611, in <module>
    from .trainer import Trainer
  File "/home/yuchenlin/anaconda3/envs/mcqa/lib/python3.7/site-packages/transformers/trainer.py", line 69, in <module>
    from .trainer_pt_utils import (
  File "/home/yuchenlin/anaconda3/envs/mcqa/lib/python3.7/site-packages/transformers/trainer_pt_utils.py", line 26, in <module>
    from torch.optim.lr_scheduler import SAVE_STATE_WARNING
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (/home/yuchenlin/anaconda3/envs/mcqa/lib/python3.7/site-packages/torch/optim/lr_scheduler.py)

Expected behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions