!pip install -U transformers
Successfully uninstalled transformers-4.21.3
Successfully installed huggingface-hub-0.16.4 safetensors-0.3.3 transformers-4.32.1
Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (4.32.1)
from transformers import LlamaTokenizer
ImportError: cannot import name ‘LlamaTokenizer’ from ‘transformers’ (/usr/local/lib/python3.9/dist-packages/transformers/init.py)
Maybe your pip install command is installing the latest transformers for a different version of python than the one you’re trying to run.
You should confirm that
pip is installing packages for
pip --version and check if the path it shows is python3.9.
You might need to instead run
pip3 install -U transformers or
python3.9 -m pip install -U transformers
it was not working on paperspace.com
I tried on colab and it worked