CivitAI removed enum validation from /api/v1/models?baseModels=X (now
returns 200 with empty items on unknown values), which left the
base-model filter dropdown empty. Fix in two parts.
1. Point the base_models discovery probe at /images instead of /models.
/images still returns a ZodError with the full enum list (82 names
at time of writing). The existing parser handles the shape unchanged.
2. Also fetch civitai/civitai's base-model.constants.ts from GitHub and
merge per-name metadata (group, ecosystem, engine, family, hidden)
into a new base_models_info field on the response. The live probe
remains authoritative for which names exist; GitHub provides the
metadata and doubles as a fallback name list if the probe comes back
empty.
Backward compatible: the existing base_models list keeps the same
shape. Clients that want grouped dropdowns, hidden-flag filtering, or
image/video separation can consume base_models_info instead.
The GitHub fetch has a separate 6h cache since these constants change
much less often than the probes it sits alongside.
Add three adapter families to the z-image native loader and chain them
with the existing lora path through load_safetensors. Mixed-family
files (for example gta6_amateur_photography_zimagebase_v2.safetensors,
which carries lora and lokr groups in the same file) now load
completely instead of having one family silently dropped.
Shared helpers in pipelines/z_image/zimage_lora.py parse keys by
suffix list, rename legacy attention.out and attention.wo to
attention.to_out.0, and split fused attention.qkv into to_q/k/v. For
lora the split chunks the up weight along dim 0. For lokr the split
emits three NetworkModuleLokrChunk entries that share the tensors and
slice the kronecker product at apply time.
Fused attention.qkv for loha and oft is skipped with a warning. No
NetworkModuleHadaChunk exists, oft rotations are tied to out_features
and cannot be cleanly split across q/k/v, and no real z-image adapter
in that layout exists today.
load_safetensors for zimage chains try_load_lora, try_load_lokr,
try_load_loha and try_load_oft and merges their module dicts into a
single Network so mixed files load every module.
Add zimage to allow_native so lora_force_diffusers picks between
native and diffusers. Before this, zimage always took the diffusers
path regardless of the setting.
pipelines/z_image/zimage_lora.py reads the safetensors and writes
directly into network_layer_mapping, so Z-Image LoRAs no longer go
through the diffusers PEFT converter that raised KeyError on
state dicts with partial alpha keys.
Key formats handled: ai-toolkit, kohya lora_unet_, bare transformer.
and no-prefix. Pre-refactor fused attention.qkv is split into
to_q/k/v; attention.out and attention.wo are renamed to
attention.to_out.0. Alpha and dora_scale are preserved.
upstream UniPCMultistepScheduler.set_timesteps unconditionally moves self.sigmas to CPU after building them. multistep_uni_p_bh_update / multistep_uni_c_bh_update then constructs a torch.ones(..., device=sample.device) tensor and calls torch.stack([..., self.sigmas[...]]) — crashing at inference step >= 2 whenever the model runs on a non-CPU device (CUDA, ROCm, MPS).
Monkey-patch set_timesteps so that, after the upstream call, self.sigmas is moved back to the requested device. Applied once at import time inside the existing sampler-load try/except block so failures are silent-logged and never break the rest of the sampler registry.
Civitai stopped validating baseModels on /api/v1/models (returns 200 with
empty items on unknown values), which left API clients without a way to
discover the values. Right now /images still does, I will get a separate
PR to put something more robust in place.