Files
automatic/modules/lora/lora_overrides.py
T
CalamitousFelicitousness 4af3a57741 feat(anima): native lora across transformer, llm_adapter, text encoder
Dispatch anima loras through a dedicated native loader covering kohya,
bfl/ai-toolkit, and hybrid (bfl with alpha plus qwen3 text encoder)
formats. Cosmos 2.0 path rename is mirrored from diffusers in flat
(underscore) form so rewritten paths match network_layer_mapping keys
without further conversion.

Split model_type from cosmos to anima so a future base-cosmos2 lora
path stays separable. Update flow_models, taesd supported list, and the
taesd wanvideo bucket so samplers and preview decoding keep working
after the split.

Extend assign_network_names_to_compvis_modules to walk pipe.llm_adapter
under the lora_llm_adapter_ prefix, and add llm_adapter to
default_components so activate and deactivate include it for anima
models while staying inert elsewhere via the existing getattr guards.
2026-04-25 03:16:03 +01:00

69 lines
2.2 KiB
Python

from modules import shared
force_hashes_diffusers = [ # forced always
# '816d0eed49fd', # flash-sdxl
# 'c2ec22757b46', # flash-sd15
# '22c8339e7666', # spo-sdxl-10ep
# 'aaebf6360f7d', # sd15-lcm
# '3d18b05e4f56', # sdxl-lcm
# 'b71dcb732467', # sdxl-tcd
# '813ea5fb1c67', # sdxl-turbo
# '5a48ac366664', # hyper-sd15-1step
# 'ee0ff23dcc42', # hyper-sd15-2step
# 'e476eb1da5df', # hyper-sd15-4step
# 'ecb844c3f3b0', # hyper-sd15-8step
# '1ab289133ebb', # hyper-sd15-8step-cfg
# '4f494295edb1', # hyper-sdxl-8step
# 'ca14a8c621f8', # hyper-sdxl-8step-cfg
# '1c88f7295856', # hyper-sdxl-4step
# 'fdd5dcd1d88a', # hyper-sdxl-2step
# '8cca3706050b', # hyper-sdxl-1step
]
allow_native = [
'sd',
'sdxl',
'sd3',
'f1',
'chroma',
'zimage',
'anima',
]
force_classes_diffusers = [ # forced always
'FluxKontextPipeline', 'FluxKontextInpaintPipeline',
]
fuse_ignore = [
'hunyuanvideo',
]
def get_method(shorthash=''):
use_diffusers = shared.opts.lora_force_diffusers or (shared.sd_model.__class__.__name__ in force_classes_diffusers) or (shared.sd_model_type not in allow_native)
if len(shorthash) > 4:
use_diffusers = use_diffusers or any(x.startswith(shorthash) for x in force_hashes_diffusers)
nunchaku_dit = hasattr(shared.sd_model, 'transformer') and 'Nunchaku' in shared.sd_model.transformer.__class__.__name__
nunchaku_unet = hasattr(shared.sd_model, 'unet') and 'Nunchaku' in shared.sd_model.unet.__class__.__name__
use_nunchaku = nunchaku_dit or nunchaku_unet
if use_nunchaku:
return 'nunchaku'
elif use_diffusers:
return 'diffusers'
else:
return 'native'
def disable_fuse():
if hasattr(shared.sd_model, 'quantization_config'):
return True
if hasattr(shared.sd_model, 'transformer') and hasattr(shared.sd_model.transformer, 'quantization_config'):
return True
if hasattr(shared.sd_model, 'transformer_2') and hasattr(shared.sd_model.transformer_2, 'quantization_config'):
return True
if hasattr(shared.sd_model, '_lora_partial'):
return True
return shared.sd_model_type in fuse_ignore