nemo_rl.models.generation.vllm.speculator_runtime#

Module Contents#

Classes#

RunnerFamily

Capability used to access the live speculative model.

WeightComponentManifest

Ordered transport and loading contract for one model component.

ModelUpdateManifest

Transport-neutral target and optional draft update description.

ModelUpdateCoverage

Validate exact input coverage while allowing explicit non-owner skips.

DraftRuntimeAdapter

Capability-driven access to a live vLLM speculative model.

Functions#

is_speculator_type

find_draft_model

Return the runner family and live draft model, or None if no capability.

Data#

API#

nemo_rl.models.generation.vllm.speculator_runtime.SpeculatorType#

None

nemo_rl.models.generation.vllm.speculator_runtime.SPECULATOR_TYPES: tuple[str, ...]#

‘get_args(…)’

nemo_rl.models.generation.vllm.speculator_runtime.is_speculator_type(
value: object,
) → TypeGuard[nemo_rl.models.generation.vllm.speculator_runtime.SpeculatorType]#
exception nemo_rl.models.generation.vllm.speculator_runtime.SpeculatorRuntimeError#

Bases: RuntimeError

The runtime cannot safely apply a speculative-model refit.

Initialization

Initialize self. See help(type(self)) for accurate signature.

class nemo_rl.models.generation.vllm.speculator_runtime.RunnerFamily#

Bases: str, enum.Enum

Capability used to access the live speculative model.

Initialization

Initialize self. See help(type(self)) for accurate signature.

ACCESSOR#

‘get_draft_model’

DRAFTER#

‘drafter.model’

SPECULATOR#

‘speculator.model’

nemo_rl.models.generation.vllm.speculator_runtime.DRAFTER_OWNER_ATTRS: tuple[tuple[str, nemo_rl.models.generation.vllm.speculator_runtime.RunnerFamily], ...]#

((‘drafter’,), (‘speculator’,))

nemo_rl.models.generation.vllm.speculator_runtime.find_draft_model(
model_runner: Any,
) → tuple[nemo_rl.models.generation.vllm.speculator_runtime.RunnerFamily, Any | None] | None#

Return the runner family and live draft model, or None if no capability.

get_draft_model wins when present. Otherwise the first owner attribute with a non-None .model wins. When an owner attribute exists but every model is None, the first existing family is returned with a None model.

class nemo_rl.models.generation.vllm.speculator_runtime.WeightComponentManifest#

Ordered transport and loading contract for one model component.

ordered_names: tuple[str, ...]#

None

owner_ranks: tuple[int, ...]#

None

class nemo_rl.models.generation.vllm.speculator_runtime.ModelUpdateManifest#

Transport-neutral target and optional draft update description.

target: nemo_rl.models.generation.vllm.speculator_runtime.WeightComponentManifest#

None

draft: nemo_rl.models.generation.vllm.speculator_runtime.WeightComponentManifest | None#

None

classmethod from_state_dict_info(
state_dict_info: Mapping[str, tuple[Sequence[int], torch.dtype]],
*,
target_owner_ranks: tuple[int, ...],
draft_owner_ranks: tuple[int, ...],
) → nemo_rl.models.generation.vllm.speculator_runtime.ModelUpdateManifest#
class nemo_rl.models.generation.vllm.speculator_runtime.ModelUpdateCoverage(
manifest: nemo_rl.models.generation.vllm.speculator_runtime.ModelUpdateManifest,
*,
rank: int,
)#

Validate exact input coverage while allowing explicit non-owner skips.

Initialization

_record(names: Sequence[str]) → None#
record_loaded(names: Sequence[str]) → None#
record_owner_skip(
names: Sequence[str],
*,
component: Literal[target, draft],
) → None#
require_complete() → None#
class nemo_rl.models.generation.vllm.speculator_runtime.DraftRuntimeAdapter#

Capability-driven access to a live vLLM speculative model.

model: Any | None#

None

pp_size: int#

None

is_owner: bool#

None

classmethod resolve(
model_runner: Any,
*,
speculator_type: str,
vllm_version: str,
pp_rank: int,
pp_size: int,
) → nemo_rl.models.generation.vllm.speculator_runtime.DraftRuntimeAdapter#
property owner_ranks: tuple[int, ...]#