mstar.engine.resources.spec#
Resource declarations models hand to the engine.
The engine builds each node’s resources once, at load time, from these specs. A spec names what to build and its parameters; the model declares, the engine constructs. The default declaration wraps a model’s KV cache configs unchanged, so a model only overrides it to add resources beyond what those configs already describe.
Functions
|
Apply a deployment's |
|
Index specs by resource key, checking uniqueness and |
Classes
|
|
Per-request parameters for one resource, carried on the request and handed to that resource at ingest. |
- class mstar.engine.resources.spec.NodeResourceSpec(resource_key: str, nodes: set[str])[source]#
Bases:
ABC- apply_yaml_overrides(**kwargs)[source]#
Patch declared parameters from this resource’s YAML block.
The model declares shapes that suit the model; a deployment tunes what suits the box it runs on. The block is scoped to this spec’s
resource_key(seeapply_yaml_overridesbelow), so an unrecognized key here is a typo, not another resource’s setting — subclasses name exactly what they accept and let the rest raise.TODO: generalize. Matching YAML keys against the spec’s (and its config’s) dataclass fields would remove these per-resource implementations, at the cost of silently accepting anything named alike.
- depends_on()[source]#
Keys whose specs this one builds against; the engine resolves them into
EngineResourceInfo.dependencies.
- class mstar.engine.resources.spec.ResourceReqConfig[source]#
Bases:
objectPer-request parameters for one resource, carried on the request and handed to that resource at ingest. Keyed by resource key, so it needs no tag of its own — a marker base, with no contract beyond the hook below.
- mstar.engine.resources.spec.apply_yaml_overrides(specs, model_config)[source]#
Apply a deployment’s
resources:block to the specs it names.resources: {<resource_key>: {...}}, one block per resource, so a model with two pools of the same kind (whisper’s decoder cache and its encoder context) can have each tuned on its own. An unknown key is an error: it would otherwise be a silently ineffective setting.- Parameters:
specs (Sequence[NodeResourceSpec])
- Return type:
None
- mstar.engine.resources.spec.resolve_spec_dependencies(specs)[source]#
Index specs by resource key, checking uniqueness and
depends_on.- Parameters:
specs (Sequence[NodeResourceSpec])
- Return type: