Closed coder109 closed 3 days ago
It is OK if you parse the parameters after loading DDPOTrainer(). But I'd like to know what causes these two unrelated functions to affect each other.
I PROBABLY know the cause. If you have encountered with the same problem, please modify the source code of DDPOTrainer()
like this:
self.accelerator = Accelerator(
log_with=self.config.log_with,
mixed_precision=self.config.mixed_precision,
project_config=accelerator_project_config,
# we always accumulate gradients across timesteps; we want config.train.gradient_accumulation_steps to be the
# number of *samples* we accumulate across, so we need to multiply by the number of training timesteps to get
# the total number of optimizer steps to accumulate across.
gradient_accumulation_steps=self.config.train_gradient_accumulation_steps * self.num_train_timesteps,
**self.config.accelerator_kwargs,
)
# Accelerate MOD BEGIN
self.accelerator.state.deepspeed_plugin.deepspeed_config['train_micro_batch_size_per_gpu'] = 4
# Accelerate MOD END
It seems that DDPOTrainer()
cannot properly load DeepSpeed config from external json files.
System Info
Information
Tasks
examples
folderReproduction
How to reproduce?
A short code snippet:
This python file can be run using this script under Linux:
outputs:
Other Information
I have tried comment the line
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
and no errors occurs.In the DeepSpeed config file, I have set :
I think there might be some parameters that conflict with each other, which leads to the problem.
Actually, I don't know whether or not this is a trl-related problem.
Hope someone can help me.
Expected behavior
No error occurs and everything works fine.
Checklist