maxent_grpo.training.generation.vllm_requests¶
Request/retry helpers separated from vLLM weight sync and scatter logic.
Functions
|
|
|
|
|
Return a stable identifier for the pending prompt batch. |
|
|
|
Return a normalized vLLM /generate endpoint URL or raise on invalid input. |
|
|
|
Return a stable client tag for this trainer rank if available. |
|
Return the dataset label stored on the context or stats. |
|
Return the current default prompt token cap from the environment. |
|
Best-effort resolution of the external model identifier. |
Classes
Mix-in that isolates request building, retries, and aggregation. |
- class maxent_grpo.training.generation.vllm_requests.VLLMRequestMixin[source]¶
Bases:
objectMix-in that isolates request building, retries, and aggregation.
- set_safe_generate(safe_fn)[source]¶
Allow callers to override the vLLM
safe_generatehook.- Parameters:
safe_fn (Callable[..., Any]) – Callable matching the
safe_generatesignature.- Return type:
None
- set_time_provider(time_mod)[source]¶
Allow callers to override the time module for sleep/now calls.
- Parameters:
time_mod (Any) – Replacement module or object exposing
sleepandtimeas needed.- Return type:
None
- set_fallback_generate(fallback_fn)[source]¶
Allow callers to override the local fallback generation hook.
- Parameters:
fallback_fn (Callable[..., Any]) – Callable invoked when vLLM cannot provide outputs.
- Return type:
None
- run_vllm_rounds(state)[source]¶
Public entry point for executing vLLM retry rounds.
- Parameters:
state (_VLLMGenerationState) – Mutable vLLM generation state tracked across retries.
- Return type:
None
- static expand_dedup_results(grouped, meta, mapping)[source]¶
Public wrapper for expanding de-duplicated results.
- prepare_vllm_targets(prompts, num_samples, per_prompt_counts)[source]¶
Public wrapper for resolving vLLM targets/dedup mapping.
- Parameters:
- Returns:
Tuple of deduplicated prompts, target counts, and mapping back to the original order when deduplication occurs.
- Return type:
- merge_vllm_results(state, grouped, grouped_meta, pending_indices)[source]¶
Public wrapper for merging generated outputs.
- Parameters:
state (_VLLMGenerationState) – Generation state to update.
grouped (list[list[str]]) – Generated completions aligned to
pending_indices.grouped_meta (list[list[VLLMLogprobResult | None]] | None) – Optional metadata aligned to
pending_indices.pending_indices (list[int]) – Prompt indices associated with the provided completions.
- Return type:
None
- static coalesce_grouped_outputs(groups, prompt_count, requested_n, meta=None)[source]¶
Public wrapper for regrouping vLLM outputs.