huggingface / blog

Public repo for HF blog posts
https://hf.co/blog
2.27k stars 708 forks source link

Decision Transformers: Error in Trainer #1893

Open Sauce16 opened 6 months ago

Sauce16 commented 6 months ago

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'

pcuenca commented 6 months ago

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

blackhalo9 commented 6 months ago

same issue in here.

MichaelrMentele commented 6 months ago

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

MichaelrMentele commented 6 months ago

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

pcuenca commented 6 months ago

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

MichaelrMentele commented 6 months ago

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

simoninithomas commented 6 months ago

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