question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
over-shinecommented, Apr 12, 2020

This issue still exists. I have Tensorflow 2.1 with GPU and transformers version 2.8.0

I tried with rebooting and creating new conda environments multiple times but still no success 😦

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.

0reactions
AGregorccommented, Apr 15, 2020

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found