mirror of
https://github.com/vladmandic/automatic
synced 2026-09-01 18:46:53 +02:00
cec6d0dce5
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.
41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
"""Anima pipeline package.
|
|
|
|
Exports :data:`ANIMA_SPEC` for use by :mod:`pipelines.model_anima` together
|
|
with :mod:`pipelines.native_transformer`. The spec captures the Anima-specific
|
|
knobs that differ from the native-loader defaults:
|
|
|
|
- The bundled ``llm_adapter`` sibling: Anima community files frequently inline
|
|
the custom AnimaLLMAdapter weights in the same safetensors as the
|
|
transformer. The resolved adapter class is supplied at load time via
|
|
``sibling_classes`` because AnimaLLMAdapter is loaded dynamically through
|
|
``trust_remote_code`` and is not available at import time.
|
|
- Cosmos 1.0 structural marker: any community file whose state dict contains
|
|
a Cosmos 1.0 nested key (``net.blocks.block1.*``) is rejected with a clear
|
|
error since Anima is Cosmos 2.0 only.
|
|
- All other knobs (prefixes, ``acceptable_missing`` buffers) use the defaults
|
|
from :mod:`pipelines.native_transformer`.
|
|
"""
|
|
|
|
import diffusers
|
|
from diffusers.loaders.single_file_utils import convert_cosmos_transformer_checkpoint_to_diffusers
|
|
|
|
from pipelines.native_transformer import TransformerSpec, SiblingSpec
|
|
|
|
|
|
ANIMA_SPEC = TransformerSpec(
|
|
cls=diffusers.CosmosTransformer3DModel,
|
|
converter=convert_cosmos_transformer_checkpoint_to_diffusers,
|
|
siblings={
|
|
'llm_adapter': SiblingSpec(
|
|
subfolder='llm_adapter',
|
|
inline_prefix='llm_adapter.',
|
|
),
|
|
},
|
|
forbidden_markers=(
|
|
(
|
|
'net.blocks.block1.blocks.0.block.attn.to_q.0.weight',
|
|
'unsupported Cosmos 1.0 structure',
|
|
),
|
|
),
|
|
)
|