mstar.model.glm52.config#
GLM-5.2 architecture + generation config.
Classes
|
- class mstar.model.glm52.config.Glm52ModelConfig(vocab_size: int = 154880, hidden_size: int = 6144, num_hidden_layers: int = 78, num_attention_heads: int = 64, rms_norm_eps: float = 1e-05, hidden_act: str = 'silu', tie_word_embeddings: bool = False, q_lora_rank: int = 2048, kv_lora_rank: int = 512, qk_nope_head_dim: int = 192, qk_rope_head_dim: int = 64, v_head_dim: int = 256, mla_absorb: bool = True, index_n_heads: int = 32, index_head_dim: int = 128, index_topk: int = 2048, index_topk_freq: int = 4, index_skip_topk_offset: int = 3, index_share_for_mtp_iteration: bool = True, indexer_rope_interleave: bool = True, mtp_num_draft_tokens: int = 0, dsa_long_context: bool = False, first_k_dense_replace: int = 3, intermediate_size: int = 12288, moe_intermediate_size: int = 2048, n_routed_experts: int = 256, n_shared_experts: int = 1, num_experts_per_tok: int = 8, routed_scaling_factor: float = 2.5, scoring_func: str = 'sigmoid', topk_method: str = 'noaux_tc', norm_topk_prob: bool = True, moe_router_dtype: str = 'float32', rope_theta: float = 8000000.0, rope_interleave: bool = True, max_position_embeddings: int = 1048576, max_seq_len: int = 2048, num_nextn_predict_layers: int = 1, eos_token_ids: tuple[int, ...] = (154820, 154827, 154829), pad_token_id: int = 154820, max_output_tokens: int | None = None, quantization_config: mstar.utils.fp8_block.Fp8BlockQuantConfig | None = None, moe_fp8_resident: bool = True, kernels: str = 'auto', graph_compile: bool = True, prefill_capture_batch_sizes: list[int] | None = None)[source]#
Bases:
object- Parameters:
vocab_size (int)
hidden_size (int)
num_hidden_layers (int)
num_attention_heads (int)
rms_norm_eps (float)
hidden_act (str)
tie_word_embeddings (bool)
q_lora_rank (int)
kv_lora_rank (int)
qk_nope_head_dim (int)
qk_rope_head_dim (int)
v_head_dim (int)
mla_absorb (bool)
index_n_heads (int)
index_head_dim (int)
index_topk (int)
index_topk_freq (int)
index_skip_topk_offset (int)
index_share_for_mtp_iteration (bool)
indexer_rope_interleave (bool)
mtp_num_draft_tokens (int)
dsa_long_context (bool)
first_k_dense_replace (int)
intermediate_size (int)
moe_intermediate_size (int)
n_routed_experts (int)
n_shared_experts (int)
num_experts_per_tok (int)
routed_scaling_factor (float)
scoring_func (str)
topk_method (str)
norm_topk_prob (bool)
moe_router_dtype (str)
rope_theta (float)
rope_interleave (bool)
max_position_embeddings (int)
max_seq_len (int)
num_nextn_predict_layers (int)
pad_token_id (int)
max_output_tokens (int | None)
quantization_config (Fp8BlockQuantConfig | None)
moe_fp8_resident (bool)
kernels (str)
graph_compile (bool)
- property dense_fp8: bool#
Whether the non-expert linears the checkpoint stores in fp8 stay fp8 with their block scales: exactly when it is block fp8. kv_b_proj still dequantizes, since the absorbed MLA folds it into w_kc / w_vc.
- classmethod from_hf_config(hf_config)[source]#
Geometry from the checkpoint’s config.json; serving knobs keep their defaults.
- Parameters:
hf_config (dict)
- Return type:
- property max_prompt_tokens: int#
The longest prompt served. Decode runs at least one step after the prefill and the next may already be scheduled when it stops, so the prompt leaves two steps’ rows under the context limit (an MTP step writes k + 1); a DSA prefill attends densely, within index_topk.
- property padded_head_dim: int#
Naive-MLA q/k/v pad target; FlashInfer paged kernels require 64/128/256.
- position_config()[source]#
The positions over the KV cache and the RoPE the layers rotate with: interleaved over
qk_rope_head_dim, from an fp32 cos/sin table built once (the angles as the reference computes them, for every position up tomax_seq_len).- Return type:
- quantization_config: Fp8BlockQuantConfig | None = None#
- classmethod reduced()[source]#
Tiny-dim variant for CPU tests: same shapes family, random weights.
- Return type: