# Accelerator.\_\_init\_\_() got an unexpected keyword argument 'use\_seedable\_sampler'

**URL:** <https://discuss.huggingface.co/t/accelerator-init-got-an-unexpected-keyword-argument-use-seedable-sampler/91679>\
**Category:** 🤗Accelerate\
**Created:** [June 12, 2024, 6:21am UTC](https://discuss.huggingface.co/t/accelerator-init-got-an-unexpected-keyword-argument-use-seedable-sampler/91679 "2024-06-12T06:21:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sany1997](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sany1997/32/28121_2.png) [@Sany1997](https://discuss.huggingface.co/u/Sany1997)\
**Post date:** [June 12, 2024, 6:21am UTC](https://discuss.huggingface.co/t/accelerator-init-got-an-unexpected-keyword-argument-use-seedable-sampler/91679/1 "2024-06-12T06:21:46Z")

</div>

I am trying to define the training by the following code snippet:

```auto
model = T5ForConditionalGeneration.from_pretrained('t5-small')

# ! pip install -U 'accelerate==0.21.0'
# ! pip install transformers[pytorch]

training_args = TrainingArguments(
    output_dir='/content/drive/MyDrive/Results', # output directory
    num_train_epochs=3, # number of training epochs
    per_device_train_batch_size=4, # batch size for training
    per_device_eval_batch_size=4, # batch size for evaluation
    warmup_steps=500, # number of warmup steps for learning rate scheduler
    weight_decay=0.01, # strength of weight decay
    logging_dir='./logs', # directory for storing logs
    logging_steps=10,
    evaluation_strategy="epoch", # evaluate at the end of each epoch
)

trainer = Trainer(
    model=model,                         
    args=training_args, # training arguments, defined above
    train_dataset=train_dataset, # training dataset
    eval_dataset=val_dataset, # evaluation dataset
)

```

But I am getting this error:

```auto
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-98d5893e43cf> in <cell line: 13>()
     11 )
     12 
---> 13 trainer = Trainer(
     14 model=model, # the instantiated Transformers model to be trained
     15 args=training_args, # training arguments, defined above

1 frames
/usr/local/lib/python3.10/dist-packages/transformers/trainer.py in create_accelerator_and_postprocess(self)
   4533 
   4534 # create accelerator object
-> 4535 self.accelerator = Accelerator(**args)
   4536 # some Trainer classes need to use `gather` instead of `gather_for_metrics`, thus we store a flag
   4537 self.gather_function = self.accelerator.gather_for_metrics

TypeError: Accelerator. __init__ () got an unexpected keyword argument 'use_seedable_sampler'

```

---

<div class="post-metadata">

**Author:** ![Derek-T](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Derek-T](https://discuss.huggingface.co/u/Derek-T)\
**Post date:** [June 19, 2024, 8:00pm UTC](https://discuss.huggingface.co/t/accelerator-init-got-an-unexpected-keyword-argument-use-seedable-sampler/91679/2 "2024-06-19T20:00:52Z")

</div>

This works for me, it seems to be coming from accelerate:

> <https://github.com/huggingface/transformers/issues/29216>
>
> \### System Info
> 
> \- \`transformers\` version: 4.39.0.dev0
> \- Platform: Linux-3.10….0-1160.108.1.el7.x86\_64-x86\_64-with-glibc2.17
> \- Python version: 3.9.9
> \- Huggingface\_hub version: 0.20.3
> \- Safetensors version: 0.4.2
> \- Accelerate version: 0.25.0.dev0
> \- Accelerate config: not found
> \- PyTorch version (GPU?): 2.0.1+cu118 (False)
> \- Tensorflow version (GPU?): 2.14.0 (False)
> \- Flax version (CPU?/GPU?/TPU?): not installed (NA)
> \- Jax version: not installed
> \- JaxLib version: not installed
> \- Using GPU in script?: Yes
> 
> \### Who can help?
> 
> \_No response\_
> 
> \### Information
> 
> \- \[\] The official example scripts
> \- \[X\] My own modified scripts
> 
> \### Tasks
> 
> \- \[\] An officially supported task in the \`examples\` folder (such as GLUE/SQuAD, ...)
> \- \[X\] My own task or dataset (give details below)
> 
> \### Reproduction
> 
> Just instantiate the RewardTrainer object - 
> \`\`\`
> trainer = RewardTrainer(
> model = model,
> args = training\_args,
> tokenizer= tokenizer,
> train\_dataset= train\_data,
> eval\_dataset= val\_data,
> peft\_config= peft\_config
> )
> \`\`\`
> And I get the error -
> \`\`\`
> /python3.9/site-packages/trl/trainer/reward\_trainer.py:189: UserWarning: When using RewardDataCollatorWithPadding, you should set \`remove\_unused\_columns=False\` in your RewardConfig we have set it for you, but you should do it yourself in the future.
> warnings.warn(
> Traceback (most recent call last):
> File "/cluster/TRAINREWARDMODEL.py", line 189, in \<module\>
> trainer = RewardTrainer(
> File "/python3.9/site-packages/trl/trainer/reward\_trainer.py", line 198, in \_\_init\_\_
> super().\_\_init\_\_(
> File "/python3.9/site-packages/transformers/trainer.py", line 367, in \_\_init\_\_
> self.create\_accelerator\_and\_postprocess()
> File "/python3.9/site-packages/transformers/trainer.py", line 4127, in create\_accelerator\_and\_postprocess
> self.accelerator = Accelerator(
> TypeError: \_\_init\_\_() got an unexpected keyword argument 'use\_seedable\_sampler'
> \`\`\`
> Unfortunately I opened this issue in trl but its not a issue from there and I cannot close it https://github.com/huggingface/trl/issues/1354 it is clearly an issue in the transformers library.
> 
> \*\*Note\*\*: my code was working just fine until I updated the libraries. I am NOT using Accelerate...not even importing it.
> 
> \### Expected behavior
> 
> The \`RewardTrainer\` should initialize and just work.

---

<div class="post-metadata">

**Author:** ![Sany1997](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sany1997/32/28121_2.png) [@Sany1997](https://discuss.huggingface.co/u/Sany1997)\
**Post date:** [June 26, 2024, 5:07pm UTC](https://discuss.huggingface.co/t/accelerator-init-got-an-unexpected-keyword-argument-use-seedable-sampler/91679/3 "2024-06-26T17:07:25Z")

</div>

I tried with another code. Also faced the almost same issue. Then I downgrade some dependecy and worked well.
