Repository navigation
Conversation
Re-implements the dense Llama decoder from 31c3028 on current dev. llama.c is a from-scratch LlamaForCausalLM trunk: RMSNorm (no bias), optional llama3/linear RoPE scaling, grouped-query attention, SwiGLU MLP, optional tied embeddings, fully resident f32, read straight from the HF safetensors through load_t (which checks every declared element count against config dims before allocating or reading). CTX caps the KV capacity the planner budgets for; SERVE=1 speaks the shared gateway protocol so the registered family is reachable by coli serve/chat like every other engine; COLI_CUDA=1 moves the projections and LM head to the GPU when built with CUDA=1. tools/convert_llama.py validates and stages a checkpoint; tools/make_llama_oracle.py drives transformers for the reference tokens in c/ref_llama.json. Adapted to upstream changes since the source commit's base 98eef7f: the PlannerGeometry `dense` flag, the segment-conformance manifest and C fixture matrix, the "every family carries the gateway adapter" invariant, the per-family ci/release/clean/README/site contracts, and the removal of the st_fixture.h read-trust helper (the test now writes its shard inline). Verified: make -B llama (0 warnings); matching tokens 64/64 against the real unsloth/Llama-3.2-1B at 9535bd9b; oracle reproduces ref_llama.json byte-for-byte; make test-c and make test-python green. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Owner
|
Thanks for the work and for splitting it out of #1564. We are not going to take a dense Llama engine, and here is why. colibri exists to run models that do not fit in memory, by streaming MoE experts from disk with a quantized trunk. This engine keeps every weight resident in f32, with no quantization and no streaming. Llama 3.2 1B is about 5 GB that way and 8B about 32 GB, and 70B cannot load at all, so it serves only small models that already run well everywhere. Each family also costs ongoing maintenance in CI, releases, the registry and five READMEs. Two smaller points for the record:
The loader hardening idea from the same split is in #1824, and that one we would like to merge. Closing this one. |
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.
Adds a dense decoder, split out of #1564 as requested. Rebuilt on current
dev(4521832a).What
c/llama.cβ a conventional decoder with grouped-query attention and a grouped KV cache, supporting Llama 3.2. The tree is currently MoE-only, so this is a new capability rather than a port.Also included:
c/tools/convert_llama.pyβ safetensors to container converterc/tools/make_llama_oracle.pyβ oracle generatorc/ref_llama.jsonβ reference tokens forunsloth/Llama-3.2-1B@9535bd9bc/family_registry.pyβ dense-family support, reusing the existingFamilyDescriptor/FAMILIESextension points already in the treec/Makefile, the CI and release engine lists, and the family tuples inc/openai_server.pyCorrectness
The oracle is generated independently with torch 2.14.1 / transformers 5.18.0 from the upstream checkpoint, and reproduces the committed reference exactly:
Against that reference, on the real
unsloth/Llama-3.2-1Bcheckpoint:The
SERVEpath is also exercised end to end (handshake,SUBMIT,DATA,DONE).Tests
make llamaβ clean, 0 warningsmake llama CUDA=1β clean, 0 warningsmake test-cβ full suite passesmake test-pythonβ 1921 tests, OKtests/test_llama_read_trustβ new, passestests/test_convert_llama.pyβ newNotes
Deletions are limited to lines that have to grow: the engine lists in
ci.yml/release.yml/Makefile, the family tuples inopenai_server.py, the segment conformance manifest, and the "ten families" sentences in the five READMEs (now eleven). No upstream behaviour is removed.This is the Llama portion of #1564. The rest is still being split out separately; this one stands alone.