-
Notifications
You must be signed in to change notification settings - Fork 212
feat: Add SGLang rollout backend and tests #1674
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
Open
RolaoDenthu
wants to merge
57
commits into
NVIDIA-NeMo:main
Choose a base branch
from
RolaoDenthu:add-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
d9cf489
sglang support:initial commit
PrinsYin 3eace5f
sglang:manually set cuda visible to let localran=0 to manage gpus of …
PrinsYin 6fbbbb7
sglang: add sglang setup in grpo.py, add find available port to set u…
PrinsYin 242612c
sglang: add shutdown
PrinsYin a3d8ad6
sglang server: fix gpu allocation when tp =1
PrinsYin 88971e3
generate only first request
PrinsYin db8b07b
fix : choose the correct gpu using base gpu id
PrinsYin dd0e54f
asyncio to roolout all saples
PrinsYin 21c54e3
fix new event loop for rollout
PrinsYin 5e24fab
added mem_fraction
PrinsYin 50189a9
modified build_sampling_paras and stop token handling
PrinsYin ec35b6b
temp: prevent server overlaod with semaphore
PrinsYin f099caa
sglang: refactor, move async loop position
PrinsYin a03eba8
sglang: fix total length in generate
PrinsYin e08cfd6
sglang: env setup
PrinsYin ccc66f6
from tensor:
PrinsYin 2ce928b
sglang refit: fix sglang import
PrinsYin 4aa1e74
fix: match fsdp ranks correctly with sglang
PrinsYin 9098077
flush cache before update begins
PrinsYin 9900a33
Fix SGLang compatibility: add hasattr checks for vLLM-specific methods
PrinsYin 5cb78e3
sglang: modified config (increase mem_fration, enable wandb)
PrinsYin 03d9d0c
refactor(grpo): extract init logic for generation backends
PrinsYin 7ca9776
refactor SGLangConfig
PrinsYin f1c26dd
refactor: generalize logger metrics for all generation backends
PrinsYin 255dcc6
refactor sglang config loading to make it consistent with other backendw
PrinsYin ee01f91
resolved ai comments
PrinsYin e25e573
changed print to using loging
PrinsYin e93699f
Merge branch 'main' into sglang_server
PrinsYin 85d6a92
Update nemo_rl/models/generation/sglang/sglang_worker.py
PrinsYin be1ae27
Merge branch 'main' into sglang_server
PrinsYin ede624f
fix comments about config defaults
PrinsYin f9dd700
functional test and unit tests added
RolaoDenthu 313eaa7
nightly test added
RolaoDenthu d207bf3
add more unit tests
RolaoDenthu ceb934e
add test script
RolaoDenthu 570584f
fix: correct comment to match gpus_per_server=2
RolaoDenthu 1f34c61
fix: add assertion for SGLang non-colocated mode
RolaoDenthu a9d3d69
fix: minor bug fixes
RolaoDenthu 72946a3
remove run.sh
RolaoDenthu ea2f0ab
add more unit tests
RolaoDenthu 446e87f
add sglang test
RolaoDenthu c58fffb
Merge branch 'main' into add-tests
guyueh1 6882cb7
Merge prfork/add-tests
RolaoDenthu 6f72efe
add test for qwen2.5-math-1.5b for sglang backend
RolaoDenthu 1adc4a1
modify test file name
RolaoDenthu 256c0ee
fix lint
RolaoDenthu c345a15
fix lints
RolaoDenthu 02a7e1f
add sglang init
RolaoDenthu 5ec83e1
update uv.lock
RolaoDenthu 0513cbf
Add sglang/config.py to pyrefly
RolaoDenthu 2338fdd
uv.lock updated
RolaoDenthu b846b36
fix envir
RolaoDenthu 570f996
Merge branch 'main' into add-tests
guyueh1 ae4bc44
add sglang-only marker filtering
RolaoDenthu 8adbbe5
fix sglang import
RolaoDenthu f511940
fix test name
RolaoDenthu df99998
Merge remote-tracking branch 'origin/main' into add-tests
RolaoDenthu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| defaults: grpo_math_1B.yaml | ||
|
|
||
| grpo: | ||
| val_batch_size: 128 | ||
|
|
||
| policy: | ||
| generation: | ||
| backend: "sglang" | ||
| sglang_cfg: | ||
| # SGLang specific configuration | ||
| model_path: ${policy.model_name} | ||
| gpus_per_server: 1 | ||
| dtype: ${policy.precision} | ||
| context_length: 512 # Maximum context length | ||
| allow_auto_truncate: true | ||
| enable_memory_saver: false | ||
| dp_size: 1 | ||
| pp_size: 1 | ||
| ep_size: 1 | ||
| max_running_requests: null | ||
| mem_fraction_static: 0.7 | ||
| skip_server_warmup: true | ||
|
|
||
| logger: | ||
| wandb_enabled: true |
48 changes: 48 additions & 0 deletions
48
examples/configs/recipes/llm/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1-sglang.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| defaults: ../../grpo_math_1B.yaml | ||
|
|
||
| grpo: | ||
| max_num_steps: 450 | ||
|
|
||
| checkpointing: | ||
| checkpoint_dir: results/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1-sglang | ||
|
|
||
| policy: | ||
| model_name: Qwen/Qwen2.5-Math-1.5B-Instruct | ||
| tokenizer: | ||
| name: Qwen/Qwen2.5-Math-1.5B-Instruct | ||
| dynamic_batching: | ||
| enabled: true | ||
| sequence_packing: | ||
| enabled: false | ||
| make_sequence_length_divisible_by: 1 | ||
| generation: | ||
| backend: "sglang" | ||
| max_new_tokens: 512 | ||
| sglang_cfg: | ||
| model_path: ${policy.model_name} | ||
| gpus_per_server: 8 | ||
| dtype: ${policy.precision} | ||
| context_length: 512 | ||
| allow_auto_truncate: true | ||
| enable_memory_saver: false | ||
| dp_size: 1 | ||
| pp_size: 1 | ||
| ep_size: 1 | ||
| max_running_requests: null | ||
| mem_fraction_static: 0.7 | ||
| skip_server_warmup: true | ||
|
|
||
| data: | ||
| max_input_seq_length: 512 | ||
|
|
||
| logger: | ||
| log_dir: logs/grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1-sglang | ||
| wandb_enabled: true | ||
| tensorboard_enabled: true | ||
| wandb: | ||
| project: nemo-rl | ||
| name: grpo-qwen2.5-math-1.5b-instruct-1n8g-fsdp2tp1-sglang | ||
|
|
||
| cluster: | ||
| gpus_per_node: 8 | ||
|
|
||
49 changes: 49 additions & 0 deletions
49
examples/configs/recipes/llm/grpo-qwen3-0.6b-1n8g-sglang.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| defaults: ../../grpo_math_1B.yaml | ||
|
|
||
| grpo: | ||
| max_num_steps: 500 | ||
| val_batch_size: 128 | ||
|
|
||
| checkpointing: | ||
| checkpoint_dir: results/grpo-qwen3-0.6b-1n8g-sglang | ||
|
|
||
| policy: | ||
| model_name: Qwen/Qwen3-0.6B | ||
| tokenizer: | ||
| name: Qwen/Qwen3-0.6B | ||
| dynamic_batching: | ||
| enabled: true | ||
| sequence_packing: | ||
| enabled: false | ||
| make_sequence_length_divisible_by: 1 | ||
| generation: | ||
| backend: "sglang" | ||
| max_new_tokens: 512 | ||
| sglang_cfg: | ||
| model_path: ${policy.model_name} | ||
| gpus_per_server: 8 | ||
| dtype: ${policy.precision} | ||
| context_length: 512 | ||
| allow_auto_truncate: true | ||
| enable_memory_saver: false | ||
| dp_size: 1 | ||
| pp_size: 1 | ||
| ep_size: 1 | ||
| max_running_requests: null | ||
| mem_fraction_static: 0.7 | ||
| skip_server_warmup: true | ||
|
|
||
| data: | ||
| max_input_seq_length: 512 | ||
|
|
||
| logger: | ||
| log_dir: logs/grpo-qwen3-0.6b-1n8g-sglang | ||
| wandb_enabled: true | ||
| tensorboard_enabled: true | ||
| wandb: | ||
| project: nemo-rl | ||
| name: grpo-qwen3-0.6b-1n8g-sglang | ||
|
|
||
| cluster: | ||
| gpus_per_node: 8 | ||
|
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.