Problem
scripts/data/launch_sglang_server.sh currently hardcodes num_workers=8 and then launches workers by setting CUDA_VISIBLE_DEVICES=${gpu_id} for gpu_id=0..7.
This conflicts with the README guidance that users can reduce CUDA_VISIBLE_DEVICES for fewer GPUs. If a user only wants to run the data-generation servers on a subset such as GPUs 2,3, the launcher still starts eight workers and overrides each child process to use GPUs 0 through 7.
Reproduction
I reproduced this by running the launcher with a stub sglang command that records the environment passed to each worker:
CUDA_VISIBLE_DEVICES=2,3 bash scripts/data/launch_sglang_server.sh
Observed worker launches:
CUDA_VISIBLE_DEVICES=0 ... --port 30000
CUDA_VISIBLE_DEVICES=1 ... --port 30001
CUDA_VISIBLE_DEVICES=2 ... --port 30002
CUDA_VISIBLE_DEVICES=3 ... --port 30003
CUDA_VISIBLE_DEVICES=4 ... --port 30004
CUDA_VISIBLE_DEVICES=5 ... --port 30005
CUDA_VISIBLE_DEVICES=6 ... --port 30006
CUDA_VISIBLE_DEVICES=7 ... --port 30007
Expected behavior
When CUDA_VISIBLE_DEVICES=2,3 is set, the launcher should derive the worker GPU list from that value and start two workers, for example on ports 30000 and 30001.
The existing eight-GPU default should remain unchanged when CUDA_VISIBLE_DEVICES is not set.
Suggested fix
Parse CUDA_VISIBLE_DEVICES into a GPU list, derive the default num_workers from that list, keep the current 0,1,2,3,4,5,6,7 default when unset, and update the data-preparation docs so prepare_data.sh connects to the matching server ports.
Problem
scripts/data/launch_sglang_server.shcurrently hardcodesnum_workers=8and then launches workers by settingCUDA_VISIBLE_DEVICES=${gpu_id}forgpu_id=0..7.This conflicts with the README guidance that users can reduce
CUDA_VISIBLE_DEVICESfor fewer GPUs. If a user only wants to run the data-generation servers on a subset such as GPUs2,3, the launcher still starts eight workers and overrides each child process to use GPUs0through7.Reproduction
I reproduced this by running the launcher with a stub
sglangcommand that records the environment passed to each worker:Observed worker launches:
Expected behavior
When
CUDA_VISIBLE_DEVICES=2,3is set, the launcher should derive the worker GPU list from that value and start two workers, for example on ports30000and30001.The existing eight-GPU default should remain unchanged when
CUDA_VISIBLE_DEVICESis not set.Suggested fix
Parse
CUDA_VISIBLE_DEVICESinto a GPU list, derive the defaultnum_workersfrom that list, keep the current0,1,2,3,4,5,6,7default when unset, and update the data-preparation docs soprepare_data.shconnects to the matching server ports.