Commit Graph

75 Commits

Author SHA1 Message Date
CalamitousFelicitousness 77913c7c0a docs: cleanup
- generic.load_transformer: shorter dispatch description, no internal taxonomy
- native_transformer.load: trim kwargs forwarding wording
- sd_unet revert: one-line comment
- test: shorten kwargs-forwarding docstrings
2026-05-31 02:04:56 +01:00
CalamitousFelicitousness 18656d1d79 fix(native_transformer): forward load kwargs to from_config
load_transformer threads **kwargs into its from_pretrained and from_single_file branches. The native dispatch branch bypasses both loaders and builds via cls.from_config, so those kwargs were dropped there. Thread them through load, build_component, and build_component_quantized into from_config so callers passing extra args alongside native_spec are honored instead of silently dropped. Siblings do not receive them.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 55db15c213 docs: cleanup 2026-05-31 00:24:33 +01:00
CalamitousFelicitousness cec6d0dce5 refactor(anima): port anima_transformer to native_transformer
217-line bespoke loader collapses to a 40-line ANIMA_SPEC in
pipelines/anima/__init__.py (Cosmos converter + llm_adapter sibling +
Cosmos 1.0 forbidden marker).

Drop the class-keyed REGISTRY: Anima and raw Cosmos share
CosmosTransformer3DModel but need different specs. Specs pass via
explicit native_spec= kwarg; make_default_spec(cls) covers the
auto-converter case.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 08ad6196d0 feat(pipelines): add native_transformer for single-file DiT loading
Read .safetensors, strip prefix, partition siblings, run optional
converter, from_config + load_state_dict + validate, dtype/quant/offload.
Per-arch knobs via TransformerSpec(cls, subfolder, prefixes, converter,
siblings, acceptable_missing, forbidden_markers). SiblingSpec covers
bundled components like Anima's llm_adapter. 36 offline tests.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 5b321d2071 refactor(lora): update importers for native_adapter rename
5 pipeline files + 2 test files. Mechanical substitution. 141/141
adapter tests pass.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 84683a1d84 refactor(anima): migrate to generic native_loader
Replaces anima_lora.py's bespoke try_load_lora / group_keys /
resolve_network_key with thin wrappers binding native_loader's generics
to anima's prefix tuples and resolve_targets, mirroring flux2 / zimage /
chroma / ernie. The hand-rolled apply_lora_alphas bake-with-balance
pass goes away; alpha / scale / dora_scale flow through NetworkWeights.w
to NetworkModule.calc_scale at apply time.

native_loader gains an optional network_prefix kwarg (str or
Callable[[prefix_used], str], default "lora_transformer_") used when
constructing network_key. Anima passes a callable picking
lora_transformer_ / lora_llm_adapter_ / lora_te_ per matched prefix.
Single-component siblings keep the default and are unchanged.

network.NetworkModule.apply_weight_decompose grows a dual-path DoRA
convention detector. The pre-fix implementation only handled per-input
dora_scale (DoRA paper / kohya, shape (1, in)), silently broadcasting
per-output LyCORIS / PEFT dora_scale (shape (out, 1)) into an incoherent
element-wise rescaling. Detection is structural: (out, 1, ...) routes
to per-output; everything else (including the square-weight 1D ambiguity)
defaults to per-input for legacy compat. Pre-existing bug surfaced by
the LoKR+DoRA LyCORIS files Anima now loads.

Behavior changes:

- LoHA via the generic try_load_loha (NetworkModuleHada); covers
  scenery-anima-base and any other LyCORIS .hada_w* export.
- Kohya lora_te_ prefix recognized. The legacy resolver only matched
  BFL text_encoders.qwen3_06b.transformer.model. and silently dropped
  lora_te_layers_N_* keys (41% of BlueArcStyle's bases were unloaded).
- LoKR+DoRA LyCORIS files now apply correctly; the per-output dora_scale
  is honored instead of silently scrambled.

Adds test/test-anima-native-adapters.py: 37 offline tests across all
five prefixes (LoRA + LoHA), every COSMOS_2_FLAT_RENAME entry, DoRA
threading, marker disambiguation, try_load_chain dispatch, calc_updown
sanity, and both DoRA conventions (per-input / per-output / 1D ambiguous).
Adapter mock mirrors AnimaLLMAdapter's real module tree.
2026-05-22 00:22:32 +01:00
Vladimir Mandic 1e47ade7ee Merge pull request #4861 from vladmandic/refactor/native-loader
Refactor/native loader
2026-05-21 08:57:33 +02:00
Vladimir Mandic 4b2f38ab7f complete refactor javascript to typescript and reorg frontend files and folders
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-20 18:08:10 +02:00
Vladimir Mandic a56d1d299e add wildcards to image metadata and note separate template from prompt field
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-19 09:45:20 +02:00
CalamitousFelicitousness 6937ea803f refactor(ernie): migrate to generic native_loader
Replaces ernie's four family loaders with thin wrappers binding
native_loader's generics to ernie's prefix tuples and resolve_targets.

ErnieImageAttention has fully split to_q / to_k / to_v with no fused QKV
and ErnieImageFeedForward has three separate Linear modules, so
resolve_targets is a straight passthrough across every recognized prefix.

BARE_DIFFUSERS_PREFIXES covers layers., adaLN_modulation., final_norm.,
final_linear. for bare-diffusers exports (e.g. via save_lora_adapter).

parse_key returns (prefix_used, base, suffix) instead of the old
(network_key, suffix); parse test updated.
2026-05-18 23:34:41 +01:00
CalamitousFelicitousness e45c23c031 refactor(chroma): migrate to generic native_loader
Replaces chroma's four family loaders with thin wrappers binding
native_loader's generics to chroma's prefix tuples and resolve_targets.

resolve_targets folds the Flux-to-diffusers rename table and the two
fused-weight splits into one path-resolution step:

- img_attn.qkv / txt_attn.qkv: ChunkSpec(idx, total=3) for equal Q/K/V
- single_blocks.linear1: ChunkSpec(start, end) for the unequal
  Q/K/V/proj_mlp partition

QKV_DIMS and LINEAR1_DIMS stay as module-level constants (tests patch
them for the scaled-down mock).

Behavior changes:

- LoKR on equal-chunk QKV now dispatches to NetworkModuleLokrChunk
  instead of NetworkModuleLokrSliceChunk (the slice variant was used
  pre-migration for both forms since chroma had no equal-chunk path).
- LoHA on fused img_attn.qkv now binds via NetworkModuleHadaChunk
  instead of being skipped; the shared HadaChunk added in the flux2 PR
  is general for equal-chunks dispatch.

parse_key returns (prefix_used, base, suffix) instead of the old
(flat_key, suffix); rename happens in resolve_targets. test_static_rename_table
replaced with test_resolve_targets_static_renames driving the same
remappings through the new interface.
2026-05-18 23:31:17 +01:00
CalamitousFelicitousness c3b7379fd3 refactor(zimage): migrate to generic native_loader
Replaces zimage's four family loaders with thin wrappers binding
native_loader's generics to z-image's prefix tuples and resolve_targets.

resolve_targets folds the legacy attention.qkv split and attention.out
alias rename into the path-resolution step. Fused qkv now emits three
ChunkSpec(idx, total=3) entries; attention.out / attention.out.0 /
attention.wo aliases collapse to attention.to_out.0.

BARE_DIFFUSERS_PREFIXES allows bare paths starting with layers. /
noise_refiner. / context_refiner. to pass through to the loader. This
matches real Z-Image LoRAs exported via
ZImageTransformer2DModel.save_lora_adapter().

LoHA on fused qkv now binds via NetworkModuleHadaChunk (added to shared
infra by the flux2 PR) instead of being skipped. Test renamed to
test_loha_legacy_fused_qkv_chunked.

parse_key returns (prefix_used, base, suffix) instead of the old
(network_key, suffix); parse test updated.
2026-05-18 23:20:03 +01:00
CalamitousFelicitousness c7e8e7a029 test(ernie): offline tests for native adapter loaders
Covers ernie's four-family surface (LoRA, LoKR, LoHA, OFT).

ErnieImageAttention has fully split to_q / to_k / to_v with no fused QKV,
and ErnieImageFeedForward has three separate Linear modules. The loader
has no chunking, renames, or fused-target dispatch.

Mock matches diffusers.ErnieImageTransformer2DModel
(ErnieImageSharedAdaLNBlock with self_attention + mlp + RMSNorms, plus
module-level adaLN_modulation Sequential and final_linear).

Formats exercised:

- BFL / AI-toolkit
- kohya
- BFL LoKR
2026-05-18 23:19:46 +01:00
CalamitousFelicitousness 1f309fe836 test(chroma): offline tests for native adapter loaders
Covers chroma's four-family surface plus the Flux-to-diffusers rename
and the unique single-block linear1 unequal-chunk slicing.

Mock transformer matches diffusers.ChromaTransformer2DModel
(transformer_blocks with FluxAttention(added_kv_proj_dim), single
transformer_blocks with pre-only attn + proj_mlp + proj_out, plus
distilled_guidance_layer).

Formats exercised:

- BFL / AI-toolkit
- kohya
- PEFT
- LyCORIS oft_diag

install_mock_pipe patches chroma_lora.QKV_DIMS and LINEAR1_DIMS to the
test scale (HIDDEN=96, MLP_HIDDEN=384); the module otherwise hardcodes
Chroma1-HD's 3072 / 12288.
2026-05-18 23:19:35 +01:00
CalamitousFelicitousness 409a30f9e0 test(zimage): offline tests for native adapter loaders
Covers z-image's four-family surface (LoRA, LoKR, LoHA, OFT). Mock
transformer matches diffusers.ZImageTransformer2DModel (layers,
noise_refiner, context_refiner).

Formats exercised:

- BFL / AI-toolkit
- PEFT
- kohya
- Legacy fused attention.qkv (split by expand_legacy_attention_*)

Covers parse primitives, all four loader entry points, DoRA threading,
calc_updown shape sanity per family.
2026-05-18 23:19:13 +01:00
CalamitousFelicitousness 5ff32038f1 refactor(flux2): migrate to generic native_loader
Replaces flux2's eight family loaders with thin wrappers binding
native_loader's generics to flux2's prefix tuples and resolve_targets.

Constants and helpers (has_marker, parse_key, group_by_suffixes) are
re-exported from native_loader so the offline tests address them through
flux2_lora's surface unchanged.

resolve_targets now returns (diffusers_path, ChunkSpec | None) tuples
instead of (path, idx, num_chunks). Three parse-level tests updated.

PEFT-fallback path (apply_lora_alphas, preprocess_f2_keys, apply_patch)
stays in flux2_lora.
2026-05-18 23:19:03 +01:00
Vladimir Mandic feeafc6286 strict ruff without exclude
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-11 08:36:49 +02:00
Vladimir Mandic c8d6fd5cf8 Revert "much stricter ruff linting"
This reverts commit 310dbf1574.
2026-05-11 08:13:57 +02:00
Vladimir Mandic 310dbf1574 much stricter ruff linting
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-11 07:15:37 +02:00
CalamitousFelicitousness 7214f677f2 test(flux2): canonical offline tests for native adapter loaders
36 tests across parsing primitives, family loaders, calc_updown shape
sanity, and the lora_apply ex_bias accumulation path. Builds a mock
Flux2-shaped transformer (HIDDEN=128, 2 double + 2 single blocks) and
writes synthesized state dicts to tempfile-managed safetensors so the
loaders' real read_state_dict path runs.

Loader fixtures include the full nine-family menu plus four prefix
variants (kohya, BFL/AI-toolkit, PEFT, bare-BFL) and the two real
ground-truth formats observed on Hugging Face: base_model.model.
(peft.save_pretrained wrapper) and lycoris_ (LyCORIS-standalone).
2026-05-10 00:05:37 +01:00
vladmandic ba1f207cc6 update changelog and submodules
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-21 19:24:24 +02:00
vladmandic c69b3935e2 update skills and wiki
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-18 19:33:51 +02:00
CalamitousFelicitousness 13fcbd1112 update anima reference model to preview 3
- replace preview 1 and preview 2 entries with single preview 3 entry
- add preview 3 reference image
- update test image reference
2026-04-09 02:44:05 +01:00
vladmandic 4c5454d54a improve select_from_weighted_list
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-06 07:57:04 +02:00
vladmandic df50c4c969 fix prompt weighted lists
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-05 21:29:18 +02:00
vladmandic 1310264d43 regen all localizations
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-01 10:29:08 +02:00
vladmandic acf475ee45 update locales
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-24 15:01:07 +01:00
vladmandic 09b9ae32c1 add color grading to processing
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-23 08:44:07 +01:00
CalamitousFelicitousness 813b61eda8 test: add api tests for generation params and detailer endpoints
Generation tests cover scheduler params, color grading, and latent
corrections. Detailer tests cover model enumeration and object
detection. Both require a running SD.Next instance.
2026-03-20 04:33:51 +00:00
CalamitousFelicitousness 0ec1e9bca2 test: add offline unit tests for color grading and latent corrections
Covers pixel-space color grading and latent-space corrections with
synthetic inputs, no running server required.
2026-03-20 04:33:51 +00:00
vladmandic 73b90c5228 redo all locales
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-14 21:48:06 +01:00
vladmandic b4e5b563c6 update lint rules
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-11 10:47:07 +01:00
CalamitousFelicitousness d78c5c1cd0 refactor: update CLI tools for caption module
- Rename cli/api-interrogate.py to cli/api-caption.py
- Update cli/options.py, cli/process.py for new module paths
- Update cli/test-tagger.py for caption module imports
2026-02-11 02:48:11 +00:00
vladmandic 7eb9b1cc5c create tests folder
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-10 14:31:53 +01:00
Vladimir Mandic 1fd4139cf4 post merge cleanup 2023-03-12 09:39:38 -04:00
Vladimir Mandic 696af5dc07 Merge pull request #49 from AUTOMATIC1111/master
merge from upstream
2023-03-12 08:56:09 -04:00
Vladimir Mandic 4a6e614055 premerge cleanup 2023-03-12 08:56:00 -04:00
Vladimir Mandic b459794737 merge cleanup first step 2023-03-11 08:19:39 -05:00
Vladimir Mandic 86e89e5446 Merge pull request #46 from AUTOMATIC1111/master
merge from upstream
2023-03-11 08:02:09 -05:00
Vladimir Mandic 6a6a881dbc pre-merge cleanup 2023-03-11 08:01:06 -05:00
Zhang Hua d25c4b13e4 test/basic_features/{extras,img2img}_test.py: use absolute path 2023-03-11 20:00:12 +08:00
Zhang Hua 9abe2f5e74 test/server_poll.py: use absolute path for test
test/server_poll.py: fix absolute path
2023-03-11 20:00:12 +08:00
Vladimir Mandic bcd4ee8bdb post merge cleanup 2023-03-10 10:08:48 -05:00
Vladimir Mandic 2dabba9190 Merge pull request #40 from space-nuko/unipc
integrate unipc sampler
2023-03-10 09:57:24 -05:00
Vladimir Mandic b48d05ca5a cleanup before merge 2023-03-10 09:57:10 -05:00
space-nuko 1253199889 Working UniPC (for batch size 1) 2023-02-10 03:30:20 -08:00
Vladimir Mandic 04f2c630cf update 2023-02-03 09:38:09 -05:00
Vladimir Mandic 9e0b2d8dcb Merge pull request #23 from AUTOMATIC1111/master
sync branches
2023-01-22 09:22:32 -05:00
AUTOMATIC cbfb463258 fix failing tests by removing then :^) 2023-01-21 11:22:16 +03:00