Bad keys in Anima finetune output model
Author: zyklone4096Created Jul 30, 2026Updated Jul 30, 2026
I'm not sure if this is caused by sd-scripts or the GUI, or issues with my config.
Config/root/kohya_ss/.venv/bin/accelerate launch --dynamo_backend inductor --dynamo_mode max-autotune --dynamo_use_dynamic --mixed_precision bf16 --num_processes 1 --num_machines 1 --num_cpu_threads_per_process 2 /root/kohya_ss/sd-scripts/anima_train.py --config_file /root/autodl-tmp/models/config_finetune-20260730-122723.toml
attn_mode = "flash"
blocks_to_swap = 0
bucket_reso_steps = 128
cache_latents = true
cache_latents_to_disk = true
caption_dropout_every_n_epochs = 0
caption_dropout_rate = 0
caption_extension = ".txt"
dataset_repeats = 1
discrete_flow_shift = 1.0
dynamo_backend = "inductor"
enable_bucket = true
gradient_accumulation_steps = 1
gradient_checkpointing = true
huber_c = 0.1
huber_scale = 1
huber_schedule = "snr"
in_json = "//root/autodl-tmp/meta_cap.json"
keep_tokens = 0
learning_rate = 6e-6
learning_rate_te = 6e-6
log_with = "tensorboard"
logging_dir = "/root/tf-logs"
loss_type = "l2"
lr_scheduler = "cosine"
lr_scheduler_args = []
lr_warmup_steps = 0
max_bucket_reso = 2048
max_data_loader_n_workers = 0
max_timestep = 1000
max_train_steps = 6884
min_bucket_reso = 1024
mixed_precision = "bf16"
multires_noise_discount = 0.3
noise_offset_type = "Original"
optimizer_args = []
optimizer_type = "PagedAdamW8bit"
output_dir = "/root/autodl-tmp/models"
output_name = "trained"
persistent_data_loader_workers = 0
pretrained_model_name_or_path = "/root/autodl-tmp/anima-base-v1.0.safetensors"
qwen3 = "/root/autodl-tmp/qwen_3_06b_base.safetensors"
qwen3_max_token_length = 512
qwen_image_vae_2d = true
resolution = "1536,1536"
sample_prompts = "/root/autodl-tmp/models/sample/prompt.txt"
sample_sampler = "euler_a"
save_every_n_epochs = 4
save_model_as = "safetensors"
save_precision = "fp16"
sdpa = true
shuffle_caption = true
sigmoid_scale = 1.0
t5_max_token_length = 512
timestep_sampling = "sigmoid"
torch_compile = true
train_batch_size = 10
train_data_dir = "/root/autodl-tmp/data"
train_text_encoder = true
vae = "/root/autodl-tmp/qwen_image_vae.safetensors"First 50 keys in a working model:
net.blocks.0.adaln_modulation_cross_attn.1.weight
net.blocks.0.adaln_modulation_cross_attn.2.weight
net.blocks.0.adaln_modulation_mlp.1.weight
net.blocks.0.adaln_modulation_mlp.2.weight
net.blocks.0.adaln_modulation_self_attn.1.weight
net.blocks.0.adaln_modulation_self_attn.2.weight
net.blocks.0.cross_attn.k_norm.weight
net.blocks.0.cross_attn.k_proj.weight
net.blocks.0.cross_attn.output_proj.weight
net.blocks.0.cross_attn.q_norm.weight
net.blocks.0.cross_attn.q_proj.weight
net.blocks.0.cross_attn.v_proj.weight
net.blocks.0.mlp.layer1.weight
net.blocks.0.mlp.layer2.weight
net.blocks.0.self_attn.k_norm.weight
net.blocks.0.self_attn.k_proj.weight
net.blocks.0.self_attn.output_proj.weight
net.blocks.0.self_attn.q_norm.weight
net.blocks.0.self_attn.q_proj.weight
net.blocks.0.self_attn.v_proj.weight
net.blocks.1.adaln_modulation_cross_attn.1.weight
net.blocks.1.adaln_modulation_cross_attn.2.weight
net.blocks.1.adaln_modulation_mlp.1.weight
net.blocks.1.adaln_modulation_mlp.2.weight
net.blocks.1.adaln_modulation_self_attn.1.weight
net.blocks.1.adaln_modulation_self_attn.2.weight
net.blocks.1.cross_attn.k_norm.weight
net.blocks.1.cross_attn.k_proj.weight
net.blocks.1.cross_attn.output_proj.weight
net.blocks.1.cross_attn.q_norm.weight
net.blocks.1.cross_attn.q_proj.weight
net.blocks.1.cross_attn.v_proj.weight
net.blocks.1.mlp.layer1.weight
net.blocks.1.mlp.layer2.weight
net.blocks.1.self_attn.k_norm.weight
net.blocks.1.self_attn.k_proj.weight
net.blocks.1.self_attn.output_proj.weight
net.blocks.1.self_attn.q_norm.weight
net.blocks.1.self_attn.q_proj.weight
net.blocks.1.self_attn.v_proj.weight
net.blocks.10.adaln_modulation_cross_attn.1.weight
net.blocks.10.adaln_modulation_cross_attn.2.weight
net.blocks.10.adaln_modulation_mlp.1.weight
net.blocks.10.adaln_modulation_mlp.2.weight
net.blocks.10.adaln_modulation_self_attn.1.weight
net.blocks.10.adaln_modulation_self_attn.2.weight
net.blocks.10.cross_attn.k_norm.weight
net.blocks.10.cross_attn.k_proj.weight
net.blocks.10.cross_attn.output_proj.weight
net.blocks.10.cross_attn.q_norm.weightIn output model:
net._orig_mod.blocks.0.adaln_modulation_cross_attn.1.weight
net._orig_mod.blocks.0.adaln_modulation_cross_attn.2.weight
net._orig_mod.blocks.0.adaln_modulation_mlp.1.weight
net._orig_mod.blocks.0.adaln_modulation_mlp.2.weight
net._orig_mod.blocks.0.adaln_modulation_self_attn.1.weight
net._orig_mod.blocks.0.adaln_modulation_self_attn.2.weight
net._orig_mod.blocks.0.cross_attn.k_norm.weight
net._orig_mod.blocks.0.cross_attn.k_proj.weight
net._orig_mod.blocks.0.cross_attn.output_proj.weight
net._orig_mod.blocks.0.cross_attn.q_norm.weight
net._orig_mod.blocks.0.cross_attn.q_proj.weight
net._orig_mod.blocks.0.cross_attn.v_proj.weight
net._orig_mod.blocks.0.mlp.layer1.weight
net._orig_mod.blocks.0.mlp.layer2.weight
net._orig_mod.blocks.0.self_attn.k_norm.weight
net._orig_mod.blocks.0.self_attn.k_proj.weight
net._orig_mod.blocks.0.self_attn.output_proj.weight
net._orig_mod.blocks.0.self_attn.q_norm.weight
net._orig_mod.blocks.0.self_attn.q_proj.weight
net._orig_mod.blocks.0.self_attn.v_proj.weight
net._orig_mod.blocks.1.adaln_modulation_cross_attn.1.weight
net._orig_mod.blocks.1.adaln_modulation_cross_attn.2.weight
net._orig_mod.blocks.1.adaln_modulation_mlp.1.weight
net._orig_mod.blocks.1.adaln_modulation_mlp.2.weight
net._orig_mod.blocks.1.adaln_modulation_self_attn.1.weight
net._orig_mod.blocks.1.adaln_modulation_self_attn.2.weight
net._orig_mod.blocks.1.cross_attn.k_norm.weight
net._orig_mod.blocks.1.cross_attn.k_proj.weight
net._orig_mod.blocks.1.cross_attn.output_proj.weight
net._orig_mod.blocks.1.cross_attn.q_norm.weight
net._orig_mod.blocks.1.cross_attn.q_proj.weight
net._orig_mod.blocks.1.cross_attn.v_proj.weight
net._orig_mod.blocks.1.mlp.layer1.weight
net._orig_mod.blocks.1.mlp.layer2.weight
net._orig_mod.blocks.1.self_attn.k_norm.weight
net._orig_mod.blocks.1.self_attn.k_proj.weight
net._orig_mod.blocks.1.self_attn.output_proj.weight
net._orig_mod.blocks.1.self_attn.q_norm.weight
net._orig_mod.blocks.1.self_attn.q_proj.weight
net._orig_mod.blocks.1.self_attn.v_proj.weight
net._orig_mod.blocks.10.adaln_modulation_cross_attn.1.weight
net._orig_mod.blocks.10.adaln_modulation_cross_attn.2.weight
net._orig_mod.blocks.10.adaln_modulation_mlp.1.weight
net._orig_mod.blocks.10.adaln_modulation_mlp.2.weight
net._orig_mod.blocks.10.adaln_modulation_self_attn.1.weight
net._orig_mod.blocks.10.adaln_modulation_self_attn.2.weight
net._orig_mod.blocks.10.cross_attn.k_norm.weight
net._orig_mod.blocks.10.cross_attn.k_proj.weight
net._orig_mod.blocks.10.cross_attn.output_proj.weight
net._orig_mod.blocks.10.cross_attn.q_norm.weightThe output model cannot be loaded with sd-scripts-webui (neo branch), but working after fix with this script
from safetensors.torch import load_file, save_file
from safetensors import safe_open
src = "SRC"
dst = "DEST"
with safe_open(src, framework="pt", device="cpu") as f:
meta = f.metadata() or {}
sd = load_file(src, device="cpu")
fixed = {}
renamed = 0
for k, v in sd.items():
if k.startswith("net._orig_mod."):
nk = "net." + k[len("net._orig_mod."):]
renamed += 1
else:
nk = k
if nk in fixed:
raise RuntimeError(f"duplicate key after rename: {nk}")
fixed[nk] = v
save_file(fixed, dst, metadata=meta)
print("saved:", dst)
print("renamed keys:", renamed)
print("total keys:", len(fixed))Source: bmaltais/kohya_ss