Open tonyservice opened 1 week ago
This happens to me also without load_pipe
, using the provided SDXL script. It does not happen 100% of the time:
ERROR [2024-07-03 22:26:43] /.../venv/lib/python3.10/site-packages/onediff/infer_compiler/backends/oneflow/deployable_module.py:38 - Exception in forward: e=RuntimeError('\x1b[1m\x1b[38;2;255;000;000mError\x1b[0m: Reshape infered output element count is different with input in op_name: model.down_blocks.1.attentions.0-reshape-88 input shape is : (2,60,56,640) , output shape is : (2,2700,640) , output logical shape is (2,2700,640) , and reshape shape conf is : (2,2700,640) op_loc: \n')
What is the HF diffusers version are you using, we only support dynamic shape switching from 0.19.3 to 0.27 of HF diffusers @tonyservice @DreamGenX
errors discovered while referencing the example from https://github.com/siliconflow/onediff/tree/main/onediff_diffusers_extensions.
demo1: from diffusers import StableDiffusionXLPipeline from onediffx import compile_pipe, save_pipe pipe = StableDiffusionXLPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True ) pipe.to("cuda")
pipe = compile_pipe(pipe)
run once to trigger compilation
image = pipe( prompt="street style, detailed, raw photo, woman, face, shot on CineStill 800T", height=512, width=512, num_inference_steps=30, output_type="pil", ).images
image[0].save(f"test_image.png")
save the compiled pipe
save_pipe(pipe, dir="cached_pipe")
demo2: from diffusers import StableDiffusionXLPipeline from onediffx import compile_pipe, load_pipe pipe = StableDiffusionXLPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True ) pipe.to("cuda")
pipe = compile_pipe(pipe)
load the compiled pipe
load_pipe(pipe, dir="cached_pipe")
no compilation now
image = pipe( prompt="street style, detailed, raw photo, woman, face, shot on CineStill 800T", height=640, width=640, num_inference_steps=30, output_type="pil", ).images
image[0].save(f"test_image.png") First, run demo1. Then, when modifying the dimensions in demo2 from height=512, width=512, to height=640, width=640,
the following error occurs.![3423](https://github.com/siliconflow/onediff/assets/15623570/c3bc2e64-f1fc-4d56-a60e-d1f3c9a23b91)
When using caching, if the input image's size is not consistent with the cached image in demo1 (and if pipe = compile_pipe(pipe) is used in demo2, it will take a long time to compile), how should it be handled to avoid errors?
from diffusers import StableDiffusionControlNetInpaintPipeline,UNet2DConditionModel,StableDiffusionInpaintPipeline,ControlNetModel, DDPMScheduler from diffusers.utils import load_image from onediff.infer_compiler import oneflow_compile from onediffx import compile_pipe,save_pipe,load_pipe
when attempting to use StableDiffusionControlNetInpaintPipeline, StableDiffusionInpaintPipeline, StableDiffusionXLPipeline, or StableDiffusionPipeline to generate a cache first and then call the cache later, if the new input image size does not match the cached image size, such a situation will occur.