-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix Configuration for Micro Batch Size in Megatron's Ref Policy #1700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Configuration for Micro Batch Size in Megatron's Ref Policy #1700
Conversation
verl/workers/megatron_workers.py
Outdated
else: | ||
if self.config.ref.get("log_prob_micro_batch_size_per_gpu", None): | ||
self.config.ref.ppo_micro_batch_size_per_gpu = self.config.ref.log_prob_micro_batch_size_per_gpu | ||
elif self.config.ref.get("ppo_micro_batch_size_per_gpu", None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution!
I think that here is a typo, so we may not need to consider ppo_micro_batch_size_per_gpu
, you can simply judge the key above~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix, del the ppo_micro_batch_size_per_gpu
…cengine#1700) ### What does this PR do? Fix Configuration for Micro Batch Size in Megatron's Ref Policy ### High-Level Design This pull request addresses an issue with the micro batch size configuration in the ref policy of Megatron. The default ppo_megatron_trainer.yaml only includes two configurations: log_prob_micro_batch_size and log_prob_micro_batch_size_per_gpu. https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/trainer/config/ppo_megatron_trainer.yaml#L119-L120 However, in `megatron_workers.py`, the required configuration is ref.log_prob_micro_batch_size_per_gpu https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/workers/megatron_workers.py#L517-L518 or in `megatron_actor.py ` the required configuration is ref.ppo_micro_batch_size_per_gpu, https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/workers/actor/megatron_actor.py#L271-L274 which are not directly related to ppo_micro_batch_size. To resolve this, I have made modifications to the configuration calculations and added raise ValueError statements to ensure that the necessary parameters are correctly defined. This update ensures that the required parameters are properly handled, preventing runtime errors and improving the overall robustness of the training process. ### Changes Made: - Modified the configuration calculations in megatron_workers.py. - Added raise ValueError statements to check for the presence of log_prob_micro_batch_size_per_gpu and ppo_micro_batch_size_per_gpu.
…cengine#1700) ### What does this PR do? Fix Configuration for Micro Batch Size in Megatron's Ref Policy ### High-Level Design This pull request addresses an issue with the micro batch size configuration in the ref policy of Megatron. The default ppo_megatron_trainer.yaml only includes two configurations: log_prob_micro_batch_size and log_prob_micro_batch_size_per_gpu. https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/trainer/config/ppo_megatron_trainer.yaml#L119-L120 However, in `megatron_workers.py`, the required configuration is ref.log_prob_micro_batch_size_per_gpu https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/workers/megatron_workers.py#L517-L518 or in `megatron_actor.py ` the required configuration is ref.ppo_micro_batch_size_per_gpu, https://github.com/volcengine/verl/blob/54c9b7364c2d188b2ba4107404cfa3c2b446df19/verl/workers/actor/megatron_actor.py#L271-L274 which are not directly related to ppo_micro_batch_size. To resolve this, I have made modifications to the configuration calculations and added raise ValueError statements to ensure that the necessary parameters are correctly defined. This update ensures that the required parameters are properly handled, preventing runtime errors and improving the overall robustness of the training process. ### Changes Made: - Modified the configuration calculations in megatron_workers.py. - Added raise ValueError statements to check for the presence of log_prob_micro_batch_size_per_gpu and ppo_micro_batch_size_per_gpu.
What does this PR do?
Fix Configuration for Micro Batch Size in Megatron's Ref Policy
High-Level Design
This pull request addresses an issue with the micro batch size configuration in the ref policy of Megatron. The default ppo_megatron_trainer.yaml only includes two configurations: log_prob_micro_batch_size and log_prob_micro_batch_size_per_gpu.
verl/verl/trainer/config/ppo_megatron_trainer.yaml
Lines 119 to 120 in 54c9b73
However, in
megatron_workers.py
, the required configuration is ref.log_prob_micro_batch_size_per_gpuverl/verl/workers/megatron_workers.py
Lines 517 to 518 in 54c9b73
or in
megatron_actor.py
the required configuration is ref.ppo_micro_batch_size_per_gpu,verl/verl/workers/actor/megatron_actor.py
Lines 271 to 274 in 54c9b73
which are not directly related to ppo_micro_batch_size.
To resolve this, I have made modifications to the configuration calculations and added raise ValueError statements to ensure that the necessary parameters are correctly defined.
This update ensures that the required parameters are properly handled, preventing runtime errors and improving the overall robustness of the training process.
Changes Made:
Modified the configuration calculations in megatron_workers.py.
Added raise ValueError statements to check for the presence of log_prob_micro_batch_size_per_gpu and ppo_micro_batch_size_per_gpu.