transformers: ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.20.1`: Please run `pip install transformers[torch]` or `pip install accelerate -U`
System Info
I’m running the example code from https://huggingface.co/docs/transformers/training
on a Colab
and it’s failing with
/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
However, it still gives the error even after I pip install the recommended libraries.
Also, pip freeze shows that accelerate is accelerate==0.20.3 which should satisfy the requirement of accelerate>=0.20.1
- so I’m not sure why the Trainer is throwing the error.
Thanks for taking a look @sgugger
Who can help?
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, …) - My own task or dataset (give details below)
Expected behavior
To run training
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 7
- Comments: 18
You need to restart your colab environment after updating the library.
"Is there an alternative method? Restarting and rerunning all the cells consumes a significant amount of time.
restart virtalenv slove my same issue,thanks