close

[Solved] Transformer: Error importing packages. “ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Transformer: Error importing packages. “ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’” in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Transformer: Error importing packages. “ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’” Error Occurs?

Today I get the following error Transformer: Error importing packages. “ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’” in Python.

How To Solve Transformer: Error importing packages. “ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’” Error ?

  1. How To Solve Transformer: Error importing packages. “ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'” Error ?

    To Solve Transformer: Error importing packages. “ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'” Error Change the torch version in colab by running this command !pip install torch==1.4.0. Then, It worked for me.

Solution 1

Change the torch version in colab by running this command

!pip install torch==1.4.0. Then, It worked for me.

Solution 2

Just change the version of tranformers to the latest one (4.5.1 at this time). That worked in colab.

!pip install transformers

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment