Compare commits

...
Author SHA1 Message Date
f725629e47 fix: mito rl training (#2100)
Release / Push CUDA image to Docker (push) Canceled after 0s
`get_sampling_args` was gating `return_token_ids=True` on `use_token_client`,
which meant the non-TITO client path never received token IDs from vLLM.
The verifiers `parse_tokens()` then crashed with `len(None)` because the
response attributes existed but were None.

Replace the `use_token_client` flag with `is_vllm` (derived from
`config.teacher_rollout_model is None`) so vLLM-specific extra_body
params (`return_token_ids`, `top_k`, `min_p`) are always sent when
hitting a vLLM server, and skipped only for SFT distillation against
external non-vLLM APIs.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 10:51:39 -07:00
3 changed files with 9 additions and 13 deletions
+2 -3
View File
@@ -490,9 +490,8 @@ async def orchestrate(config: OrchestratorConfig):
# Schedule generating the training batch
temperature = compute_temperature(progress.step, config.sampling, config.max_steps)
sampling_args = get_sampling_args(
config.sampling, temperature=temperature, use_token_client=config.use_token_client
)
is_vllm = config.teacher_rollout_model is None
sampling_args = get_sampling_args(config.sampling, temperature=temperature, is_vllm=is_vllm)
scheduler.set_sampling_args(sampling_args)
train_task = asyncio.create_task(scheduler.generate_batch(step=progress.step))
+2 -3
View File
@@ -88,9 +88,8 @@ class Scheduler:
self.enable_policy_updates = enable_policy_updates
self.lora_name = lora_name
initial_temp = compute_temperature(step=0, sampling_config=config.sampling, max_steps=config.max_steps)
self.sampling_args = get_sampling_args(
config.sampling, temperature=initial_temp, use_token_client=config.use_token_client
)
is_vllm = config.teacher_rollout_model is None
self.sampling_args = get_sampling_args(config.sampling, temperature=initial_temp, is_vllm=is_vllm)
self.model_name = self.config.model.name
self.json_logging = config.log.json_logging
+5 -7
View File
@@ -36,13 +36,14 @@ async def get_semaphore() -> AsyncContextManager:
return SEMAPHORE
def get_sampling_args(sampling_config: SamplingConfig, temperature: float, use_token_client: bool = True) -> dict:
def get_sampling_args(sampling_config: SamplingConfig, temperature: float, is_vllm: bool = True) -> dict:
# Convert SamplingConfig to vLLM OAI sampling args
# https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html#extra-parameters_2
sampling_args = dict(sampling_config)
sampling_args.pop("temp_scheduler", None)
sampling_args["temperature"] = temperature
sampling_args["top_p"] = 1.0
sampling_args["logprobs"] = True
extra_body = dict(sampling_config.extra_body)
min_tokens = sampling_args.pop("min_tokens")
@@ -53,12 +54,9 @@ def get_sampling_args(sampling_config: SamplingConfig, temperature: float, use_t
if repetition_penalty != 1.0:
extra_body["repetition_penalty"] = repetition_penalty
extra_body["top_k"] = -1
extra_body["min_p"] = 0.0
sampling_args["logprobs"] = True
if use_token_client:
if is_vllm:
extra_body["top_k"] = -1
extra_body["min_p"] = 0.0
extra_body["return_token_ids"] = True
if extra_body: