b10514
model : GraniteSWAForCausalLM / GraniteMoeSWAForCausalLM (#25505)
- feat(convert): Add conversion for GraniteSWAForCausalLM
Branch: GraniteSWAForCausalLM AI-usage: full (Bob, OpenCode + Qwen3.6-35b) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat(llama): Add granite_swa support
Branch: GraniteSWAForCausalLM AI-usage: full (Bob, OpenCode + Qwen3.6-35b) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat(conversion): Add conversion infra for rope_pattern array
NOTE: There is other work also targeting this, so this may be removed depending on merge order.
Branch: GraniteSWAForCausalLM AI-usage: full (Bob) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix(conversion): Fix SWA pattern logic and support for non-rope layers
Branch: GraniteSWAForCausalLM AI-usage: full (Bob) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat(conversion): Add support for GraniteMoeSWA
Branch: GraniteSWAForCausalLM AI-usage: full (Bob) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: Add llama_hparams::has_rope and arch constants
NOTE: This shadows the work done for Granite Speech https://github.com/ggml-org/llama.cpp/pull/25107
Branch: GraniteSWAForCausalLM AI-usage: full (Bob) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: Add support for per-layer rope determination
Branch: GraniteSWAForCausalLM AI-usage: full (Bob) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- style: Fix failing flake8 for extra newlines
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- test: Write out SLIDING_WINDOW_PATTERN in llama-model-saver
Branch: GraniteSWAForCausalLM AI-usage: full (OpenCode + Qwen3.6-35b) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix(convert): Fix missing registration for GraniteMoeSWAForCausalLM
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Load MoE params as optional
Branch: GraniteSWAForCausalLM AI-usage: draft (OpenCode + Qwen3.6-35b) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: Handle MoE params in conversion
branch: GraniteSWAForCausalLM AI-usage: full (OpenCode + Qwen3.6-35b) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- style: Remove unnecessary newline
AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Remove unnecessary tensor additions to GRANITE architecture
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Correctly handle naming for ffn gate inp
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Always default hparams.rope_pattern to 1s
This isn't strictly necessary, but it will allow other models to rely on hparams.has_rope(il) without needting to prepopulate.
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: Move to has_rope for all granite model architectures
Now that we have a proper hparam for this, it's better to use it and not require a hacky fallback in the hparam method itself.
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: No hacky rope_finetuned fallback in has_rope
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Fully remove rope hparam filling in granitemoe
There are no granitemoe models that use NoPE (it's not actually used in the layer building below), so this was just dead code.
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Save out rope_pattern in model-saver
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Set hparams.rope_finetuned for round trip
Since the value is read from rope_finetuned, we need to persist it when the model is saved with the saver.
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Code review cleanup
Signed-off-by: Gabe Goodhart ghart@us.ibm.com Co-authored-by: Sigbjørn Skjæret sigbjorn.skjaeret@huggingface.co
Co-authored-by: Sigbjørn Skjæret sigbjorn.skjaeret@huggingface.co
- refactor: Keep gate/up fused for MoE path
Branch: GraniteSWAForCausalLM AI-usage: full (Claude + Sonnet 5) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Skip GRANITE_SWA in model saver
https://github.com/ggml-org/llama.cpp/pull/25505#discussion_r3773175651
Keeping is_swa_impl in the saver can break other models.
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
add sliding window pattern for model in test
style: Fix indentation
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- fix: Fix \r\n
Thanks Claude!
Branch: GraniteSWAForCausalLM AI-usage: none Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- feat: Keep shared expert fused
Branch: GraniteSWAForCausalLM AI-usage: full (Claude + Sonnet 5) Signed-off-by: Gabe Goodhart ghart@us.ibm.com
- style: More indentation fixes
Signed-off-by: Gabe Goodhart ghart@us.ibm.com
Co-authored-by: Sigbjørn Skjæret sigbjorn.skjaeret@huggingface.co
Signed-off-by: Gabe Goodhart ghart@us.ibm.com Co-authored-by: Sigbjørn Skjæret sigbjorn.skjaeret@huggingface.co
Website:
Attestations:
macOS/iOS:
- macOS Apple Silicon (arm64)
- macOS Apple Silicon (arm64, KleidiAI enabled) DISABLED
- macOS Intel (x64)
- iOS XCFramework
Linux:
- Ubuntu x64 (CPU)
- Ubuntu arm64 (CPU)
- Ubuntu s390x (CPU)
- Ubuntu x64 (Vulkan)
- Ubuntu arm64 (Vulkan)
- Ubuntu x64 (ROCm 7.14)DISABLED
- Ubuntu x64 (OpenVINO)
- Ubuntu x64 (SYCL FP32)
- Ubuntu x64 (SYCL FP16)
Android:
Windows:
- Windows x64 (CPU)
- Windows arm64 (CPU)
- Windows arm64 (OpenCL Adreno)
- Windows x64 (CUDA 12) - CUDA 12.4 DLLs
- Windows x64 (CUDA 13) - CUDA 13.3 DLLs
- Windows arm64 (CUDA 13) (preview) - CUDA 13.4 DLLs
- Windows x64 (Vulkan)
- Windows x64 (OpenVINO)
- Windows x64 (SYCL)
- Windows x64 (ROCm 7.14)
openEuler:
- DISABLED
- openEuler x86 (310p)
- openEuler x86 (910b, ACL Graph)
- openEuler aarch64 (310p)
- openEuler aarch64 (910b, ACL Graph)
UI: