Neither PyTorch nor TensorFlow >= 2.0 have been found.Models won't be available and only tokenizers, configuration and file/data utilities can be used

Viewed 8447

I am trying to install transformers using pip

pip install transformers

after import transformers

this error show

Neither PyTorch nor TensorFlow >= 2.0 have been found.Models won't be available and only tokenizers, configuration, and file/data utilities can be used.

although I install TensorFlow-GPU= 2.3.1 and using conda

system info

Windows 10 
python 3.6
cuda 10.1
tensorflow-gpu= 2.3.1
2 Answers

You need one of them PyTorch or Tensorflow.

You can check if tensorflow is installed or you can reinstall it

  1. pip uninstall tensorflow
  2. pip install tensorflow==2.2.0(you can install only tensorflow it worked same as tensorflow-gpu)
  3. pip uninstall transformer
  4. pip install transformer==3.3.1

If this dosen't solve it,try to upgrade your python to 3.7.8

Hope it solve your promblem.

I found the problem after investigate for 10 hours

I installed tensorflow by using conda install tensorflow-gpu

and transformers by using pip after remove tensorflow-gpu and install it by using pip

it works fine

Related