Crate metrale_config

Crate metrale_config 

Source
Expand description

2026-09-26: The typed model config (ModelConfig) parsed from a checkpoint’s config.json or GGUF metadata, its capabilities, and the METRALE_* lever table.

Owner: config. Invariants: none beyond the types.

Re-exports§

pub use activation_quantization::ActQuantFormat;
pub use activation_quantization::ActivationQuantization;
pub use activation_quantization::ProjFamily;
pub use precision_plan::DeclaredPrecisionPlan;
pub use precision_plan::LayerPrecision;
pub use weight_quantization::Nvfp4Act;
pub use weight_quantization::W4a4Downcast;
pub use weight_quantization::WeightQuantPolicy;
pub use weight_quantization::WeightQuantTier;
pub use weight_quantization::WeightQuantization;

Modules§

activation_quantization
2026-09-30: --activation-quantization: which activation precision each decode projection runs at, as a function of the projection family and of the number of rows in the launch (decode batch rows, MTP verify rows included).
capabilities
2026-09-26: Feature flags derived from a parsed ModelConfig by ModelConfig::capabilities.
levers
2026-09-26: Every METRALE_* environment variable the repository reads, declared once.
precision_plan
2026-09-28: The declared precision plan: what a checkpoint’s quantization_config declares, per linear layer, for the weight AND the input activations.
recipe_yaml
2026-09-26: A small YAML reader for recipe files; the workspace has no YAML dependency.
weight_quantization
2026-09-28: --weight-quantization: the precision each linear layer runs at, and the one policy that loaders and kernel dispatch ask for it.

Structs§

GgufConfigInputs
2026-09-26: Inputs to config_from_gguf: the metadata reader plus two facts from the tensor section.
ModelConfig
PeftAdapterConfig
2026-09-26: The fields of a PEFT adapter_config.json that the engine uses, as validated by parse_peft_adapter_config. lora_dropout, a training-only setting, is ignored.
QuantizationConfig
2026-09-26: The weight-quantization block of a checkpoint config (quantization_config, into which the server merges a sibling hf_quant_config.json), as read by parse_quantization_config. That parser returns None when the block declares no method, algorithm or ignore list.
VisionConfig
2026-09-26: Vision tower configuration: parse_vision_config for the Qwen family, and the GLM-5.3 parser, which also fills the fields the Qwen parser leaves at their defaults.

Enums§

AttnPositionEncoding
2026-09-29: What full attention does to Q and K before the dot product.
Glm5NextRouterMode
2026-09-26: Which dtype ladder GLM-5.3’s MoE router runs in. The glm5_next parser reads moe_router_dtype and uses HfFp32 when it is absent.
LayerType

Constants§

PEFT_SUPPORTED_TARGET_MODULES
2026-09-26: The module names (last .-segment of a target_modules entry) this parser accepts; validate_target_module also accepts the MoE router leaf gate. On a gated-attention model q_proj is the whole Q-and-gate projection, 2 * num_attention_heads * head_dim wide (metrale_model_layers LoraModule::dims). Which layers a module may target is decided per tensor by classify_key in the same crate.

Traits§

GgufMeta
2026-09-26: Typed read access to GGUF metadata. Integer getters widen to u64 and float getters to f64. A getter returns None when the key is absent or holds another value type; the builder decides whether absence is an error or has a fallback.

Functions§

allow_partial_targets
2026-09-26: METRALE_LORA_ALLOW_PARTIAL (1 or true, any case), read once per process: load an adapter that names target modules the engine cannot apply, skipping those.
config_from_gguf
2026-09-26: Build a ModelConfig from GGUF metadata and validate it with finalize_config.
glm5_next_mtp_layer_index
2026-09-26: The layer index of the MTP layer: num_hidden_layers, one past the text stack, which num_hidden_layers counts alone.
glm_vision_enabled
2026-09-26: Whether GLM-5.3’s vision tower is enabled for this process (METRALE_GLM_VISION, see glm_vision_enabled_from); off by default.
glm_vision_enabled_from
2026-09-26: The policy half of glm_vision_enabled, taking the value instead of reading the environment, so tests need not set a variable. Only 1, true, yes or on (trimmed, any case) enable; anything else, unset included, leaves the tower off.
parse_config
2026-09-26: Parse a checkpoint config.json into a ModelConfig: the family parse, then eos_token_ids from every declared stop id, then the Kimi-K3 stop-set clean-up.
parse_mistral_params
parse_peft_adapter_config
2026-09-26: Parse a PEFT adapter_config.json payload.
parse_quantization_config
2026-09-28: Ok(None) when there is no block or it declares nothing; an error when the block’s precision declaration is malformed (DeclaredPrecisionPlan).