Repository navigation
Add Qwen3.5 model support (config, weights, and hybrid Gated DeltaNet) - #87
Merged
Merged
Conversation
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.
Depends on gomlx/gomlx#502 (once merged,
go.modshould be bumped to the newgithub.com/gomlx/gomlxrelease).Summary
transformer.Config(models/transformer/config.go) with Qwen3.5 hybrid Gated DeltaNet fields (attn_output_gate,full_attention_interval,linear_conv_kernel_dim,linear_key_head_dim,linear_value_head_dim,linear_num_key_heads,linear_num_value_heads,mamba_ssm_dtype,tie_word_embeddings).Config.UnmarshalJSONto parse both flatrope_parametersobjects (Qwen3.5) and nested per-layer-type maps (Gemma 4) without breaking existing models.models/transformer/model.go:qwen3_5/qwen3_5_textindetectCausalMaskand honor typedConfig.TieWordEmbeddings.layers.{N}.linear_attn.*safetensors weights (in_proj_qkv,in_proj_z,in_proj_b,in_proj_a,out_proj,conv1d.weight,A_log,dt_bias,norm.weight) and untiedlm_head.weight, cleanly skippingmodel.visual.*andmtp.*tensors.models/transformer/transformer.goto configuremltransformer.ArchitectureQwen35,mltransformer.LinearLayerlayer types, zero-centered RMSNorm (RMSNormOffset = 1.0), gated attention output (WithAttnOutputGate(true)), linear attention dims/state dtype, and standard partial RoPE (partial_rotary_factor).TestQwen35ConfigAndTensorMappinginmodels/transformer/transformer_test.gocovering Qwen3.5 config/tensor mapping and Gemma 4 nestedrope_parameterscompatibility.docs/CHANGELOG.mdand.agents/AGENTS.md.Verification
go test -short ./...passes.govsxla:cpucross-backend mean cosine distance8.95e-05).GOEXPERIMENT=simd GOMLX_BACKEND=go go run ./examples/dolly/browse -n=2 -model="Qwen/Qwen3.5-4B" -prompt_tokens=1024 -gen_tokens=128<|im_end|>stopping, ~60–67 tok/s prefill, ~5.94 tok/s decode, 11.3 GiB MaxRSS).