Support additional BitNet models (Falcon-E, BitNet 0.7B)#14
Merged
Conversation
Fix 4 bugs preventing non-2B-4T models from loading: - Activation detection: only arch=bitnet-25 uses relu², others use silu - F16 untied LM head: Falcon-E has F16 output.weight, not I2_S ternary - ChatML template: auto-detect and apply ChatML for Falcon-E models - BITNET_0_7B_CONFIG: fix wrong hiddenSize/intermediateSize/head counts Add model presets for Falcon-E 1B, Falcon-E 3B, and BitNet 0.7B. Closes #1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Falcon-E GGUF repos are under Instruct-GGUF, not plain GGUF. BitNet 0.7B has no GGUF file available (only safetensors). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
arch=bitnet-25(BitNet 2B-4T) uses relu²; all other architectures default to silu. Removes brokenisOfficialheuristic that misclassified Falcon-E (large vocab) and BitNet 0.7B (arch=bitnet).output.weightas F16, not I2_S ternary. Keep as raw F16 and route through thef32_matmulshader path instead ofBitLinear.<|im_start|>/<|im_end|>tokens in vocab and apply ChatML format. Also adds<|im_end|>as a stop token.hiddenSize(2048→1536),intermediateSize(5632→4096),numAttentionHeads(32→16),numKeyValueHeads(32→16).Closes #1
Files Changed
packages/core/src/types.tslmHeadF16?: booleantoModelConfigpackages/core/src/model/loader.tspackages/core/src/model/config.tsBITNET_0_7B_CONFIGdimensionspackages/core/src/nn/model.tsdispatchLMHeadweight bufferpackages/core/src/tokenizer/tokenizer.tsimEndTokenIdgetterpackages/core/src/index.tsexamples/web-chat/src/main.tsTest plan
npm run buildpassesnpm run lintpasses<|im_end|>stop token🤖 Generated with Claude Code