mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
unified logger
This commit is contained in:
@@ -1835,6 +1835,7 @@ import gradio as gr
|
||||
import diffusers
|
||||
from PIL import Image, ImageEnhance, ImageOps # pylint: disable=reimported
|
||||
from modules import errors, shared, devices, scripts_manager, processing, sd_models, images
|
||||
from modules import logger
|
||||
from modules.image import convert
|
||||
|
||||
|
||||
@@ -1900,15 +1901,15 @@ class Script(scripts_manager.Script):
|
||||
if not enabled:
|
||||
return
|
||||
if shared.sd_model_type not in ['sdxl', 'sd', 'f1']:
|
||||
shared.log.error(f'Differential-diffusion: incorrect base model: {shared.sd_model.__class__.__name__}')
|
||||
logger.log.error(f'Differential-diffusion: incorrect base model: {shared.sd_model.__class__.__name__}')
|
||||
return
|
||||
if not hasattr(p, 'init_images') or len(p.init_images) == 0:
|
||||
shared.log.error('Differential-diffusion: no input images')
|
||||
logger.log.error('Differential-diffusion: no input images')
|
||||
return
|
||||
|
||||
image_init, image_map, image_mask = self.depthmap(p.init_images[0], image, model, strength, invert)
|
||||
if image_map is None:
|
||||
shared.log.error('Differential-diffusion: no image map')
|
||||
logger.log.error('Differential-diffusion: no image map')
|
||||
return
|
||||
|
||||
orig_pipeline = shared.sd_model
|
||||
@@ -1949,13 +1950,13 @@ class Script(scripts_manager.Script):
|
||||
if shared.sd_model_type == 'sdxl':
|
||||
p.task_args['original_image'] = image_init
|
||||
if p.batch_size > 1:
|
||||
shared.log.warning(f'Differential-diffusion: batch-size={p.batch_size} parallel processing not supported')
|
||||
logger.log.warning(f'Differential-diffusion: batch-size={p.batch_size} parallel processing not supported')
|
||||
p.batch_size = 1
|
||||
shared.log.debug(f'Differential-diffusion: pipeline={pipe.__class__.__name__} strength={strength} model={model} auto={image is None}')
|
||||
logger.log.debug(f'Differential-diffusion: pipeline={pipe.__class__.__name__} strength={strength} model={model} auto={image is None}')
|
||||
shared.sd_model = pipe
|
||||
sd_models.move_model(pipe.vae, devices.device, force=True)
|
||||
except Exception as e:
|
||||
shared.log.error(f'Differential-diffusion: pipeline creation failed: {e}')
|
||||
logger.log.error(f'Differential-diffusion: pipeline creation failed: {e}')
|
||||
errors.display(e, 'Differential-diffusion: pipeline creation failed')
|
||||
shared.sd_model = orig_pipeline
|
||||
|
||||
|
||||
Reference in New Issue
Block a user