refactor: mirror slime structure in update_weight + vllm_rollout - #197
Merged
Conversation
…vllm_rollout Align with slime@44d29ee to reduce structural divergence: update_weight_from_distributed.py: - Add update_weight_metrics + pop_metrics() (actor-side metric drain) - Add _on_chunk() hook (no-op base, override point for subclasses) - Restructure _send_weights() to call _on_chunk before each broadcast - Remove _send_hf_chunk / _update_weights_vllm_packed wrappers - Align _iter_non_expert_chunks buffer accounting to convert-first-then-measure - Remove early-exit guard in _ep_gather_and_convert - Update class docstring to document subclass extension points vllm_rollout.py: - Add docstrings matching slime (generate_rollout, generate_rollout_async, eval_rollout_single_dataset, generate_and_rm_group) - Add inline comments matching slime (generate_and_rm, generate_rollout_async) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the weight update and rollout generation logic, introducing subclass hooks, weight update metrics, and improved documentation/comments across the codebase. A critical issue was identified in update_weight_from_distributed.py where removing the safety check on pbar before calling pbar.update(1) can lead to an AttributeError when pbar is None.
| ray.get(self.rollout_engine_lock.release.remote()) | ||
| if pbar is not None: | ||
| pbar.update(1) | ||
| pbar.update(1) |
Contributor
There was a problem hiding this comment.
Unconditionally calling pbar.update(1) will raise an AttributeError if pbar is None. Since pbar is typed as tqdm | None = None and can be None (for example, on non-PP-source ranks or when not provided), we should restore the if pbar is not None: guard.
Suggested change
| pbar.update(1) | |
| if pbar is not None: | |
| pbar.update(1) |
…_metrics) These were introduced by slime PR #1806 (delta weight sync) which maps to vime #150 — not planned for inclusion yet. Revert to pre-#1806 base class interface while keeping the other structural alignments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ocstring additions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
princepride
approved these changes
Jun 9, 2026
momo609
pushed a commit
that referenced
this pull request
Jun 10, 2026
* refactor: mirror slime structure in update_weight_from_distributed + vllm_rollout Align with slime@44d29ee to reduce structural divergence: update_weight_from_distributed.py: - Add update_weight_metrics + pop_metrics() (actor-side metric drain) - Add _on_chunk() hook (no-op base, override point for subclasses) - Restructure _send_weights() to call _on_chunk before each broadcast - Remove _send_hf_chunk / _update_weights_vllm_packed wrappers - Align _iter_non_expert_chunks buffer accounting to convert-first-then-measure - Remove early-exit guard in _ep_gather_and_convert - Update class docstring to document subclass extension points vllm_rollout.py: - Add docstrings matching slime (generate_rollout, generate_rollout_async, eval_rollout_single_dataset, generate_and_rm_group) - Add inline comments matching slime (generate_and_rm, generate_rollout_async) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: drop delta-sync additions (pop_metrics, _on_chunk, update_weight_metrics) These were introduced by slime PR #1806 (delta weight sync) which maps to vime #150 — not planned for inclusion yet. Revert to pre-#1806 base class interface while keeping the other structural alignments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style: restore slime multi-line formatting (revert ruff line-collapse) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style: revert ruff line-collapse in vllm_rollout, keep only comment/docstring additions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
update_weight_metrics+pop_metrics(),_on_chunk()hook, restructure_send_weights()dual-pass to call_on_chunkbefore each broadcast, align_iter_non_expert_chunksbuffer accounting to convert-first-then-measure (matches slime), remove_send_hf_chunk/_update_weights_vllm_packedwrappers, remove early-exit guard in_ep_gather_and_convertgenerate_rollout,generate_rollout_async,eval_rollout_single_dataset,generate_and_rm_group,generate_and_rm)vllm_config.pyalready identical,arguments.pyandvllm_engine.pyare genuine sglang→vLLM divergencesReference: slime commit 44d29ee59dfa1489c369937779cbbdb1798ce701
Test plan
ruff check+ruff formatpasstests/unit/backends/megatron_utils/update_weight/test_update_weight_from_distributed.py— 22/22 passtests/unit/rollout/test_vllm_rollout.py— 26/26 pass🤖 Generated with Claude Code