Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions slime/rollout/sglang_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ async def generate(args: Namespace, sample: Sample, sampling_params: dict[str, A
), f"Sample status is {sample.status}"

prompt_ids = _prepare_prompt_ids(sample, state.tokenizer, state.processor)
# partial-rollout reuses the sample; subtract prior progress so total <= rollout_max_response_len
if args.partial_rollout and sample.response_length > 0:
sampling_params["max_new_tokens"] = max(0, args.rollout_max_response_len - sample.response_length)

assert (
sampling_params["max_new_tokens"] >= 0
Expand Down
3 changes: 3 additions & 0 deletions slime/rollout/sglang_streaming_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ async def generate_streaming(args: Namespace, sample: Sample, sampling_params: d
), f"Sample status is {sample.status}"

prompt_ids = _prepare_prompt_ids(sample, state.tokenizer, state.processor)
# partial-rollout reuses the sample; subtract prior progress so total <= rollout_max_response_len
if args.partial_rollout and sample.response_length > 0:
sampling_params["max_new_tokens"] = max(0, args.rollout_max_response_len - sample.response_length)

assert (
sampling_params["max_new_tokens"] >= 0
Expand Down
Loading