Rank 128 LoRA extraction of https://civarchive.com/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://civarchive.com/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, re
# Very 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)Description
Use and upload of this model are following the source model authorization model. Merge or commercial use of this LoRA is forbidden, for commercial use of Juggernaut Z please contact original author.
FAQ
Comments (3)
The original model is Apache 2.0... so why do you state that 'merge are forbidden'?
"Under the Apache license, users are permitted to modify, distribute, and sublicense the original open source code. Commercial use, warranties, and patent claims are also allowed with the Apache license."
I disallow merge of my own derivative work because Juggernaut Z has a commercial usage plan and using this LoRA for merge could potentially circumvent discussion with the original author. If you want to merge, either generate yourself the LoRA or use original checkpoint (which allow merge), this way, it put me out of the equation.
@n_Arno
1. I don't need your LoRA. I already merged Juggernaut Z into ZiT in my PsychoMix ZiT 1.2 (and subsequently 3.0) model using a different method.
2. I believe there might be a misunderstanding regarding how the licenses work here. If Juggernaut Z was released under the Apache 2.0 license, anyone is explicitly granted the irrevocable right to modify, distribute, and create derivative works—including commercial use—without needing to consult the original author.
An extracted LoRA is structurally a derivative work of that base model. Under Section 4 of the Apache 2.0 license, while a creator can claim authorship over their specific modifications, any distribution of those modifications must still comply with the conditions of the overall license. Forbidding merges directly violates Section 2 of the Apache 2.0 license, which guarantees downstream users an irrevocable right to modify and prepare derivative works. You cannot inherit the massive freedoms of an Apache 2.0 model to extract a LoRA, and then strip those exact same freedoms away from the community.
Furthermore, merging is a mathematical operation done locally on a user's machine. Open-source licenses only regulate distribution, not local use, so a "merge forbidden" clause isn't something that can actually be enforced.
Under the Apache 2.0 terms of the base model, downstream users have the right to modify, merge, and make derivative works from the files.
Looks like we don't have an active mirror for this file right now.
CivArchive is a community-maintained index — we catalog mirrors that volunteers upload to HuggingFace, torrents, and other public hosts. Looks like no one has uploaded a copy of this file yet.
Some files do get recovered over time through contributions. If you're looking for this one, feel free to ask in Discord, or help preserve it if you have a copy.