mstar.model.glm5_next.weight_loader#
HF GLM-5.3-Flash checkpoint loading for the glm5_next module tree.
Functions
|
Keys-to-read + per-key slice specs for the TP fast read path. |
|
|
|
Dry-run the load pipeline over the safetensors index and diff it against the expected module tree. |
|
The module tree the schedule implies: parameter path -> the number of checkpoint tensors that must land in it (stacked shards count each; dequant-absorbed scale siblings do not). |
|
|
|
|
|
|
|
Classify every checkpoint name through the real pipeline stages. |
|
Re-widen params the checkpoint stores fp32 before loading into them. |
|
Drop vision-tower keys, and MTP-layer keys unless |
- mstar.model.glm5_next.weight_loader.build_glm5_next_read_plan(checkpoint_keys, config, tp_rank, tp_size, load_mtp=False)[source]#
Keys-to-read + per-key slice specs for the TP fast read path.
- mstar.model.glm5_next.weight_loader.build_glm5_next_stacked_params(n_routed_experts, fp8_experts=False)[source]#
- mstar.model.glm5_next.weight_loader.cross_check_index(index_path, config=None, load_mtp=True, max_examples=10)[source]#
Dry-run the load pipeline over the safetensors index and diff it against the expected module tree. Prints a report; returns pass/fail.
- mstar.model.glm5_next.weight_loader.expected_parameter_paths(config, load_mtp=True)[source]#
The module tree the schedule implies: parameter path -> the number of checkpoint tensors that must land in it (stacked shards count each; dequant-absorbed scale siblings do not).
- Parameters:
config (Glm5NextModelConfig)
load_mtp (bool)
- Return type:
- mstar.model.glm5_next.weight_loader.load_glm5_next_hf_weights(module, weights, n_routed_experts, quant_config=None, fp8_experts=False, num_hidden_layers=45, load_mtp=False)[source]#
- Parameters:
module (nn.Module)
weights (Iterable[tuple[str, torch.Tensor]])
n_routed_experts (int)
quant_config (Fp8BlockQuantConfig | None)
fp8_experts (bool)
num_hidden_layers (int)
load_mtp (bool)
- Return type:
- mstar.model.glm5_next.weight_loader.resolve_index_names(index_names, config, load_mtp=True)[source]#
Classify every checkpoint name through the real pipeline stages.
- mstar.model.glm5_next.weight_loader.restore_fp32_params(module)[source]#
Re-widen params the checkpoint stores fp32 before loading into them.
- Parameters:
module (Module)
- Return type:
None