IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

validate_draft_state_dict

validate_draft_state_dict()​

max.pipelines.speculative.validate_draft_state_dict(expected, provided, aliases=DraftAliases(always=(), when_absent=()))

source

Checks a draft checkpoint covers every weight the draft module needs.

Parameters:

  • expected (Iterable[str]) – Weight names the draft module declares, typically draft.raw_state_dict().keys().
  • provided (Collection[str]) – Weight names the draft checkpoint supplies.
  • aliases (DraftAliases) – Modules the draft inherits from the target, which the checkpoint is therefore not expected to supply.

Returns:

The prefixes resolved for this checkpoint, for the caller to reuse when prefixing the draft’s weights with draft..

Raises:

ValueError – If the draft expects a weight that is neither aliased from the target nor present in the checkpoint.

Return type:

tuple[str, …]