ImportError: Using the Trainer with PyTorch requires accelerate = 0.20.1
Question:
Please help me when I tried to use it in my Google Colab for transformers
error:
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.
transformers – GPT – pytorch
Answers:
Steps:
pip install accelerate -U
then
Restart the notebook
run all
and you’ll see it’ll solve
I had the same error in Colab with:
pip install transformers
from transformers import TrainingArguments
training_args = TrainingArguments(output_dir="test_trainer")
# ...
# ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.20.1`: Please run `pip install transformers[torch]` or `pip install accelerate -U`
What helped was:
!pip install transformers==4.28.0
(and restarting the runtime afterwards)
PS This was not my idea of course, credits go to: https://discuss.huggingface.co/t/cant-use-trainer-in-colab/50370/2
Please help me when I tried to use it in my Google Colab for transformers
error:
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.
transformers – GPT – pytorch
Steps:
pip install accelerate -U
then
Restart the notebook
run all
and you’ll see it’ll solve
I had the same error in Colab with:
pip install transformers
from transformers import TrainingArguments
training_args = TrainingArguments(output_dir="test_trainer")
# ...
# ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.20.1`: Please run `pip install transformers[torch]` or `pip install accelerate -U`
What helped was:
!pip install transformers==4.28.0
(and restarting the runtime afterwards)
PS This was not my idea of course, credits go to: https://discuss.huggingface.co/t/cant-use-trainer-in-colab/50370/2