Repository navigation
[rl] generator: receive SGLang scheduler outputs through output_sink - #6018
Draft
acisseJZhong wants to merge 3 commits into
Draft
acisseJZhong wants to merge 3 commits into
acisseJZhong wants to merge 3 commits into
Conversation
Pass the output collector to SGLang's new Scheduler(output_sink=...) instead of replacing the scheduler's private tokenizer/detokenizer senders after construction (sgl-project/sglang#48473).
2 of 4 tasks
No tokenizer or detokenizer process runs (skip_tokenizer_init), and SGLang hands every scheduler output to the sink; the collector keeps only token increments and aborts.
Restore the original docstring and update only the sentence that described the replaced senders.
This branch has not been deployed
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.
Depends on sgl-project/sglang#49667 (draft).
Summary (human-written)
Why
SGLangEngineruns SGLang'sSchedulerin-process, with no tokenizer or detokenizer process. To get the scheduler's results and aborts, it replaces two private attributes after construction (output_streamer.send_to_detokenizerandipc_channels.send_to_tokenizer). This was the TODO for sgl-project/sglang#48473. The patching depends on SGLang's private attribute layout, and it misses any component that captured a sender duringScheduler.__init__.sgl-project/sglang#49667 adds a constructor argument for this case.
Example.
What changed
torchtitan/rl/generator/sglang/engine.py: passesoutput_sink=and drops the patching and its TODO._OutputCollector.send_output(output, recv_obj)becomesreceive(output); its logic is unchanged.scripts/install_rl_env.sh: pins SGLang toe3bd24b53c, which is the currently pinned 851642ade7 plus the sglang#49667 patch, on a fork. This change is temporary: once #49667 lands, it switches to the upstream commit (see the TODO in the script).Numerics
No computation change: the collector receives the same output objects as before.
Testing
Ran
tests/rl/unit_tests/gpu/test_sglang_bitwise_parity.pywith the same per-class launches as theSGLang generator testsCI step, on 8x H100. I ran it both on this branch and onmain(bb34c75), each with the patched SGLang installed. SGLang'soutput_sinkdefaults toNone, somainstill takes the old patching path.mainrecurrent_gdn() ... 'kernel_options')The MLA, KDA, GDN and DistMoE results are failures or skips in my environment, and they reproduce on
main. Two causes:These need the B200 CI run of this PR to confirm.
Environment workarounds, all local only:
SGLANG_ENABLE_JIT_DEEPGEMM=0: there is no NVCC 12.9 on the host.LD_PRELOADoflibcublas.so.13: the vLLM wheel fails to import otherwise, also onmain.Known issues / follow-ups