You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rank1]: Traceback (most recent call last):
[rank1]: File "/home/path_to_script/ppo_trainer_script.py", line 223, in <module>
[rank1]: main()
[rank1]: File "/home/path_to_script/ppo_trainer_script.py", line 207, in main
[rank1]: trainer = PPOTrainer(
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/transformers/utils/deprecation.py", line 165, in wrapped_func
[rank1]: return func(*args, **kwargs)
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/transformers/utils/deprecation.py", line 165, in wrapped_func
[rank1]: return func(*args, **kwargs)
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/transformers/utils/deprecation.py", line 165, in wrapped_func
[rank1]: return func(*args, **kwargs)
[rank1]: [Previous line repeated 1 more time]
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/trl/trainer/ppo_trainer.py", line 187, in __init__
[rank1]: accelerator = Accelerator(gradient_accumulation_steps=args.gradient_accumulation_steps)
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/accelerate/accelerator.py", line 292, in __init__
[rank1]: deepspeed_plugins = AcceleratorState().deepspeed_plugins
[rank1]: File "/home/username/.conda/envs/env_name/lib/python3.9/site-packages/accelerate/state.py", line 887, in __init__
[rank1]: raise ValueError(
[rank1]: ValueError: Please make sure to properly initialize your accelerator via accelerator = Accelerator() before using any functionality from the accelerate library.
I’m encountering a persistent error whenever I try to use trl’s PPOTrainer with accelerate launch --config_file deepspeed_zero3.yaml. Regardless of whether I explicitly call accelerate = Accelerator() in my main() function (or remove that line entirely), I keep getting the following error:
ValueError: Please make sure to properly initialize your accelerator via `accelerator = Accelerator()` before using any functionality from the `accelerate` library.
It seems that PPOTrainer internally creates its own Accelerator object, which conflicts with accelerate launch. When I run the script without using accelerate launch, it works as intended because PPOTrainer is the only code path that initializes Accelerator. However, as soon as I include accelerate launch --config_file=..., the error occurs again.
Is there a recommended pattern for using PPOTrainer in combination with accelerate launch --config_file ?
PPOTrainer and RLOOTrainer initiate 'accelerator=Accelerator' in their __init__ method.
(These implementations differ from other trainer class in this lib)
I found pip install accelerate==0.34.2 works for these two trainer classes. :)
PPOTrainer and RLOOTrainer initiate 'accelerator=Accelerator' in their __init__ method.
(These implementations differ from other trainer class in this lib)
I found pip install accelerate==0.34.2 works for these two trainer classes. :)
Right. It may need a fix up. But in general the hype has really shifted to GRPO recently so you can try GRPO too. That one is much cleaner in implementation and works with HF trainer much easier. Note is resuming from checkpoint also doesn't work for RLOO and PPO since they overrode the training loop.
Reproduction
outputs:
running script
System Info
I’m encountering a persistent error whenever I try to use trl’s PPOTrainer with accelerate launch --config_file deepspeed_zero3.yaml. Regardless of whether I explicitly call accelerate = Accelerator() in my main() function (or remove that line entirely), I keep getting the following error:
It seems that PPOTrainer internally creates its own Accelerator object, which conflicts with accelerate launch. When I run the script without using accelerate launch, it works as intended because PPOTrainer is the only code path that initializes Accelerator. However, as soon as I include accelerate launch --config_file=..., the error occurs again.
Is there a recommended pattern for using PPOTrainer in combination with accelerate launch --config_file ?
env
Checklist
The text was updated successfully, but these errors were encountered: