mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
+3
-3
@@ -7,7 +7,7 @@ from modules.logger import log
|
||||
debug = os.environ.get('SD_MODULAR_DEBUG', None) is not None
|
||||
|
||||
|
||||
def get_modular_class_name(diffusion_pipeline: diffusers.DiffusionPipeline) -> str:
|
||||
def get_modular_class(diffusion_pipeline: diffusers.DiffusionPipeline):
|
||||
name = diffusion_pipeline.__class__.__name__
|
||||
name = name.replace('Pipeline', '').replace('Img2Img', '').replace('Inpaint', '').replace('ImageToVideo', '')
|
||||
name = f'{name}AutoBlocks'
|
||||
@@ -20,7 +20,7 @@ def get_modular_class_name(diffusion_pipeline: diffusers.DiffusionPipeline) -> s
|
||||
def is_compatible(diffusion_pipeline: diffusers.DiffusionPipeline) -> bool:
|
||||
if not shared.opts.model_modular_enable:
|
||||
return False
|
||||
compatible = get_modular_class_name(diffusion_pipeline) is not None
|
||||
compatible = get_modular_class(diffusion_pipeline) is not None
|
||||
if not compatible:
|
||||
log.debug(f'Modular: source={diffusion_pipeline.__class__.__name__} incompatible pipeline')
|
||||
return compatible
|
||||
@@ -34,7 +34,7 @@ def is_guider(diffusion_pipeline: diffusers.DiffusionPipeline) -> bool:
|
||||
def convert_to_modular(diffusion_pipeline: diffusers.DiffusionPipeline) -> diffusers.ModularPipeline:
|
||||
modular_pipe = None
|
||||
try:
|
||||
modular_cls = get_modular_class_name(diffusion_pipeline)
|
||||
modular_cls = get_modular_class(diffusion_pipeline)
|
||||
if modular_cls is None:
|
||||
raise ValueError(f'unknown: cls={diffusion_pipeline.__class__.__name__}')
|
||||
modular_blocks = modular_cls()
|
||||
|
||||
Reference in New Issue
Block a user