Repository navigation
tools: clef_adapter.py rebuilds a Clef runtime adapter from the merged release and its stock base - #1366
tools: clef_adapter.py rebuilds a Clef runtime adapter from the merged release and its stock base#1366gilby wants to merge 10 commits into
Conversation
…ost, equal to its Python within fp32 rounding
…ine's final rows; the Qwen 27B CUDA family gives them
…ies in encoder order
… block, and its attention split by query rows across threads; bits unchanged
ashhart
left a comment
There was a problem hiding this comment.
Thanks @gilby, small ones: in clef_adapter.py's factor, the in > out branch divides by singular values that can be 0 and writes NaN factors as bf16; please guard it, assert the factors are finite, and add a rank-deficient wide test case. head_rows raises a bare KeyError when the merge lacks the embedding; a clear message would help. (The unit tests skip without torch, which is fine, but say so in the tool's docs.)
…s the qwen3_5 CUDA family
…pass, on a cache reserved at startup
…vs 4 head threads bit-equal, in CI
…s decision passes only, y += (bf16(x A^T)) B^T in fp32; never inside a capture
…rom the merged release and its stock base
…n-finite factors, and names a missing embedding
bdf9b7d to
65c6f0f
Compare
|
Thanks. Rebased on #1364's new head, plus one commit (
|
|
Review against main e9b69ed (shared notes on #1361). The tool keeps |
Part of #1360. Stacked on #1364 (Clef's runtime adapter); the last commit is new here.
--clef DIRloads Clef as a LoRA on the base checkpoint, but Cloudflare publishes Clef only as merged weights. This adds the tool that rebuilds the adapter directory from public weights, so nobody has to trust a third-party upload (ours is unigilby/Qwen3.8-27B-clef-adapter).python tools/clef_adapter.py --merged Cloudflare-clef/ --base Qwen3.8-27B/ --out clef-adapter/ \ [--merged-revision SHA] [--base-revision SHA] [--rank 256] [--threads N] [--check OTHER_ADAPTER_DIR]min(256, out, in): bf16 A with orthonormal rows, B with the scale folded in, keyslayers.{i}.{module}.lora_A/.lora_B.lm_head_rows.safetensorsfrom the base's output embedding (asserted identical in the merge),manifest.jsonwith both revisions and every module's shape and rank,extract_report.json(each projection's residual against the bf16 rounding floor of the merge) andSHA256SUMS.json.--checkcompares the reconstructed deltasB Awith another adapter directory.tools/. Its tests need them too and are skipped without them.s[0] * 1e-7, an all-zero delta and any non-finite factor are refused, and a merge without the output embedding is named as such.Receipts
Cloudflare/clef@0b331204againstQwen/Qwen3.8-27B@1d4bf0f2(bf16), 32 CPU threads, 773 s:layers.40.mlp.gate_proj: 1.18% vs a 1.14% floor).--check: worst relative difference 0.0).lm_head_rowstensor bit-identical; joint head files and LICENSE byte-identical; manifest modules, shapes and ranks identical.tools/tests/test_clef_adapter.py(skips without torch): a synthetic low-rank delta is recovered with orthonormal A, the manifest and head files are written, a changed norm is refused, a rank-deficient wide delta keeps its rank with finite factors, and a merge without the embedding is named. 4/4 pass.