Repository navigation
feat: add Anima 2.9B 40-block training compatibility - #11
Conversation
| "use_byg": "BYG", | ||
| "pgraft": "P-GRAFT", | ||
| "train_llm_adapter": "train_llm_adapter", | ||
| "network_train_text_encoder_only": "text-encoder-only training", |
There was a problem hiding this comment.
🟠 High: Joint text-encoder training bypasses the 40-block gatennThis catches text-encoder-only mode, but network_train_unet_only=false enables joint DiT/text-encoder training and still passes. That combination is explicitly outside the certified 40-block policy, so it must add a blocker too.
| return None | ||
| dit_path = str(resolve_under_home(dit)) | ||
| cached = getattr(args, "_anima_inference_identity", None) | ||
| if cached is not None and cached[0] == dit_path and cached[1] == adapters: |
There was a problem hiding this comment.
🟡 Medium: Path-only cache can skip adapter identity revalidationnnReplacing an adapter at the same path leaves this cache key unchanged, so the new file is loaded without checking its base/model identity. Include stable file fingerprints such as resolved path, size, timestamps, and file identity in the key.
| block_prefixes: set[str] = set() | ||
|
|
||
| for path in files: | ||
| with MemoryEfficientSafeOpen(str(path)) as handle: |
There was a problem hiding this comment.
🔴 Critical: Unbounded safetensors header length can exhaust memorynnMemoryEfficientSafeOpen trusts the first 8 bytes and allocates/reads that declared header size. A corrupt checkpoint can declare a multi-GB header and OOM WebUI preflight or training before validation. Bound the header and verify it fits inside the file before reading.
| ) | ||
|
|
||
|
|
||
| @lru_cache(maxsize=32) |
There was a problem hiding this comment.
🟠 High: Metadata-keyed SHA cache can retain stale certificationnnA checkpoint replaced with same-size content and a preserved mtime can reuse the previous certified SHA. That stale identity then propagates to adapter checks and metadata. Certification hashes should be recomputed from content rather than trusted from (path, size, mtime).
| down_init = str(options.get("down_init", "kaiming") or "kaiming").lower() | ||
| if not timestep_mask and not use_ortho and down_init == "kaiming": | ||
| profile = "plain_lora" | ||
| elif timestep_mask and ( |
There was a problem hiding this comment.
🟠 High: Plain SVD-Down T-LoRA is mislabeled as certified OrthoLoRAnndown_init=weight_svd with use_ortho=false stays on LoRAModule per networks/lora_anima/config.py; it is not OrthoLoRA. This branch therefore admits an architecture outside the stated allowlist. Require use_ortho=true with the compatible kaiming initialization.
| "method": "distill_mod", | ||
| "network_module": "networks.lora_anima", | ||
| } | ||
| checkpoint_layout, base_sha256, _compatibility = preflight_anima_training( |
There was a problem hiding this comment.
🟡 Medium: Dry-run now scans and requires the full DiTnnThis preflight runs before the dry_run return, so a model-free collation check now fails on a missing checkpoint or hashes multiple GB unnecessarily. Move it below the dry-run path; the identical ordering in scripts/distill_spd.py needs the same change.
| "--dit in your argparse." | ||
| ) | ||
|
|
||
| checkpoint_layout = inspect_anima_checkpoint(dit_path) |
There was a problem hiding this comment.
🟠 High: Preflight bypasses repository-relative model path resolutionnnload_anima_model resolves relative paths under ANIMA_HOME, but this new inspection runs first against the process CWD. build_anima() therefore fails outside the repo for otherwise valid default paths. Resolve dit_path once with resolve_under_home() before all three operations.
|
|
||
| from library.io.safetensors import MemoryEfficientSafeOpen, get_split_weight_filenames | ||
|
|
||
| _KEY_PREFIXES = ("net.", "model.diffusion_model.", "") |
There was a problem hiding this comment.
🟠 High: Inspector and loader normalize different checkpoint prefixesnnThis newly accepts model.diffusion_model.blocks.*, but the loader strips only net.. Such a checkpoint passes preflight and then loads under the wrong keys. Normalize every prefix accepted here in the loader too.
Summary
40-block support policy
The shared preflight accepts only:
REPA, VR loss, ConvRot, Hydra, LoKr/LoHa/GLoKr, ControlNet/EasyControl, Turbo, SPD, BYG, text-encoder training, and other unvalidated combinations are reported together and rejected before cache/model startup. The certified base identity is the Anima 2.9B preview-v1 checkpoint (
0b3020d1b906155f7eb30667622723e87160632c8c7a5f1c93bdce685f2a346d). Other structurally valid 40-block derivatives are detected but remain uncertified.Validation
origin/mainfocused suite:76 passed1706 passed, 15 skipped449 modules transformed, built successfullyHardware certification limits
The remaining failures from the raw full local pytest run are pre-existing environment/baseline failures involving optional
pystray, a missing default VAE file, stale documentation links, Torch 2.10 golden-number drift, and an existing stage-test mock.