Sht
Sht

Reputation: 189

ImportError: cannot import name 'BigBirdTokenizer' from 'transformers' (/usr/local/lib/python3.7/dist-packages/transformers/__init__.py)

In my env(colab) I need the following library. Here is the list :

!pip install --quiet transformers==4.1.1
!pip install --quiet pytorch-lightning==1.1.3
#!pip install pytorch-lightning
!pip install --quiet tokenizers==0.9.4
!pip install --quiet sentencepiece==0.1.94
!pip install torchtext==0.8.0 torch==1.7.1 pytorch-lightning==1.1.3

After I am importing FARMReader and TransformersReader from haystack library. Here is the code

!pip install grpcio-tools==1.34.1
!pip install git+https://github.com/deepset-ai/haystack.git
from haystack.reader.farm import FARMReader
from haystack.reader.transformers import TransformersReader

This gives me the error:

ImportError: cannot import name 'BigBirdTokenizer' from 'transformers' (/usr/local/lib/python3.7/dist-packages/transformers/__init__.py)

I tried to reinstall transformers other version but this does not work:

!pip install --quiet transformers==4.7.0

Upvotes: 1

Views: 779

Answers (1)

Julian Risch
Julian Risch

Reputation: 271

I couldn't reproduce the error with the current master branch of haystack although I executed the exact same steps as mentioned in the question.

If you are still facing this issue, I suggest to start with a fresh virtual environment and check that you are really installing in that environment from the current master branch via

!pip install git+https://github.com/deepset-ai/haystack.git

or as an alternative install the latest release via

!pip install farm-haystack

Upvotes: 1

Related Questions