# TrainingArgument

**URL:** <https://discuss.huggingface.co/t/trainingargument/39929>\
**Category:** 🤗Transformers\
**Created:** [May 15, 2023, 11:43am UTC](https://discuss.huggingface.co/t/trainingargument/39929 "2023-05-15T11:43:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bostan1345](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@bostan1345](https://discuss.huggingface.co/u/bostan1345)\
**Post date:** [May 15, 2023, 11:43am UTC](https://discuss.huggingface.co/t/trainingargument/39929/1 "2023-05-15T11:43:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TestDvKrUA](https://avatars.discourse-cdn.com/v4/letter/t/e68b1a/32.png) [@TestDvKrUA](https://discuss.huggingface.co/u/TestDvKrUA)\
**Post date:** [May 19, 2023, 7:37pm UTC](https://discuss.huggingface.co/t/trainingargument/39929/2 "2023-05-19T19:37:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ScottForsyth](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/scottforsyth/32/20040_2.png) [@ScottForsyth](https://discuss.huggingface.co/u/ScottForsyth)\
**Post date:** [October 3, 2023, 6:14pm UTC](https://discuss.huggingface.co/t/trainingargument/39929/3 "2023-10-03T18:14:45Z")

</div>

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._

---

<div class="post-metadata">

**Author:** ![natayafs](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/natayafs/32/20156_2.png) [@natayafs](https://discuss.huggingface.co/u/natayafs)\
**Post date:** [October 8, 2023, 12:12am UTC](https://discuss.huggingface.co/t/trainingargument/39929/4 "2023-10-08T00:12:21Z")

</div>

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