From 8d4410305e4d411661c72607c2717690a5c62447 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Fri, 24 Nov 2023 10:36:53 -0600 Subject: [PATCH] fix(api): convert latents to numpy before using --- api/onnx_web/diffusers/pipelines/panorama_xl.py | 4 ++-- api/onnx_web/diffusers/run.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/onnx_web/diffusers/pipelines/panorama_xl.py b/api/onnx_web/diffusers/pipelines/panorama_xl.py index 9a4ec773..fe8a6532 100644 --- a/api/onnx_web/diffusers/pipelines/panorama_xl.py +++ b/api/onnx_web/diffusers/pipelines/panorama_xl.py @@ -5,13 +5,13 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import PIL import torch +from diffusers.image_processor import VaeImageProcessor from diffusers.pipelines.stable_diffusion_xl import StableDiffusionXLPipelineOutput from optimum.onnxruntime.modeling_diffusion import ORTStableDiffusionXLPipelineBase from optimum.pipelines.diffusers.pipeline_stable_diffusion_xl_img2img import ( StableDiffusionXLImg2ImgPipelineMixin, ) from optimum.pipelines.diffusers.pipeline_utils import rescale_noise_cfg -from diffusers.image_processor import VaeImageProcessor from onnx_web.chain.tile import make_tile_mask @@ -730,7 +730,7 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix # 3. Preprocess image processor = VaeImageProcessor() - image = processor.preprocess(image) + image = processor.preprocess(image).cpu().numpy() # 4. Prepare timesteps self.scheduler.set_timesteps(num_inference_steps) diff --git a/api/onnx_web/diffusers/run.py b/api/onnx_web/diffusers/run.py index 0cb59ac3..5991c57a 100644 --- a/api/onnx_web/diffusers/run.py +++ b/api/onnx_web/diffusers/run.py @@ -385,7 +385,12 @@ def run_inpaint_pipeline( latents = get_latents_from_seed(params.seed, size, batch=params.batch) progress = worker.get_progress_callback() images = chain.run( - worker, server, params, StageResult(images=[source]), callback=progress, latents=latents + worker, + server, + params, + StageResult(images=[source]), + callback=progress, + latents=latents, ) _pairs, loras, inversions, _rest = parse_prompt(params)