# krea-2-fp8.recipe -- Krea 2 (Raw or Turbo) with block-scaled fp8 linears. # # rad-convert --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