Juggernaut Z for ZiT
Details
Download Files (1)
About this version
Model description
Rank 128 LoRA extraction of https://civitai.red/models/2600510/juggernaut-z againt Z-Image-Base in order to be able to use it with Z-Image-Turbo. Mainly done because my setup (sd.cpp) don't work with quantized version of ZiB and derivatives đ
All showcases pictures are using Euler+Smoothstep (~Beta), 8 steps, CFG 1, Flow shift 3, with a Q4_K quantized version of both ZiT and Qwen3-4B and were made on a GTX 1060 (6GB VRAM) using Stable-diffusion.cpp.
Full ownership of this LoRA stays with https://civitai.red/user/KandooAI, merge are forbidden, this is for your personal use with ZiT on-site or locally only.
The extraction was done using this script adapted to be able to handle ANY model as long as they have the same keys (which means i had to re-key Juggernaut Z to unfuse the qkv layers).
import sys, reVery basic args check
if len(sys.argv) < 4: print(fâUsage: {sys.argv[0]} origin.safetensors tuned.safetensors lora.safetensorsâ) exit(1)
Importing the libs
from safetensors.torch import load_file, save_file import torch from tqdm import tqdm
No gradient needed
torch.set_grad_enabled(False)
The most BASIC svd extraction of lora weight
def extract_lora_weight(m, r): u, s, vh = torch.linalg.svd(m.cuda()) B = u[:, :r] @ torch.diag(s[:r]) A = vh[:r, :] return (B.cpu().contiguous(), A.cpu().contiguous())
Load models
print(fâLoading {sys.argv[1]}âŠâ) orig = load_file(sys.argv[1]) print(fâLoading {sys.argv[2]}âŠâ) tune = load_file(sys.argv[2])
wk = list(set(orig) & set(tune))
Get ready
lora = {} rank = 128 count = 0
Extract LoRA
print(âExtractingâŠâ) for k in tqdm(wk): diff = tune[k].to(dtype=torch.float) - orig[k].to(dtype=torch.float) if torch.mean(torch.abs(diff)) < 0.0001 or len(diff.shape) not in [1,2]: # Either not the right shape or not enough difference, letâs skip it del diff continue if len(diff.shape) == 1: count +=1 if k.endswith(â.biasâ): lora[k.replace(â.biasâ, â.diff_bâ)] = diff.to(dtype=torch.bfloat16) else: lora[k.replace(â.weightâ, â.diffâ)] = diff.to(dtype=torch.bfloat16) del diff else: if diff.shape[0] <= rank or diff.shape[1] <= rank: # Too small, letâs skip it for now del diff continue count +=1 B, A = extract_lora_weight(diff, rank) del diff base_key = k.replace(â.weightâ, ââ) lora[fâ{base_key}.lora_B.weightâ] = B.to(dtype=torch.bfloat16) lora[fâ{base_key}.lora_A.weightâ] = A.to(dtype=torch.bfloat16)
Save LoRA
print(fâStored {count}/{len(wk)} keys to LoRA.â) print(fâSaving {sys.argv[3]} âŠâ) save_file(lora, sys.argv[3]) print(âDone!â) exit(0)




















