TrainingArgument

I have recently got the error ā€œNameError: name ā€˜PartialStateā€™ is not definedā€
when calling TrainingArguments() (when treating the course fine-tuning a model with
Trainer API)
Before getting this error I had already got the error ā€œImportError: Using the Trainer with PyTorch requires accelerate: Run pip install --upgrade accelerateā€
so I installed and import accelerate but after that I got the former error of 'PartialState"

I should remind I didnā€™t get those errors two weeks ago when I tested the code for the first time. Please kindly inform me what I should do now.

3 Likes

Installing a different version of transformers helped me: !pip install datasets transformers==4.28.0

4 Likes

Thanks @TestDvKrUA. That solved it for me too. A note for others. If it doesnā€™t catch your eye at first, there may be a message letting you know that you need to restart the runtime for it to take effect.

WARNING: The following packages were previously imported in this runtime:

  • [tokenizers,transformers]*
    You must restart the runtime in order to use newly installed versions.

Hi, bostan1345
Run:
!pip install -U accelerate transformers
And restart the kernel it works for me!