mstar.engine.resources.lora.identity

mstar.engine.resources.lora.identity#

Which weights an adapter name stands for, as the prefix cache keys them.

A request on an adapter fills KV pages that differ from the base model’s for the same tokens, so its prompt’s key chain hangs from a root that names the adapter’s weights (adapter_prefix_root). The API server takes it from the adapter’s digest when it selects the adapter for a request (ServedModels); nothing about an adapter travels per step.

Functions

adapter_digest(adapter)

SHA-256 over everything an adapter's delta depends on, rank-independent.

adapter_prefix_root(digest)

The root an adapter's key chains hang from.

mstar.engine.resources.lora.identity.adapter_digest(adapter)[source]#

SHA-256 over everything an adapter’s delta depends on, rank-independent.

adapter is a LoraAdapter as read_lora_file returns it: every module’s name, alpha (the sidecar’s included), and A and B with their dtype and shape, so that equal bytes of a different shape or dtype digest apart.

Return type:

bytes

mstar.engine.resources.lora.identity.adapter_prefix_root(digest)[source]#

The root an adapter’s key chains hang from.

The digest alone, not the name: KV depends on the weights, so two names for the same weights share pages, and one name reloaded with other weights does not.

Parameters:

digest (bytes)

Return type:

bytes