4 frames
/usr/local/lib/python3.10/dist-packages/transformers/training_args.py in _setup_devices(self)
1670 if not is_sagemaker_mp_enabled():
1671 if not is_accelerate_available(min_version=“0.20.1”):
→ 1672 raise ImportError(
1673 “Using the Trainer with PyTorch requires accelerate>=0.20.1: Please run pip install transformers[torch] or pip install accelerate -U”
1674 )
ImportError: Using the Trainer with PyTorch requires accelerate>=0.20.1: Please run pip install transformers[torch] or pip install accelerate -U
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
“Open Examples” button below.
I try to pip install the recommended ones but never work for me.
Help!
I experienced the same import error when running the following script from the hugging face transformer quick tour. Installing the 2 mentioned libraries did not resolve.
I’m getting the same error in the colab notebook for the NLP Course: Lesson 3 - Fine-tuning model with the Trainer API. In order to get around it you can:
Run pip install accelerate -U in a cell
In the top menu click Runtime → Restart Runtime
Do not rerun any cells with !pip install in them
Rerun all the other code cells and you should be good to go!
On a side note, be sure to turn on a GPU for this notebook by clicking Edit → Notebook Settings → GPU type - from the top menu. This was the next thing that got me : )