[Fix] ppo rollout engins for distribute - #394
Merged
Merged
Conversation
zhuzilin
reviewed
Sep 28, 2025
| args, | ||
| values: Optional[list[torch.Tensor]] = None, | ||
| log_probs: Optional[list[torch.Tensor]] = None, | ||
| ref_log_probs: Optional[list[torch.Tensor]] = None, |
Contributor
There was a problem hiding this comment.
we can pass only one argument and use for example if "values" in rollout_data to check whether this is critic or actor
| k *= -args.kl_coef | ||
| k[-1] += reward | ||
| if k.numel() > 0: | ||
| k[-1] += reward |
Contributor
There was a problem hiding this comment.
when enabling cp, we need to add the reward only to the last position
|
|
||
| if args.use_wandb: | ||
| log_dict["train/step"] = accumulated_step_id | ||
| log_dict[f"train/{role_tag}step"] = accumulated_step_id |
Contributor
There was a problem hiding this comment.
hmm.. not sure why we need to change this?
| self.quantization_config = quantization_config | ||
| self.param_info_buckets = get_param_info_buckets(self.args, self.model) | ||
| self.weight_version = 0 | ||
| self.use_distribute = self.args.use_critic |
Contributor
There was a problem hiding this comment.
we can use the number of rollout engines to judge whether we need to use distributed.
| rank=0, | ||
| group_name=self._group_name, | ||
| ) | ||
| ray.get(refs) |
Contributor
There was a problem hiding this comment.
please try to reuse the code from class UpdateFromDistributed
| if dist.get_rank() == self._ipc_gather_src: | ||
| refs.extend(self._update_converted_params_from_tensor(converted_named_tensors)) | ||
| else: | ||
| self._update_converted_params_from_tensor(converted_named_tensors) |
Contributor
There was a problem hiding this comment.
you also need to syn the refs for the non ipc_src ranks.
| ) | ||
| args.rollout_num_gpus = args.actor_num_gpus_per_node * args.actor_num_nodes | ||
| if not args.use_critic: | ||
| args.rollout_num_gpus = args.actor_num_gpus_per_node * args.actor_num_nodes |
Contributor
There was a problem hiding this comment.
why do we need to change this line?
zhuzilin
reviewed
Sep 28, 2025
| from megatron.core import mpu | ||
|
|
||
| cp_size = mpu.get_context_parallel_world_size() | ||
| if cp_size > 0: |
llltttwww
pushed a commit
to llltttwww/slime
that referenced
this pull request
Nov 30, 2025
* [fix] fix ppo value_loss problem and add kl_coef to reward * [fix] ppo update_weights form distribute * [fix] ppo cp bugs * [Fix] ppo update_from_distribute
Yangruipis
pushed a commit
to redai-studio/slime
that referenced
this pull request
Feb 28, 2026
* [fix] fix ppo value_loss problem and add kl_coef to reward * [fix] ppo update_weights form distribute * [fix] ppo cp bugs * [Fix] ppo update_from_distribute
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.