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 module

max.pipelines.architectures.dspark_deepseekV4

The DSpark stages DeepSeek-V4’s checkpoint ships beside its trunk.

DSparkDeepseekV4DraftArchConfig​

class max.pipelines.architectures.dspark_deepseekV4.DSparkDeepseekV4DraftArchConfig(max_seq_len)

source

Bases: ArchConfigWithBoundedMaxSeqLen

The draft architecture’s config: its sequence bound, and no KV leaf.

The stages’ windows are layers of the trunk’s window leaf, which the trunk’s own KV params already size.

Parameters:

max_seq_len (int)

build_module()​

classmethod build_module(context)

source

Builds the stages from the trunk’s checkpoint, which context names.

The stages read the trunk’s embedding and head, which their caller passes in, so the checkpoint’s mtp.* weights are all they load.

Raises:

ValueError – If the method isn’t dspark.

Parameters:

context (ModelLoadContext)

Return type:

tuple[DeepseekV4DSpark, DSparkDeepseekV4DraftConfig]

construct_kv_params()​

classmethod construct_kv_params(huggingface_config, pipeline_config, devices, kv_cache_config, cache_dtype)

source

Returns None: the stages read and write the trunk’s leaves.

Parameters:

Return type:

None

initialize()​

classmethod initialize(pipeline_config, model_config=None, *, max_seq_len)

source

Records the sequence length the pipeline resolved.

Parameters:

Return type:

DSparkDeepseekV4DraftArchConfig

max_seq_len​

max_seq_len: int

source

DSparkDeepseekV4DraftConfig​

class max.pipelines.architectures.dspark_deepseekV4.DSparkDeepseekV4DraftConfig(module)

source

Bases: object

The stages’ module config, and what the pairing reads beside it.

Parameters:

module (DeepseekV4Config)

block_size​

property block_size: int

source

Returns the tokens a block holds, every one of them drafted.

hidden_size​

property hidden_size: int

source

Returns the trunk’s hidden size, which the stages draft in.

mask_token_id​

property mask_token_id: int

source

Returns the token that fills the block past its anchor.

module​

module: DeepseekV4Config

source

target_layer_ids​

property target_layer_ids: list[int]

source

Returns the trunk layers whose states the stages read.

vocab_size​

property vocab_size: int

source

Returns the trunk’s vocabulary, which the stages score.

dspark_draft_width()​

max.pipelines.architectures.dspark_deepseekV4.dspark_draft_width(speculative, target_huggingface_config, draft_huggingface_config)

source

The DSpark block width: the checkpoint’s dspark_block_size.

Every block position drafts a token, so the width is the block size. The stages unroll the Markov chain over the block, so a different --num-speculative-tokens is rejected rather than silently overridden.

Parameters:

Return type:

int