22 Commits

Author SHA1 Message Date
CalamitousFelicitousness 6b92f2ba03 feat(model): add anima 2.9b as a base reference model
Anima-2.9B is a depth-expanded finetune of Anima 1.0 Base carrying 40
transformer blocks against the base repo's 28. The reference entry points at
the Diffusers conversion. Single-file releases load through the native loader:
TransformerSpec gains an infer_config hook, the Anima spec uses it to size
num_layers to the block indices in the file, and model_anima routes a
checkpoint-selected safetensors through the loader with the remaining
components from the base repo.
2026-09-05 01:45:49 +01:00
Dity0 712a13f1a0 Move SDNQ to upstream SDNQ repo 2026-08-10 12:13:10 +03:00
CalamitousFelicitousness 129ed76467 fix(test): repair native-transformer suite after sdnq refactors
- patch is_fp8_compile_supported on kernel_wrappers, its new home
- pin sdnq_quantize_matmul_mode instead of the removed checkbox key
2026-07-16 02:41:51 +01:00
Disty0 75926e6fc4 Remove sdnq_use_quantized_matmul and use sdnq_quantize_matmul_mode instead 2026-07-15 18:45:30 +03:00
CalamitousFelicitousness ce84b2d183 perf(model): adopt fp8 weights through the uint8 codec when fp8 cannot compile
Triton cannot compile e4m3 loads before sm_89, so fp8 weights fall back
to eager dequant there. The uint8-backed float8_e4m3fn_sdnq codec decodes
identically now that subnormals are handled (the two NaN codes become
+/-480), and its compiled dequant runs about 6x faster than eager native
fp8. Pre-quantized fp8 layers are viewed as uint8 at adoption when
compiled dequant is enabled on such hardware; the eager gate remains the
safety net for every other fp8 path.
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness 5e1a0719ab feat(model): detect header metadata and nvfp4 in the model probe
detect_quant now reads _quantization_metadata as the authoritative quant
source when present, and resolves marker-file formats from the marked
layers' stored weight dtypes instead of file-wide dtype voting, which
mislabeled fp8 files carrying extra uint8 tensors and had no nvfp4
mapping at all. Schema bump so cached probe entries refresh.
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness 0997526394 feat(model): load nvfp4 comfy_quant checkpoints via sdnq
nvfp4 layers keep their packed 4-bit codes and land on SDNQ grouped
quantization as float4_e2m1fn: the nibble order is swapped once at load,
the e4m3 block scales are unswizzled from the cuBLAS tile layout, and
the fp32 global scale folds into them as per-group scales. Marker
orig_shape acts as a cross-check and alignment padding is sliced
against the model dimensions.

- reject nvfp4 markers with unknown group sizes or convrot flags
- accept uint8 storage in the krea2 real-file check
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness d005ac5aa1 feat(model): support comfy_quant header metadata containers
Newer quantized checkpoints record per-layer formats in the safetensors
header _quantization_metadata instead of marker tensors. The native loader
now reads the header map, re-keys it through the same prefix strip as the
tensors, and transcodes it into marker tensors so both container forms
share one detection path; header entries win over markers.

- drop optional input_scale sidecars for marked layers
- map full_precision_matrix_mult onto the sdnq per-layer matmul exclusion list
- log the detection source (markers, header, both)
2026-07-11 20:26:12 +01:00
CalamitousFelicitousness 5d5ede5c47 feat(model): load convrot comfy_quant checkpoints via sdnq hadamard
ConvRot is the regular Hadamard rotation SDNQ implements: identical
construction, normalization, axis, and dequant order. Per-layer markers
map onto the dequantizer's use_hadamard and hadamard_group_size; group
sizes must be powers of 4 and divide in_features, else base-repo
fallback. Detection carries per-layer metadata since files mix plain
and rotated layers.
2026-07-11 06:40:08 +01:00
CalamitousFelicitousness 8c884c1e02 feat(model): secondary unet override slot and ideogram4 native loading
One UNET override cannot serve dual-transformer arches: ideogram4
conditional/unconditional and wan combined-stage experts need separate
files, and previously a single override landed on both experts.

- sd_unet_secondary option with per-slot tracking, consumed-state sync,
  arch-change reset, and incompatible-override fallback
- dropdown renders beside the primary, follows it into quicksettings,
  and is visible only for dual-transformer model types
- ideogram4 native single-file spec with a quant-aware fused-qkv
  converter; such converters run before comfy_quant detection via
  TransformerSpec.converter_handles_quant
- quicksettings render in configured order (sort keyed on the option
  object and always fell back to alphabetical)
- post-load dtype warning skips quantized transformers
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness cbe3c148e0 fix(model): skip redundant model reload after unet override load
load_transformer consumes the sd_unet dropdown selection during a full
model load but never marked it as loaded, so the queued sd_unet
onchange callback always forced a second full reload. Sync
sd_unet.loaded_unet once the override is successfully consumed; the
incompatible-override fallback keeps its reset to Default.
2026-07-10 02:39:24 +01:00
CalamitousFelicitousness 2a7d4b4037 feat(model): extend comfy_quant loading to float8_e4m3fn
Parameterize the pre-quantized comfy_quant path by format so fp8
tensorwise checkpoints load alongside int8; both map onto SDNQ's
symmetric dequant for the matching weights dtype. Containers are
mislabeled in the wild, so the stored weight dtype is validated
against the marker, mixed-format files are rejected, and markers
carrying a convrot rotation flag fall back to the base repo since
they may require runtime inverse rotation.
2026-07-10 02:27:24 +01:00
CalamitousFelicitousness 68c1ea8e78 feat(model): load comfyui comfy_quant int8 checkpoints via sdnq
Detect comfy_quant markers in native single-file transformer loads and
adopt the pre-quantized tensors as SDNQ int8 layers instead of rejecting
them. ComfyUI int8_tensorwise is a strict subset of SDNQ symmetric int8,
so weights and scales are taken bit-exact with no dequantize-requantize
round trip; quantized matmul and scale-dtype settings apply as usual.

- detect_comfy_quant/remap_comfy_quant helpers plus a prequantized
  builder in native_transformer; file markers dictate the layer set
- unsupported formats and wrong-arch markers fall back to the base repo
- offline unit tests and an opt-in real-file krea2 test
2026-07-10 01:54:27 +01:00
CalamitousFelicitousness 4c289e8c9d fix(model): load transformer from all-in-one checkpoints in native loader
All-in-one exports bundle the text encoder and VAE alongside the
transformer under LDM-style family prefixes (cond_stage_model.,
first_stage_model., text_encoders., vae.). The native loader treated
those keys as a mixed-prefix error and rejected the file. Drop known
companion families before prefix detection and log what was skipped;
keys matching neither a transformer prefix nor a known family still
raise. TE and VAE keep coming from the base repo or their own overrides.
2026-07-09 00:35:00 +01:00
CalamitousFelicitousness 0e6158438f refactor(loader): collapse native-load logging to one summary line
strip_prefix returns the detected prefix instead of logging it, so the load
summary reports it alongside the key count and the redundant reading-state
marker is gone. Four near-identical cls/file lines become one.
2026-07-05 18:21:28 +01:00
CalamitousFelicitousness e12ae85d06 test(native-loader): add shape-mismatch unit and override self-heal API test 2026-06-06 01:08:31 +01:00
CalamitousFelicitousness 32081ade7c refactor(native-loader): replace required_markers with reactive fallback
A converter error or load_state_dict mismatch now raises OverrideArchMismatch, which load_transformer catches to drop the override and load the base transformer. No per-arch markers to maintain.
2026-06-04 21:20:10 +01:00
CalamitousFelicitousness 596cae1b90 fix(native-loader): handle arch-mismatched UNET/DiT override on cold start 2026-06-03 03:23:24 +01:00
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 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