diff --git a/api/onnx_web/diffusers/pipelines/panorama.py b/api/onnx_web/diffusers/pipelines/panorama.py index a33fed75..dd737a1e 100644 --- a/api/onnx_web/diffusers/pipelines/panorama.py +++ b/api/onnx_web/diffusers/pipelines/panorama.py @@ -28,7 +28,7 @@ from transformers import CLIPImageProcessor, CLIPTokenizer from onnx_web.chain.tile import make_tile_mask -from ..utils import LATENT_CHANNELS, LATENT_FACTOR, parse_regions +from ..utils import LATENT_CHANNELS, LATENT_FACTOR, parse_regions, repair_nan logger = logging.get_logger(__name__) @@ -701,6 +701,8 @@ class OnnxStableDiffusionPanoramaPipeline(DiffusionPipeline): # take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113 latents = np.where(count > 0, value / count, value) + latents = repair_nan(latents) + latents = np.clip(latents, -4, +4) # call the callback, if provided if callback is not None and i % callback_steps == 0: diff --git a/api/onnx_web/diffusers/pipelines/panorama_xl.py b/api/onnx_web/diffusers/pipelines/panorama_xl.py index c9b970a4..e0e26621 100644 --- a/api/onnx_web/diffusers/pipelines/panorama_xl.py +++ b/api/onnx_web/diffusers/pipelines/panorama_xl.py @@ -14,7 +14,7 @@ from optimum.pipelines.diffusers.pipeline_utils import preprocess, rescale_noise from onnx_web.chain.tile import make_tile_mask -from ..utils import LATENT_FACTOR, parse_regions +from ..utils import LATENT_FACTOR, parse_regions, repair_nan logger = logging.getLogger(__name__) @@ -550,6 +550,8 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix # take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113 latents = np.where(count > 0, value / count, value) + latents = repair_nan(latents) + latents = np.clip(latents, -4, +4) # call the callback, if provided if i == len(timesteps) - 1 or (