Archived
merge origin/main: the upstream LoRA-runtime refactor beneath the ref2va port
Merges upstream 1.10.0 (152 commits: the LoRA acquire/runtime refactor, the
form-1 LTX-2 scheduler family, guidance terms + negative prompts, decoder
selection, input_reference, new architectures) into the ref2va port branch.
Resolution rule throughout: keep BOTH feature sets; ABI numbering follows
upstream (RAD_ABI_VERSION 26, RAD_FORMAT_VER 2), with the port's video fields
unioned into RadVideoGenBatch/RadVideoGenDecl and abi_layout_table.h
regenerated from the live table.
Notable reconciliations:
* videos.cpp: the task grammars are disjoint by capability -- keyframe tasks
(i2va/l2va/flash-attn l2va/fl2va) are recognized only when decl.encodes,
so upstream models keep refusing them as unknown tasks; input_reference,
the LoRA tag/field pipeline, and the guidance/negative_prompt rendering
coexist with refs/ref2va; the prompt put() helper hoisted to block scope
for the media branch.
* video_schedule(): upstream's (steps, video_tokens, refine) keeps its
positional slots; the port's shift_video/shift_audio overrides move to the
tail so upstream's schedule tests call unchanged.
* r4d_selftest conv3d cases: the port's sp/st/causal/down/refl geometry and
upstream's tpad/tpre fold into one reference (ft = causal ? 2 : tpad==2 ?
2+tpre : 1); rms_mod rows keep the port's i8/fp8 quant modes alongside
upstream's wadd/norm_once/norm parameters.
* tests/oot_plugins.sh: the per-plugin cmake --install gains a --prefix
staging dir -- plugin .so files still land in the absolute
RAD_PLUGIN_INSTALL_HOME, but libr4d now also installs r4d_selftest to a
relative bin/, which needs no root.
Host ctest: 112/113 (mm_test's webp gap pre-exists this merge); r4d_selftest,
engine_e2e, oot_plugins, abi_layout, all LoRA tests green.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
a1a75da7e9
415 files changed
+78837
-5310
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# anima-bf16.recipe -- Anima (Base, Aesthetic or Turbo) at bf16.
|
||||
#
|
||||
# rad-convert <Anima>/split_files/diffusion_models/anima-aesthetic-v1.1.safetensors \
|
||||
# --add <Anima>/split_files/text_encoders/qwen_3_06b_base.safetensors \
|
||||
# --add <Anima>/split_files/vae/qwen_image_vae.safetensors \
|
||||
# --config <Qwen/Qwen3-0.6B-Base> --tokenizer2 <ComfyUI>/comfy/text_encoders/t5_tokenizer/tokenizer.json \
|
||||
# --arch anima --set anima.variant=aesthetic \
|
||||
# --recipe data/recipes/anima-bf16.recipe -o anima-aesthetic-bf16.rad
|
||||
#
|
||||
# Every linear stays as the release holds it (bf16). Two weights are computed at convert, in f32,
|
||||
# and stored bf16 here: the patch embedding without its padding-mask columns, and the VAE's causal
|
||||
# 3-D convolutions read at their last temporal tap.
|
||||
|
||||
dit.x_embed.weight cast dtype=bf16
|
||||
decoder.* cast dtype=bf16
|
||||
conv2.* cast dtype=bf16
|
||||
@@ -0,0 +1,31 @@
|
||||
# anima-fp8.recipe -- Anima (Base, Aesthetic or Turbo) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <Anima>/split_files/diffusion_models/anima-aesthetic-v1.1.safetensors \
|
||||
# --add <Anima>/split_files/text_encoders/qwen_3_06b_base.safetensors \
|
||||
# --add <Anima>/split_files/vae/qwen_image_vae.safetensors \
|
||||
# --config <Qwen/Qwen3-0.6B-Base> --tokenizer2 <ComfyUI>/comfy/text_encoders/t5_tokenizer/tokenizer.json \
|
||||
# --arch anima --set anima.variant=aesthetic \
|
||||
# --recipe data/recipes/anima-fp8.recipe -o anima-aesthetic-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder and of the DiT's 28 blocks (self- and cross-attention, MLP)
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way. The LLM adapter, the embeddings, the modulation linears, the final layer
|
||||
# and the VAE stay bf16. The patch embedding (without its padding-mask columns) and the VAE's causal
|
||||
# convolutions (at their last temporal tap) are computed at convert and stored bf16.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.mlp_layer1.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.mlp_layer2.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
dit.x_embed.weight cast dtype=bf16
|
||||
decoder.* cast dtype=bf16
|
||||
conv2.* cast dtype=bf16
|
||||
@@ -0,0 +1,24 @@
|
||||
# flux-3-klein-fp8.recipe -- FLUX.3 [klein] (or its base) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <flux-3-image-klein pipeline directory> --recipe data/recipes/flux-3-klein-fp8.recipe \
|
||||
# -o flux-3-klein-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model and of the DiT's early and joint blocks
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way. What stays bf16 is read once a pass or less: the embedding table, the
|
||||
# embedders, the timestep MLPs, the modulations, the output layer and the VAE. The language
|
||||
# model's layers past its last tap (32 of 36) are not carried.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.ffn_in.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.ffn_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.ffn_in.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.ffn_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,55 @@
|
||||
# gemma4-31b-dense-bf16-q8-df.recipe -- Gemma 4 31B dense (text) from Google's bf16 checkpoint at
|
||||
# eight bits (Q8_0's grid as libr4d serves it), with z-lab's DFlash drafter at eight bits too.
|
||||
#
|
||||
# rad-convert <gemma-4-31B-it> --draft-model <gemma-4-31B-it-DFlash> \
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-q8-df.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-q8-df.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-q8-df.rad --num-speculative-tokens auto ...
|
||||
#
|
||||
# Q8_0 is int8 codes, symmetric, one f16 scale per block, the scale amax / 127: exactly `codes=i8
|
||||
# scale=f16 clamp=sym` and the default absmax rule. What differs is the block. GGML's is 32 values
|
||||
# and libr4d's int8 GEMMs read 128 (their group is compiled in, C_EQ("group", 128)), so a block
|
||||
# here is four of Q8_0's. Every rule below is that one grid:
|
||||
#
|
||||
# the trunk's linears gemm_nt_q at w8a8: the w4a8 grid at twice the radix, read by the same
|
||||
# fused junctions (rmsnorm_quant_i8, qkv_norm_rope, gelu_mul_quant_i8), so
|
||||
# the step takes the int4 container's launches with twice its weight bytes
|
||||
# the drafter's linears gemm_nt_q at w8a8 too, rmsnorm_quant_i8 folding each residual add, norm
|
||||
# and quantiser (arch/common/rad_gemma4_dflash.h)
|
||||
# the drafter's head its own int8 copy of the tied table, gemm_nt_q at w8a8
|
||||
#
|
||||
# The activations are int8 with a scale per row, not per 32-block (llama.cpp's q8_1): the w8a8
|
||||
# grid's quantiser is per row, the one the int4 container already reads. libr4d's other int8 grid,
|
||||
# i8a8, takes a scale per (row, 128) and is closer still to Q8_0 x Q8_1, but nothing in libr4d
|
||||
# fuses a norm into its quantiser yet, so it would cost five launches per junction at decode.
|
||||
#
|
||||
# The trunk's lm_head is int8 as well, as Q8_0 makes `output.weight`: logits_gemm_i8 reads it
|
||||
# against the bf16 hidden state (no activation quantiser), with a bf16 scale per row and 128
|
||||
# columns. It is the trunk's verifier, so drop the line to keep it bf16, at 352 MB per rank more
|
||||
# read each step. The embedding table stays bf16: it is read one row per token, and it is the
|
||||
# drafter's table too.
|
||||
#
|
||||
# ~33 GiB: the int8 trunk's linears (~28 GiB), the bf16 table and its int8 head (2 GiB), the
|
||||
# vision tower, the drafter (1.4 GiB) and its head's copy (0.7 GiB). At tp 4, ~8 GiB per rank on a
|
||||
# 32 GiB R9700.
|
||||
#
|
||||
# This starts from bf16 for the reason gemma4-31b-dense-bf16-w4a8-df.recipe gives: the drafter
|
||||
# reads the trunk's hidden states and was trained beside the bf16 trunk. q, k and v are one linear
|
||||
# (blk.*.attn_qkv), for the reason that recipe gives.
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
blk.*.attn_o.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -0,0 +1,60 @@
|
||||
# gemma4-31b-dense-bf16-w4a8-df.recipe -- Gemma 4 31B dense (text) from Google's bf16 checkpoint
|
||||
# at w4a8, as gemma4-31b-dense-bf16-w4a8.recipe makes it, with z-lab's DFlash drafter merged in
|
||||
# place of the assistant head.
|
||||
#
|
||||
# rad-convert <gemma-4-31B-it> --draft-model <gemma-4-31B-it-DFlash> \
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-w4a8-df.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-w4a8-df.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-w4a8-df.rad --num-speculative-tokens auto ...
|
||||
#
|
||||
# The drafter (z-lab/gemma-4-31B-it-DFlash) is five Qwen3-shaped layers of 5376 (64 heads / 8 kv
|
||||
# x 128, ffn 10752) and an fc over the trunk's residual stream at layers 1 12 23 35 46 57: 1.5 B
|
||||
# parameters, 3.1 GB at bf16. It denoises a block of 16 in one pass and proposes 15 tokens; z-lab
|
||||
# measures 4.2-8.6 accepted per step on B300 at bf16, against the assistant head's ~2. The plugin's
|
||||
# probe names that depth, so rad-convert declares at it and `--num-speculative-tokens auto` serves
|
||||
# it; any other depth is refused by name.
|
||||
#
|
||||
# This starts from bf16, not from the QAT release. The drafter reads the trunk's hidden states at
|
||||
# six layers and was trained beside the bf16 trunk, so the trunk that serves it should be as close
|
||||
# to that one as four bits allow: rule=search, as in the plain bf16 recipe, which measured the
|
||||
# assistant head accepting 0.71/0.62/0.63 of its k=3 drafts from this grid against 0.49/0.50/0.44
|
||||
# from the QAT one.
|
||||
#
|
||||
# The trunk's lm_head is int8, as keptn42's container has it: logits_gemm_i8 reads it against the
|
||||
# bf16 hidden state (no activation quantiser), with a bf16 scale per row and 128 columns. At tp 4 a
|
||||
# rank's slice of the 262144 x 5376 table is 704 MB in bf16, a sixth of everything a verify step
|
||||
# reads at int4, and 352 MB at int8. It is the trunk's verifier; drop the line to keep it bf16.
|
||||
#
|
||||
# ~20 GiB: the int4 trunk's linears (~14 GiB), the bf16 table and its int8 head (2 GiB), the
|
||||
# vision tower, the drafter at block fp8 (1.4 GiB) and its head's block-fp8 copy (0.7 GiB).
|
||||
#
|
||||
# q, k and v are one linear, blk.*.attn_qkv (q | k | v; q | k on the global layers, where v is
|
||||
# k): the plugin serves one GEMM a layer where three paid the skinny GEMM's fixed cost each. The
|
||||
# grid's groups never cross a row, so the codes are those of three separate rules (on the cards k
|
||||
# and v may round differently in the last bit: the GEMM's K split follows N). A container
|
||||
# converted before this, with the three apart, still serves.
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.attn_o.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
# The DFlash drafter's seven linears: block fp8, read at fp8a8 against an E4M3 activation (the
|
||||
# drafter only proposes; the trunk verifies). All seven take one grid, because one quantised
|
||||
# activation feeds several of them, and the plugin checks it.
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
|
||||
# draft head reads instead of the bf16 table. That halves the widest read on the draft path (704 MB
|
||||
# per rank at tp 4 in bf16), for half the table's bytes again. Drafts are verified, so this changes
|
||||
# what is proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
@@ -0,0 +1,46 @@
|
||||
# gemma4-31b-dense-bf16-w4a8-df2.recipe -- Gemma 4 31B dense (text) from Google's bf16 checkpoint
|
||||
# at w4a8, as gemma4-31b-dense-bf16-w4a8-df.recipe makes it, with RedHatAI's DFlash2 speculator
|
||||
# merged in place of z-lab's DFlash drafter.
|
||||
#
|
||||
# rad-convert <gemma-4-31B-it> --draft-model <gemma-4-31B-it-speculator.dflash2> \
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-w4a8-df2.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-w4a8-df2-qkv.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-w4a8-df2-qkv.rad --num-speculative-tokens auto ...
|
||||
#
|
||||
# The drafter (RedHatAI/gemma-4-31B-it-speculator.dflash2) is a speculators-format DFlash2: five
|
||||
# Qwen3-shaped layers at 5376 (32 heads / 16 kv x 256, MLP 21504), every one on a 2048-token
|
||||
# window, non-causal, an fc over the trunk's residual stream entering layers 1 17 29 47 59, a
|
||||
# grouped dynamic convolution around each sublayer and a candidate selector (rank 256, top-k 16):
|
||||
# 2.75 B parameters, 5.5 GB at bf16. It proposes 7 tokens a pass (block 8); the plugin's probe names
|
||||
# that depth, and rad_block_dflash2.h is the block.
|
||||
#
|
||||
# It ships no embedding or head: it reads the trunk's table, unscaled, and the trunk's head. The
|
||||
# trunk is the -df recipe's (int4 trunk, q|k|v as one linear, int8 lm_head), so the same rules.
|
||||
#
|
||||
# ~24 GiB: the -df recipe's trunk and table (~16 GiB), the vision tower, the drafter at block fp8
|
||||
# (2.6 GiB), its selector codebooks at bf16 (2 x 128 MiB) and its head's int8 copy (1.4 GiB).
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.attn_o.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
# The drafter's seven linears: block fp8, read at fp8a8 against an E4M3 activation, as the block
|
||||
# declares them (rad_fp8.h's DenseFP8). The convolution projections, the selector and the norms
|
||||
# stay bf16, as the block reads them.
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The draft head: the trunk's tied table under the block's own name, int8 with an f16 scale per
|
||||
# (row, 128 of K), which the block reads at w8a8 (rad_block_dflash2.h, head_i8). Not the 2-bit
|
||||
# grid the Qwen3.8 recipes use: the selector then ranks the candidates an 8-bit head proposes.
|
||||
# Drafts are verified, so this changes what is proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -0,0 +1,4 @@
|
||||
# Decode only the small combined MLA projection, which the absorbed attention reads in bf16.
|
||||
# Unmatched weights keep their stored encoding, including MXFP4 routed/shared experts
|
||||
# and the mixed FP8/BF16 trunk and MTP weights. Covers trunk and draft scope names.
|
||||
*attn_kv_b.weight cast dtype=bf16
|
||||
@@ -0,0 +1,23 @@
|
||||
# krea-2-bf16.recipe -- Krea 2 (Raw or Turbo) at bf16.
|
||||
#
|
||||
# rad-convert <Krea-2-Raw or -Turbo pipeline directory> --recipe data/recipes/krea-2-bf16.recipe \
|
||||
# -o krea-2-bf16.rad
|
||||
#
|
||||
# Every linear stays as the release holds it (bf16). The language model's layers past its last tap
|
||||
# (35 of 36) are not carried. The first matching rule decides.
|
||||
|
||||
# The release stores its norms, modulation tables, embedders, projector and output layer f32.
|
||||
# diffusers keeps every norm f32 and runs the rest bf16. Here the text fusion's norms, the q/k norms
|
||||
# and txt_in's norm stay f32; the DiT's norm1, norm2 and final norm are bf16, the fused modulation
|
||||
# kernel's operand, with the rest.
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,45 @@
|
||||
# krea-2-fp8-unscaled.recipe -- a Krea 2 finetune shipped as plain fp8 (every tensor E4M3 with no
|
||||
# scale, as ComfyUI's fp8 checkpoints and most civitai Krea 2 files store it), with block-scaled fp8
|
||||
# linears.
|
||||
#
|
||||
# rad-convert <pipeline directory: Krea-2-Turbo's (or -Raw's) model_index, scheduler, text encoder,
|
||||
# tokenizer and VAE, with the finetune's DiT as transformer/> \
|
||||
# --recipe data/recipes/krea-2-fp8-unscaled.recipe -o finetune-fp8.rad
|
||||
#
|
||||
# The DiT's and the text fusion's linears keep the checkpoint's codes: every value is already on the
|
||||
# E4M3 grid, so a block scale of exactly 1 (rule=fixed) holds each one as the code it was shipped
|
||||
# as, where an absmax scale would round it a second time. The text encoder is the release's bf16 and
|
||||
# is rounded as krea-2-fp8.recipe rounds it. The norms, tables and embedders the finetune stores as
|
||||
# E4M3 are widened exactly to the dtypes krea-2-fp8.recipe gives them. A Turbo finetune takes
|
||||
# Turbo's model_index.json (`is_distilled`: 8 steps, no guidance), a Raw one Raw's.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
|
||||
# The release stores its norms, modulation tables, embedders, projector and output layer f32.
|
||||
# diffusers keeps every norm f32 and runs the rest bf16. Here the text fusion's norms, the q/k norms
|
||||
# and txt_in's norm stay f32; the DiT's norm1, norm2 and final norm are bf16, the fused modulation
|
||||
# kernel's operand, with the rest.
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,41 @@
|
||||
# krea-2-fp8.recipe -- Krea 2 (Raw or Turbo) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <Krea-2-Raw or -Turbo pipeline directory> --recipe data/recipes/krea-2-fp8.recipe \
|
||||
# -o krea-2-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model, of the text fusion's blocks and of the DiT's
|
||||
# 28 blocks becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over
|
||||
# activations quantised the same way. What stays bf16 is read once a pass or less: the embedding
|
||||
# table, txt_in, img_in, the timestep MLP and modulation, the blocks' tables, the final layer and
|
||||
# the VAE. The language model's layers past its last tap (35 of 36) are not carried.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The release stores its norms, modulation tables, embedders, projector and output layer f32.
|
||||
# diffusers keeps every norm f32 and runs the rest bf16. Here the text fusion's norms, the q/k norms
|
||||
# and txt_in's norm stay f32; the DiT's norm1, norm2 and final norm are bf16, the fused modulation
|
||||
# kernel's operand, with the rest.
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,14 @@
|
||||
# ltx-2.5-bf16.recipe -- LTX-2.5 (the base or the distilled DiT) at the checkpoint's precision.
|
||||
#
|
||||
# rad-convert <LTX-2.5 diffusers pipeline directory> --recipe data/recipes/ltx-2.5-bf16.recipe \
|
||||
# -o ltx-2.5-bf16.rad
|
||||
#
|
||||
# The text encoder, the connectors, the DiT, both VAEs and the latent upsampler are kept bf16. The
|
||||
# vocoders run in f32 and a pipeline saved in bf16 holds them bf16, so they are cast here, once; the
|
||||
# spectrogram bases stay bf16.
|
||||
|
||||
voc.conv_* cast dtype=f32
|
||||
voc.upsamplers.* cast dtype=f32
|
||||
voc.resnets.* cast dtype=f32
|
||||
voc.act_out.* cast dtype=f32
|
||||
bwe.* cast dtype=f32
|
||||
@@ -0,0 +1,37 @@
|
||||
# ltx-2.5-fp8.recipe -- LTX-2.5 (the base or the distilled DiT) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <LTX-2.5 diffusers pipeline directory> --recipe data/recipes/ltx-2.5-fp8.recipe \
|
||||
# -o ltx-2.5-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder (Gemma 4), of the two connectors and of the DiT's 48 blocks
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way; the biases stay bf16 and are added after. What stays bf16 is small or
|
||||
# read once a step: the attention gates' logits, the q and k norms, the patch projections, the
|
||||
# timestep MLPs and the tables, the connectors' registers, both VAEs and the latent upsampler.
|
||||
# The vocoders are cast to f32, which their convolutions and anti-aliased activations run in
|
||||
# (a pipeline saved in bf16 holds them bf16); the spectrogram bases stay bf16.
|
||||
|
||||
te.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.proj.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.kv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.audio_ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.audio_ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
voc.conv_* cast dtype=f32
|
||||
voc.upsamplers.* cast dtype=f32
|
||||
voc.resnets.* cast dtype=f32
|
||||
voc.act_out.* cast dtype=f32
|
||||
bwe.* cast dtype=f32
|
||||
@@ -0,0 +1,41 @@
|
||||
# q38-27b-mxfp4-df2.recipe -- a bf16 Qwen3.8-27B (or a finetune of it) at MXFP4 with the DFlash2
|
||||
# drafter.
|
||||
#
|
||||
# rad-convert <bf16 Qwen3.8-27B checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-mxfp4-df2.recipe \
|
||||
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
|
||||
# -o q38-27b-mxfp4-df2.rad
|
||||
#
|
||||
# The --set keys give the container the family's fp8 descriptor, so qwen35_fp8 serves it as it
|
||||
# serves the Quark, ParoQuant and NVFP4 releases; without them a bf16 checkpoint selects
|
||||
# qwen35_bf16, which has no 4-bit GEMM.
|
||||
#
|
||||
# The trunk's linears are rounded to MXFP4 (`fp4_e2m1`, an e8m0 scale per 32 of K, the OCP exponent
|
||||
# rule) from the bf16 source, once: the encoding and kernels of q38-27b-quark-mxfp4-df2.recipe,
|
||||
# without Quark's AWQ fold. The delta net's a/b projections, the norms, the embedding and the
|
||||
# vision tower stay bf16; the head goes block fp8 as in the other 27B recipes. The checkpoint's MTP
|
||||
# head is not read: the DFlash2 drafter displaces it.
|
||||
#
|
||||
# The drafter as q38-27b-quark-mxfp4-df2.recipe makes it: its linears at MXFP4, and a 2-bit copy
|
||||
# of the target's head (u2 with a u8 zero, least-squares clip search) whose top 32 the engine
|
||||
# rescores against the target's fp8 head.
|
||||
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_qg.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_inz.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_out.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -0,0 +1,48 @@
|
||||
# q38-27b-w8a8-df2.recipe -- Qwen3.8-27B from its bf16 release with an int8 trunk rotated by a
|
||||
# 128-wide Hadamard, and the DFlash2 drafter, served by qwen35_w8a8.
|
||||
#
|
||||
# rad-convert <Qwen3.8-27B bf16 checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe data/recipes/q38-27b-w8a8-df2.recipe \
|
||||
# --set quantization_config.quant_method=w8a8 --set quantization_config.fmt=fwht128 \
|
||||
# -o q38-27b-w8a8-df2.rad
|
||||
#
|
||||
# The --set keys make the container's descriptor `w8a8_fwht128`, which selects qwen35_w8a8 (a bf16
|
||||
# checkpoint alone selects qwen35_bf16).
|
||||
#
|
||||
# - The trunk's linears (attention q/gate, k, v and output, the delta net's qkv/z and output, the
|
||||
# MLP's gate/up and down: the set Qwen's FP8 release quantises) as int8 with a bf16 scale per
|
||||
# (row, 128 of K), each 128 of K rotated by the unnormalised Hadamard before rounding and the
|
||||
# 1/128 kept in the scale (`transform=fwht128`). gemm_nt_q reads them at i8a8h, each linear
|
||||
# quantising its own input under the same rotation (had_quant_act_i8g). `clamp=sym` keeps the
|
||||
# codes in -127..127, the range the int8 kernels are written for. Weight error 6.3e-3 relative.
|
||||
# - The delta net's a/b projections, the norms, the embedding and the vision tower stay bf16, as
|
||||
# in Qwen's FP8 release.
|
||||
# - The lm_head int8 too, unrotated (logits_gemm_i8): weight error 6.8e-3 against block fp8's
|
||||
# 2.6e-2. Against the bf16 model over 45K mostly-Go positions it halves the container's mean KL
|
||||
# (0.00051 against 0.00090 with a block-fp8 head; Qwen's FP8 release 0.00404) and takes top-1
|
||||
# agreement from 98.83% to 99.25%. A block-fp8 head is one override away:
|
||||
# --quant 'output.weight=rtn:codes=fp8_e4m3,block=128x128,scale=bf16'
|
||||
#
|
||||
# The drafter as q38-27b-fp8-df2.recipe makes it: its linears at MXFP4, and a 2-bit copy of the
|
||||
# target's head (u2 with a u8 zero, least-squares clip search) whose top 32 the engine rescores
|
||||
# against the target's head.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_k.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_v.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_inz.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_out.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -0,0 +1,38 @@
|
||||
# sage-a1.5-fp8-df2.recipe -- Sage-A1.5 with incoai's Qwen3.6-35B-A3B DFlash2 drafter merged in
|
||||
# place of the MTP head. The trunk rules are sage-a1.5-fp8.recipe's unchanged; the drafter's
|
||||
# linears take the same 128x128 block form as the trunk, and its draft head is the target's
|
||||
# lm_head as the 2-bit copy the draft rounds read.
|
||||
#
|
||||
# rad-convert InternScience/Sage-A1.5-FP8 \
|
||||
# --draft-model incoai/Qwen3.6-35B-A3B-DFlash2 \
|
||||
# --recipe data/recipes/sage-a1.5-fp8-df2.recipe -o sage-a1.5-fp8-df2.rad
|
||||
#
|
||||
# The drafter is a DFlash2DraftModel: six Qwen3-shaped layers at 2048, eight taps
|
||||
# (target_layer_ids 1 6 11 16 22 27 32 37), block 8, selector rank 256 / top 16, vocab 248320.
|
||||
# Sage's text_config is Qwen3.6-35B-A3B's key for key, so the drafter's geometry matches the
|
||||
# trunk it was trained against. qwen35moe_fp8 (qwen35_fp8.cpp with QWEN35_MOE=1) declares it and
|
||||
# drops the MTP head, which is then neither declared nor carried.
|
||||
#
|
||||
# The drafter's norms, the selector's projection and codebooks, and the convolution kernels and
|
||||
# bases stay bf16/f32 as the checkpoint holds them.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -0,0 +1,39 @@
|
||||
# sage-a1.5-fp8.recipe -- Sage-A1.5, InternScience's post-train of Qwen3.5-35B-A3B-VL, as the
|
||||
# qwen35moe_fp8 plugin serves it (256 experts of 512, top 8, a routed MTP head, the Qwen3.5
|
||||
# vision tower).
|
||||
#
|
||||
# rad-convert InternScience/Sage-A1.5-FP8 --recipe data/recipes/sage-a1.5-fp8.recipe \
|
||||
# -o sage-a1.5-fp8.rad
|
||||
#
|
||||
# The published FP8 release is compressed-tensors with one scale an output row, and it leaves
|
||||
# the vision tower, the routers and the whole MTP head bf16. The engine's expert kernels read
|
||||
# block-scaled fp8 only (a scale a 128x128 block) and its plugin refuses bf16 experts, so this
|
||||
# re-expresses every linear into Qwen's own block form, the same weights in the same form as
|
||||
# qwen3.6-35b-a3b-fp8.rad. From the bf16 release instead, the same recipe applies and the format
|
||||
# has to be stated too:
|
||||
#
|
||||
# rad-convert InternScience/Sage-A1.5 --recipe data/recipes/sage-a1.5-fp8.recipe \
|
||||
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
|
||||
# --set "quantization_config.weight_block_size=128 128" \
|
||||
# --set quantization_config.activation_scheme=dynamic -o sage-a1.5-fp8.rad
|
||||
#
|
||||
# The linears -- attention q/gate, k, v and output, the delta net's qkv/z and output
|
||||
# projections, the routed and shared experts of all 40 blocks, and the MTP layer's, which the
|
||||
# blk.* patterns reach at its own index 40 -- as E4M3 with one bf16 scale a 128x128 block. The
|
||||
# lm_head likewise, and the MTP head's 2-bit copy of it, which the draft rounds read in place of
|
||||
# the full head. The routers, the shared-expert gates, the delta net's a/b projection, its conv
|
||||
# and decay parameters, the norms, the embedding and the vision tower stay as the checkpoint
|
||||
# holds them.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -0,0 +1,35 @@
|
||||
# sage-a1.5-mxfp4-df2.recipe -- Sage-A1.5 at MXFP4 with incoai's Qwen3.6-35B-A3B DFlash2 drafter
|
||||
# merged in place of the MTP head. The trunk and the drafter's linears are rounded to MXFP4
|
||||
# (`fp4_e2m1`, an e8m0 exponent per 32 of K, the OCP rule), everything else as the checkpoint holds
|
||||
# it. Trained from bf16 ideally: the source here is Sage-A1.5-FP8's per-row FP8 release, which
|
||||
# carries one rounding already, so this is a second quantisation of the same weights.
|
||||
#
|
||||
# rad-convert InternScience/Sage-A1.5-FP8 --draft-model incoai/Qwen3.6-35B-A3B-DFlash2 \
|
||||
# --recipe data/recipes/sage-a1.5-mxfp4-df2.recipe -o sage-a1.5-mxfp4-df2.rad
|
||||
#
|
||||
# The trunk's rule set is sage-a1.5-fp8.recipe's, with `codes=fp4_e2m1 group=32 scale=e8m0` in
|
||||
# place of block fp8 (the OCP rule needs no second level: `mx` is the default for e8m0). The
|
||||
# DFlash2 drafter uses the same rules as the trunk's linears, and its draft head stays the 2-bit
|
||||
# copy.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_inz.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_out.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down_exps.*.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -0,0 +1,9 @@
|
||||
# sdxl-bf16.recipe -- Stable Diffusion XL (and its finetunes: Illustrious, NoobAI, Pony, ...) at bf16.
|
||||
#
|
||||
# rad-convert <checkpoint>.safetensors --tokenizer <CLIP tokenizer.json> \
|
||||
# --recipe data/recipes/sdxl-bf16.recipe -o sdxl.rad
|
||||
#
|
||||
# A single-file SDXL checkpoint (Stability's layout) ships its weights f16, some finetunes partly
|
||||
# bf16 or f32; every weight the model reads is served bf16. The VAE's encoder, the text encoders'
|
||||
# unused tails and the checkpoint's bookkeeping tensors are not carried.
|
||||
* cast dtype=bf16
|
||||
@@ -0,0 +1,14 @@
|
||||
# translategemma-27b-i8a8.recipe -- TranslateGemma 27B (arch/gemma3) for calibration: every linear
|
||||
# int8 with a bf16 scale a 128 columns, served at i8a8 over an int8 activation scaled per (row, 128).
|
||||
# KL 0.003 against the bf16 model, and it fits two 32 GB cards with room for the tap's Grams.
|
||||
#
|
||||
# rad-convert <translategemma-27b-it> --recipe data/recipes/translategemma-27b-i8a8.recipe \
|
||||
# -o translategemma-27b-i8a8.rad
|
||||
|
||||
blk.*.attn_q.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
blk.*.attn_k.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
blk.*.attn_v.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
blk.*.attn_o.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
@@ -0,0 +1,25 @@
|
||||
# translategemma-27b-mxfp4-gptq-df2.recipe -- translategemma-27b-mxfp4-gptq.recipe with a DFlash2
|
||||
# drafter (rad-convert --draft-model). The drafter's linears are MXFP4 (read whole every draft pass;
|
||||
# drafts are verified, so this changes only what is proposed) and its head a 2-bit copy of the tied
|
||||
# embedding, rescored against output.weight, as q38-27b-quark-mxfp4-df2.recipe makes Qwen's.
|
||||
# `--reuse` of a container made by the recipe above copies its trunk.
|
||||
#
|
||||
# CALIB=<dir> rad-convert <translategemma-27b-it> --draft-model <drafter> \
|
||||
# --recipe data/recipes/translategemma-27b-mxfp4-gptq-df2.recipe -o translategemma-27b-mxfp4-gptq-df2.rad
|
||||
|
||||
blk.*.attn_q.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_k.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_v.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_o.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_down.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_gate_up.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -0,0 +1,16 @@
|
||||
# translategemma-27b-mxfp4-gptq.recipe -- TranslateGemma 27B (arch/gemma3): every linear MXFP4 by
|
||||
# GPTQ against the Grams a calibration run wrote (CALIB, see docs/ARCHITECTURES.md), served at
|
||||
# mxfp4a8 over an E4M3 activation scaled per (row, 128). The tied lm_head is int8 a 128 columns:
|
||||
# block fp8 cannot be split at --tp 2, where a rank holds 131104 vocabulary rows. Norms and the
|
||||
# embedding stay bf16. KL 0.042 against the bf16 model.
|
||||
#
|
||||
# CALIB=<dir> rad-convert <translategemma-27b-it> \
|
||||
# --recipe data/recipes/translategemma-27b-mxfp4-gptq.recipe -o translategemma-27b-mxfp4-gptq.rad
|
||||
|
||||
blk.*.attn_q.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_k.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_v.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_o.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_down.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_gate_up.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
@@ -0,0 +1,16 @@
|
||||
Qwen Community License 1.0
|
||||
|
||||
Copyright (c) 2026 Qwen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software, including the model weights, parameters, configuration files, inference code and associated documentation files (collectively, the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, sell, deploy, host, fine-tune, and create derivative works from (collectively, "Use" or "Using") copies of the Software; and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. If the Software (or any derivative works thereof) is Used for any of the licensee's commercial products or services that have more than 100,000,000 monthly active users or US$ 20,000,000 (or equivalent in other currencies) monthly revenue, respective model name must be prominently displayed on the user interface of such product or service; and,
|
||||
|
||||
2. If the licensee or any of its affiliates conducts a Model as a Service or AI Work Assistant business, the licensee shall obtain a separate license from Qwen before Using the Software or its derivative works for any commercial purpose. The foregoing requirement shall not apply to the licensee's internal Use of the Software, provided that such Use does not make the Software, its outputs, or its underlying model capabilities available to any third party.
|
||||
|
||||
"Model as a Service" means giving a third party access to language model inference or fine-tuning (e.g., via API or a hosted endpoint) in a manner that allows such third parties to exercise meaningful control over the inputs, parameters, or training data. This does not include the mere relaying of requests to models hosted by other third parties.
|
||||
“AI Work Assistant” means an independent AI-powered product primarily designed for AI-assisted coding or office productivity (e.g., Qoder and QwenWork). It does not include: (a) a single-purpose AI tool (such as an AI translation tool); (b) an AI assistant primarily designed for a domain other than coding or office productivity (such as Taobao AI Shopping Assistant or AMap AI Chat); or (c) an AI assistant that is a feature of a product whose primary purpose is not AI-assisted coding or office productivity.
|
||||
|
||||
THE SOFTWARE AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL QWEN, ITS AFFILIATES OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE USE OF THE SOFTWARE MUST COMPLY WITH APPLICABLE LAWS AND REGULATIONS, AND MUST NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY.
|
||||
|
||||
For any questions regarding this license, please contact model-business@notice.qwencloud.com.
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"mode": "project",
|
||||
"dir": "per-layer",
|
||||
"scale": 1.0,
|
||||
"layer_range": [
|
||||
4,
|
||||
44
|
||||
],
|
||||
"refusal_harmful_thinkoff": 2.0,
|
||||
"refusal_harmful_thinkon": 2.0,
|
||||
"refusal_harmless_thinkoff": 4.0,
|
||||
"refusal_harmless_thinkon": 6.0,
|
||||
"broken": 0,
|
||||
"kl_mean": 0.18598,
|
||||
"kl_max": 18.26549,
|
||||
"kl_p99": 3.143571,
|
||||
"decode_tps": 51.19,
|
||||
"vector_file": "Qwen3.8-Flash-Next-refusal-projection.gguf",
|
||||
"base_model_gguf": "unsloth/Qwen3.8-Flash-Next-GGUF UD-Q2_K_XL",
|
||||
"base_model_sha256_shard1": "a4f3b21e77353999829f2f767e9ac21ce9c71d29a74f2cc9eda48c9bf23c8b86",
|
||||
"worktree_commit": "37e026e3b",
|
||||
"criterion_status": "PASS",
|
||||
"dirty_direction": false,
|
||||
"note": "projection ablation h -= s*(h.v)*v, v unit-normalized per layer. dir=per-layer",
|
||||
"branch": "cvec-hooks (github.com/Cudila/llama.cpp)"
|
||||
}
|
||||
Reference in new issue
Block a user