Importing TrainingArguments gives error

My code is:

from transformers import TrainingArguments

training_args = TrainingArguments(“test-trainer”)

I get error:
ImportError: Using the Trainer with PyTorch requires accelerate>=0.20.1: Please run pip install transformers[torch] or pip install accelerate -U

I have installed both libraries, but I still get the same error.

Is accelerate > 0.20.1? And if so, and if you are in colab, please ensure you do Runtime → Restart Runtime. This is a very common error :slight_smile:

1 Like

Yes, restarting worked for me, thanks :slight_smile: