siliconflow / onediff

OneDiff: An out-of-the-box acceleration library for diffusion models.
https://github.com/siliconflow/onediff/wiki
Apache License 2.0
1.4k stars 85 forks source link

Cannot run sdxl sample code with deepcache, PyTorch should be >= 1.12 #977

Open XuekuanWang opened 6 days ago

XuekuanWang commented 6 days ago

Describe the bug

A clear and concise description of what the bug is.

I cannot run example code of SDXL with deepcache. The error report is "
obj_entity = self._get_module(name) File "/mnt/wangxuekuan/onediff/src/onediff/infer_compiler/backends/oneflow/import_tools/dyn_mock_mod.py", line 167, in _get_module raise RuntimeError( RuntimeError: Failed to import onediffx.deep_cache because of the following error (look up to see its traceback): PyTorch should be >= 1.12"

However, my pytorch is 2.3.0. And I try to print the version of Pytorch, and get log "You are using torch==0.9.1.dev20240624+cu122, but torch>=1.10.0 is required to use BridgeTowerModel. Please upgrade torch."

I find the version of 0.9.1.dev20240624+cu122 is oneflow not torch.

Your environment

A100, ubuntu 20.04

OneDiff git commit id

master branch code onediff 1.2.0.dev1
onediffx 1.2.0.dev1 oneflow 0.9.1.dev20240624+cu122

OneFlow version info

Run python -m oneflow --doctor and paste it here.

version: 0.9.1.dev20240624+cu122 git_commit: ec7b682 cmake_build_type: Release rdma: True mlir: True enterprise: False

How To Reproduce

Steps to reproduce the behavior(code or script):

The complete error message

The sample code " import torch

from onediffx import compile_pipe from onediffx.deep_cache import StableDiffusionXLPipeline

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)

prompt = "A photo of a cat. Focus light and create sharp, defined edges."

Warmup

for i in range(1): deepcache_output = pipe( prompt, cache_interval=3, cache_layer_id=0, cache_block_id=0, output_type='pil' ).images[0]

deepcache_output = pipe( prompt, cache_interval=3, cache_layer_id=0, cache_block_id=0, output_type='pil' ).images[0] "

strint commented 6 days ago

"You are using torch==0.9.1.dev20240624+cu122, but torch>=1.10.0 is required to use BridgeTowerModel. Please upgrade torch."

I find the version of 0.9.1.dev20240624+cu122 is oneflow not torch.

@ccssu looks like a problem with mock

ccssu commented 5 days ago

hello, Thank you for your feedback @XuekuanWang
Please let us know the diffusers version information, probably due to version compatibility issues.

The onediff nearest ci test script is pass, using the diffusers==0.19.3 , You can also try using it pip install diffusers==0.19.3 https://github.com/siliconflow/onediff/blob/main/onediff_diffusers_extensions/examples/text_to_image_deep_cache_sdxl.py