Repository navigation
convert: register sibling HF names for architectures the runtime already has - #8
Merged
bong-water-water-bong merged 11 commits intoSep 26, 2026
Conversation
…ady has The runtime accepts these GGUF architectures (LLM_ARCH_NAMES) but the converter registered only one HF class per family, so a same-family sibling name (a case variant, a base *Model, or the other head spelling) converted to an unmapped architecture in the census. Register the siblings on the existing classes: gpt2 (GPT2Model, GPT2), gptneox (GPTNeoXModel), bert (BertLMHeadModel, BertForCausalLM, RobertaForMaskedLM), mpt (MptForCausalLM, case), llama (MistralModel, MixtralModel, LLaMA/LLAMA/LLaMAModel/LlaMAForCausalLM/llamaForCausalLM, LlamaForConditionalGeneration), phi (Phi2Model, Phi3Model, PhimoeForCausalLM), t5 (T5Model, MT5Model), qwen (QwenForCausalLM, QwenLMHeadModel, QWenForCausalLM, Qwen2MoEForCausalLM, Qwen3MoeModel, Qwen3_5MoEForCausalLM, Qwen3_5Model, Qwen35ForCausalLM), gemma (GemmaModel, Gemma2Model, Gemma3Model, Gemma4UnifiedForCausalLM), olmo (OLMo3ForCausalLM, OlmoeModel), lfm2 (Lfm2MoEForCausalLM, Lfm2BidirectionalForMaskedLM), stablelm, gpt-oss, starcoder (GPTBigCodeModel, GPTBigCodeLMHeadModel, Starcoder2Model), rwkv6, falcon (RWModel), mamba (MambaModel), chatglm, command-r (Cohere2Model), deepseek (DeepSeekV4, DeepseekOcrForConditionalGeneration), llada. Each name is the same family/head as the registered class, so the arch the backend accepts is unchanged; no look-alike is aliased. tools/registry_build.py maps 48 more HF architectures (vulkan 266->314, hrx 247->295, zinc 44->62).
Author
|
Review from the commit poll. Most of these are spelling variants or the
The rest look right to me, including |
GPU arch gptj was listed in LLM_ARCH_NAMES but had no model class, no graph and no converter, so GPTJForCausalLM counted as unmapped and could not be served. - src/models/gptj.cpp: hparams (layernorm eps, parallel residual), tensors (separate bias-free q/k/v/out, biased fc_in/fc_out, single attn_norm) and the graph: x = x + attn(ln_1(x)) + mlp(ln_1(x)), partial RoPE on q/k. - src/models/models.h: declare llama_model_gptj. - src/llama-model.cpp: dispatch LLM_ARCH_GPTJ to it; GPT-J uses normal (consecutive-pair) RoPE, so move it out of the no-RoPE group. - conversion/gptj.py: GPTJForCausalLM -> gguf.MODEL_ARCH.GPTJ, partial rotary_dim, GPT-2 BPE vocab; registered in TEXT_MODEL_MAP. Builds (cmake+ninja, libllama). tools/registry_build.py now maps GPTJForCausalLM (vulkan+hrx).
Add ARCH.OPT (gguf constants + tensor names for model.decoder.*), LLM_ARCH_OPT, llama_model_opt + src/models/opt.cpp (pre-norm: x=x+attn(LN(x)); x=x+fc2(relu(fc1(LN(x)))), learned positions, biased q/k/v/out and fc1/fc2), dispatch, no-RoPE, and conversion/opt.py (drops the two padding rows OPT's learned positions carry). Builds (cmake+ninja, libllama).
GPT-Neo is a GPT-2-style decoder with separate bias-free q/k/v, a biased out_proj and biased c_fc/c_proj, learned positions, and alternating global/local attention. Add MODEL_ARCH.GPTNEO (+names/tensors), LLM_ARCH_GPTNEO, a llama_model_gptneo graph that drives the iswa cache with set_swa_pattern(2) and window 256, and conversion/gptneo.py. Builds (cmake+ninja, libllama).
CodeGen is GPT-J-shaped: parallel attention/MLP off one norm, partial RoPE, bias-free projections, but a single fused qkv_proj and a biased MLP. Add MODEL_ARCH.CODEGEN (+names/tensors), LLM_ARCH_CODEGEN, llama_model_codegen (fused-QKV via build_qkv, NORM rope), and conversion/codegen.py. Builds.
pico-lm's PicoDecoder is an ordinary Llama (RMSNorm, GQA, RoPE, SwiGLU) under
its own module names (embedding_proj, layers.*.attention.{q,k,v,o}_proj,
swiglu.w_{0,1,2}, de_embedding_proj). Add those names to the tensor map and a
converter that strips the pico_decoder. wrapper and emits the llama arch — the
runtime already serves it, so no new kernels. Registry maps PicoDecoderHF
(vulkan+hrx+zinc).
Cambrian's Qwen text tower declares model_type qwen2 with Qwen2's shapes and tensor names. Register the class name against the existing qwen2 architecture — the runtime already serves it.
… the unified class BertLMHeadModel and BertForCausalLM are BERT as a causal decoder (is_decoder=True); the bert arch is a bidirectional encoder, so a converted checkpoint would run with the wrong mask. Gemma4UnifiedForCausalLM goes on Gemma4UnifiedModel, which adds the unified variant's suppress tokens, rather than on plain Gemma4Model. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mers Each new port was checked against transformers in FP32: teacher-forced top-1 over 3 prompts x 32 greedy tokens, one prompt of 340 tokens (past GPT-Neo's 256-token local window), F32 GGUFs from this converter, Vulkan. - gptneo: no attention scaling (GPTNeoSelfAttention multiplies q.k^T unscaled; its flash path passes softmax_scale=1.0). Was 1/sqrt(head_dim). - codegen: qkv_proj is 4 model-parallel blocks, each (query, value, key) (CodeGenAttention.forward); the converter now writes q, then k, then v. lm_head has a bias: the loader reads output.bias and the graph adds it. Mask buffer attn.causal_mask skipped. - gptj: lm_head bias, as for codegen. The attn.bias / attn.masked_bias buffers are skipped (they were passed on to the tensor map and failed). - opt, gptj: their tokenizer is GPT-2's byte-level BPE; its checksum was not recognised. - test-llama-archs: GPT-J has an implementation now, so it is no longer skipped. | model | top-1 agreement | |---|---| | facebook/opt-125m | 96/96 | | EleutherAI/gpt-neo-125m | 96/96 | | Salesforce/codegen-350M-mono | 96/96 (0/96 before the qkv reorder and output bias) | | hf-internal-testing/tiny-random-GPTJForCausalLM | 89/89 (7 positions the server could not format) | test-llama-archs passes for all four (Vulkan and CPU, save/reload) and the full suite has 0 FAIL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
|
Pushed two commits here.
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
merged commit Sep 26, 2026
83e1c41
into
1bit/hrx-vulkan-patched
10 of 27 checks passed
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.
The runtime accepts these GGUF architectures (
LLM_ARCH_NAMES) but the converter registered only one HF class per family, so a same-family sibling name (a case variant, a base*Model, or the other head spelling) counted as an unmapped architecture in the engine census.This registers the siblings on the existing classes. Each name is the same family/head as the registered class, so the arch the backend accepts is unchanged; no look-alike is aliased.
With it,
tools/registry_build.pymaps 48 more HF architectures: vulkan 266->314, hrx 247->295, zinc 44->62.