blog icon indicating copy to clipboard operation
blog copied to clipboard

Decision Transformers: Error in Trainer

Open Sauce16 opened this issue 11 months ago • 7 comments

Hi, I am facing error while retraining. code from transformers import Trainer, TrainingArguments

training_args = TrainingArguments( output_dir="./roberta-retrained", overwrite_output_dir=True, num_train_epochs=1, per_gpu_train_batch_size=64, save_steps=10_000, save_total_limit=2, prediction_loss_only=True, )

trainer = Trainer( model=model, args=training_args, data_collator=data_collator, train_dataset=dataset, )

error

TypeError Traceback (most recent call last) in <cell line: 13>() 11 ) 12 ---> 13 trainer = Trainer( 14 model=model, 15 args=training_args,

1 frames /usr/local/lib/python3.10/dist-packages/transformers/trainer.py in create_accelerator_and_postprocess(self) 4100 4101 # create accelerator object -> 4102 self.accelerator = Accelerator( 4103 deepspeed_plugin=self.args.deepspeed_plugin, 4104 gradient_accumulation_plugin=gradient_accumulation_plugin,

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

Sauce16 avatar Mar 09 '24 06:03 Sauce16

Hello @Sauce16! Is this about one of the Hugging Face blog posts? Which one?

pcuenca avatar Mar 09 '24 10:03 pcuenca

same issue in here.

blackhalo9 avatar Mar 11 '24 05:03 blackhalo9

It's 101_train-decision-transformers.ipynb -- I had the same error but misreported in #1899

MichaelrMentele avatar Mar 12 '24 22:03 MichaelrMentele

You can fix by adding !pip install accelerate -U to the pip install

MichaelrMentele avatar Mar 12 '24 23:03 MichaelrMentele

cc @simoninithomas in case we need to update the post or the notebooks.

pcuenca avatar Mar 13 '24 11:03 pcuenca

You also need to move the free-mujoco-py install or it fails after the training step importing mujoco -- it works for me to move to the end

!pip install gym==0.21.0
!pip install free-mujoco-py
!pip install transformers
!pip install datasets
!pip install imageio-ffmpeg

!pip install colabgymrender==1.0.2
!pip install xvfbwrapper
!pip install imageio==2.4.1
!pip install imageio-ffmpeg
!pip install huggingface_hub
!pip install accelerate -U
!pip install free-mujoco-py

But then it fails on the visualization step: image

Oh the joys of python package management

MichaelrMentele avatar Mar 13 '24 15:03 MichaelrMentele

Hey there 👋 , I'm quite unfamiliar with Decision Transformers, it's @edbeeching, who worked on the library and tutorial. I let him check 🤗

simoninithomas avatar Mar 15 '24 17:03 simoninithomas