I can not import transformers
See original GitHub issue🐛 Bug
Information
when I execute “from transformers import TFBertModel, BertModel” in ipython, the error, “ImportError: cannot import name ‘BartConfig’ from ‘transformers.configuration_auto’” was raised. This error occured after the tensorflow update from version 2.0 to version 2.1 and the python update from version 3.6 to 3.7.
In addition, after I update the python from version 3.6 to 3.7, I installed torch1.4 and tensorflow2.1 in a same env, the “import” is always failed but when I “import transformers” in other env which only include torch1.4 and python3.7, it succeed I want to know how to make it. Thank you.
transformers
version:2.5.1- Platform: windows10
- Python version: 3.7.6
- PyTorch version (GPU?):GPU1.4
- Tensorflow version (GPU?):GPU2.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Transformer: Error importing packages. "ImportError ...
Change the torch version in colab by running this command !pip install torch==1.4.0. Then, It worked for me.
Read more >How to resolve the hugging face error ImportError: cannot ...
I was trying to use the ViTT transfomer. I got the following error with code: from pathlib import Path import torchvision from typing...
Read more >cannot import name 'pegasusforconditionalgeneration ...
The message suggests that the import is not available in your transformers installation. You should manually check that it has been ...
Read more >Why does it say Import "transformers" could not be ...
It could have been any library you were trying to import and it would've given you the same message. Transformers was probably the...
Read more >[Example code]-Can not import pipeline from transformers
Check transformers version. Make sure you are on latest. Pipelines were introduced quite recently, you may have older version. igrinis 11292. score ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can import it and my python version is 3.7.6 , 2.8.0 for transformers and 2.1 for tf. Maybe you could try to upgrade your python if its’ version is under 3.7.
Hmm, the next day I tried it again with the same environment and it works xD Probably because of rebooting or something. But I also rebooted the first day, idk…