From 9f1847501d06be524ba1d3d4998f9f9c508b5f8c Mon Sep 17 00:00:00 2001 From: jiangzeyinzi Date: Wed, 7 Feb 2024 19:46:48 +0800 Subject: [PATCH] fix ctr null --- scepter/modules/model/backbone/unet/unet_module.py | 2 +- scepter/studio/inference/inference_ui/component_names.py | 2 ++ scepter/studio/inference/inference_ui/gallery_ui.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scepter/modules/model/backbone/unet/unet_module.py b/scepter/modules/model/backbone/unet/unet_module.py index 6aef1fe..6c71fcc 100644 --- a/scepter/modules/model/backbone/unet/unet_module.py +++ b/scepter/modules/model/backbone/unet/unet_module.py @@ -923,7 +923,7 @@ class DiffusionUNetXL(DiffusionUNet): context = cond hint = kwargs.pop('hint', None) - if self.control_blocks is not None: + if self.control_blocks is not None and hint is not None: out = self._forward_control(x, emb, context, hint, **kwargs) else: out = self._forward_origin(x, emb, context, **kwargs) diff --git a/scepter/studio/inference/inference_ui/component_names.py b/scepter/studio/inference/inference_ui/component_names.py index d25853f..a1ee6f2 100644 --- a/scepter/studio/inference/inference_ui/component_names.py +++ b/scepter/studio/inference/inference_ui/component_names.py @@ -66,12 +66,14 @@ class GalleryUIName(): self.gallery_before_refine_output = 'Before Refine Output' self.prompt_input = 'Type Prompt Here' self.generate = 'Generate' + self.control_err1 = 'The conditional image does not exist' elif language == 'zh': self.gallery_block_name = '模型的输出' self.gallery_diffusion_output = '扩散输出' self.gallery_before_refine_output = '精炼前输出' self.prompt_input = '在此输入提示' self.generate = '生成' + self.control_err1 = '条件图片不存在' class DiffusionUIName(): diff --git a/scepter/studio/inference/inference_ui/gallery_ui.py b/scepter/studio/inference/inference_ui/gallery_ui.py index 4313091..2c50936 100644 --- a/scepter/studio/inference/inference_ui/gallery_ui.py +++ b/scepter/studio/inference/inference_ui/gallery_ui.py @@ -88,6 +88,9 @@ class GalleryUI(UIBase): style_negative_template, image_seed, show_jpeg_image=True): + if control_state and control_cond_image is None: + raise gr.Error(self.component_names.control_err1) + current_pipeline = self.pipe_manager.get_pipeline_given_modules({ 'diffusion_model': diffusion_model,