mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-10-03 19:45:41 +00:00
* gguf-py: add Maple tensor constants
Add MODEL_ARCH.MAPLE, its "maple" name, and the tensor list for the
Maple 20B-A1B ternary MoE architecture: token embeddings, output,
attention with Q/K RMS norms, and per-expert FFN tensors.
* convert: add Maple HF->GGUF converter
Register MapleForCausalLM in the HF architecture map and add the
converter for the Maple 20B-A1B ternary MoE model: 24 layers, 256
experts with 8 active, sliding-window attention (SWA-512) interleaved
with global attention at a 3:1 ratio, partial rotary factor 0.5, and
per-expert weight stacking into merged 3D tensors.
* llama: add Maple architecture (20B-A1B ternary MoE)
Add the Maple 20B-A1B ternary MoE architecture: 24 layers, 256
experts with 8 active, sliding-window attention (SWA-512) interleaved
with global attention at a 3:1 ratio, and ternary TQ1_0/TQ2_0
quantization support.
- register LLM_ARCH_MAPLE between MAMBA2 and JAMBA
- implement llama_model_maple: Q/K RMS norms after projection (GEMMA4
style), rope applied only on SWA layers (nope_on_global_attention),
ISWA KV cache, and MoE FFN with swiglu gate clamp at +7 (DEEPSEEK4
style)
- mark MAPLE as unsupported by the model saver (roundtrip skipped)
* tests: mark Maple as MoE-mandatory
Maple is always-MoE: the model throws when n_expert == 0, so the
test harness must only run the MoE config for LLM_ARCH_MAPLE.
* maple: apply review feedback (n_ff_exp_arr, get_arr, rope params)
- load_arch_hparams: use n_ff_exp_arr + n_ff_exp() accessor (upstream
changed these from a scalar member during the rebase)
- sliding_window_pattern: get_arr, the pattern is mandatory for this arch
- partial_rotary_factor: read only from rope_parameters (base.py mirrors
the top-level key automatically)
- document why TOKEN_EMBD/OUTPUT are forced to F16 (they are the two
dense tensors in Maple, and the reference GGUFs ship them as F16)
- add @ModelBase.example("deepgrove/maple-preview")
* tests: add Maple to the SWA pattern array list
get_arr for maple.attention.sliding_window_pattern requires an array, but
the harness only emitted a per-layer array for the arches in its list, so
test-llama-archs -a maple failed to load the model.
Assisted-by: DeepSeek Harness
* maple: move swiglu_clamp_exp to the converter
The loader prefilled 7.0 and read the key optionally. The converter now
writes it and the loader reads it as required, because llama-graph.cpp
skips the clamp when the limit is 0 and an optional read would silently
run unclamped. The test harness provides the key for the same reason.
Also drops tensor_force_quant: base.py already forces FFN_GATE_INP to F32
and TOKEN_EMBD/OUTPUT to F16 for ternary file types.
Assisted-by: DeepSeek Harness
* convert: fix the LazyBase func signature in the Maple converter
ty flagged the stack() closure: it takes no argument, while LazyBase is
annotated with func: Callable[[Any], Any]. Pass the tensor list through
args instead of closing over it, the same way kimi_k3 does, so the
callable shape matches.
Assisted-by: DeepSeek Harness
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| afmoe.py | ||
| arctic.py | ||
| baichuan.py | ||
| bailingmoe.py | ||
| bailingmoe3.py | ||
| base.py | ||
| bert.py | ||
| bitnet.py | ||
| bloom.py | ||
| chameleon.py | ||
| chatglm.py | ||
| codeshell.py | ||
| cogvlm.py | ||
| command_r.py | ||
| dbrx.py | ||
| deci.py | ||
| deepseek.py | ||
| dots1.py | ||
| dots3.py | ||
| dotsocr.py | ||
| dream.py | ||
| ernie.py | ||
| exaone.py | ||
| falcon.py | ||
| falcon_h1.py | ||
| gemma.py | ||
| glm.py | ||
| gpt2.py | ||
| gpt_oss.py | ||
| gptneox.py | ||
| granite.py | ||
| grok.py | ||
| grovemoe.py | ||
| hunyuan.py | ||
| hy_v4.py | ||
| internlm.py | ||
| internvl.py | ||
| jais.py | ||
| jamba.py | ||
| januspro.py | ||
| kimi_k3.py | ||
| kimi_linear.py | ||
| kimivl.py | ||
| laguna.py | ||
| lfm2.py | ||
| lighton_ocr.py | ||
| llada.py | ||
| llama.py | ||
| llama4.py | ||
| llava.py | ||
| maincoder.py | ||
| mamba.py | ||
| maple.py | ||
| mellum.py | ||
| mimo.py | ||
| minicpm.py | ||
| minimax.py | ||
| mistral.py | ||
| mistral3.py | ||
| mpt.py | ||
| muse_glimmer.py | ||
| nanbeige.py | ||
| nemotron.py | ||
| olmo.py | ||
| openelm.py | ||
| orion.py | ||
| pangu.py | ||
| phi.py | ||
| pixtral.py | ||
| plamo.py | ||
| plm.py | ||
| pockettts.py | ||
| qwen.py | ||
| qwen3tts.py | ||
| qwen3vl.py | ||
| qwen4exp.py | ||
| qwenvl.py | ||
| refact.py | ||
| rwkv.py | ||
| sarashina2.py | ||
| smallthinker.py | ||
| smolvlm.py | ||
| spark2_5.py | ||
| stablelm.py | ||
| starcoder.py | ||
| step3.py | ||
| t5.py | ||
| talkie.py | ||
| ultravox.py | ||
| wavtokenizer.py | ||
| xverse.py | ||
| youtuvl.py | ||