feat: add Motif-3 model architecture support - #1
Open
ajaxdude wants to merge 2 commits into
Open
Conversation
Add support for the Motif-3 model architecture (314B.A13B MoE) from https://huggingface.co/AesSedai/Motif-3-GGUF. Changes: - llama-arch.{h,cpp}: MOTIF3 arch enum, 8 KV fields, 14 tensor fields - llama-model.{h,cpp}: Layer tensors, model mapping, rope type - llama-hparams.h: PolyNorm, mHC, GDLA/MLA hyperparameters - llama-graph.cpp: MLA KV cache integration, buffer checks - llama-kv-cache-iswa.{h,cpp}: SWA subcache hparams override for MLA - llama-context.cpp: Graph node allocation for motif3 - llama-quant.cpp: Motif-3 tensor quantization exclusions - llama-vocab.cpp: <|endofturn|> end-of-turn token - gguf-py/gguf/constants.py: Enum, names, allowed/skip tensor lists - conversion/__init__.py: MotifForCausalLM -> motif3 mapping - conversion/motif3.py: PyTorch -> GGUF converter - src/models/motif3.cpp: GDLA attention, PolyNorm MoE, mHC, interleaved SWA+Yarn - src/models/models.h: llama_model_motif3 declaration Based on upstream PR ggml-org#26298
- remove duplicated LLM_TENSOR_NAMES entries from LLM_TENSOR_INFOS array - fix llama_model_mapping: restore nanbeige return, remove stray MOTIF3 case - fix llama_model_rope_type: remove misplaced motif3 return and stray case - remove dangling endofturn check in llama-vocab.cpp - restore missing closing brace in motif3.cpp - match upstream comment wording in kv-cache-iswa.h and quant.cpp - add MOTIF3 MODEL_TENSORS list to gguf constants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for the Motif-3 model architecture (314B.A13B MoE) from AesSedai/Motif-3-GGUF.
Architecture features
Changes
llama-arch.{h,cpp}MOTIF3arch enum, 8 KV fields, 14 tensor fields with infollama-model.{h,cpp}llama-hparams.hllama-graph.cppllama-kv-cache-iswa.{h,cpp}llama-context.cppllama-quant.cppllama-vocab.cpp<|endofturn|>end-of-turn tokengguf-py/gguf/constants.pyconversion/__init__.pyMotifForCausalLM→motif3mappingconversion/motif3.pysrc/models/motif3.cppsrc/models/models.hllama_model_motif3struct declarationBased on
Upstream PR: ggml-org/llama.cpp#26298
Testing
conversion/motif3.pyandsrc/models/motif3.cppbyte-identical to upstreamcmake -B build -G Ninja+ninja llama: compiles clean (CPU build)cmake -B build-vk -G Ninja -DGGML_VULKAN=ON+ninja llama: compiles clean (Vulkan build;libggml-vulkan.sobuilt)file(GLOB LLAMA_MODELS_SOURCES "models/*.cpp")insrc/CMakeLists.txt