-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save_pipe and load_pipe not work #717
Comments
@forestlet Got it. We will try to reproduce this and get back here. |
This comment was marked as off-topic.
This comment was marked as off-topic.
didn't work for me neither :( |
@forestlet Please check this branch and have a try: #734 The pipe needs to run once to trigger the real compilation:
|
save_pipe function works and it saves model to cached_pipe. 🎉
My save_pipe code is: from diffusers import StableDiffusionXLPipeline
from onediffx import compile_pipe, save_pipe
import torch
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") and my load_pipe code is: from diffusers import StableDiffusionXLPipeline
from onediffx import compile_pipe, load_pipe
import torch
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=512,
width=512,
num_inference_steps=30,
output_type="pil",
).images
image[0].save(f"test_image.png") |
@forestlet This is because of the force_upcast of vae. You need execute the next code before load_pipe: if pipe.vae.dtype == torch.float16 and pipe.vae.config.force_upcast:
pipe.upcast_vae() And we will integrate this behavior into the load_pipe function in PR-734 |
Fix: #717 --------- Co-authored-by: binbinHan <han_binbin@163.com>
THANKs! However... if pipe.vae.dtype == torch.float16 and pipe.vae.config.force_upcast:
pipe.vae.to(dtype=torch.float32)
load_pipe(pipe, dir="cached_pipe") And I got this:
|
@forestlet Is there a full example for you error so we can have a try. |
too old to follow, please feel free to reopen it. |
Describe the bug
I use OneDiffX (for HF diffusers) and Compile, save and load pipeline. after I run save_pipe example, there is nothing in cached_pipe
Your environment
Ubuntu LTS
OneDiff git commit id
500459f
OneFlow version info
libibverbs not available, ibv_fork_init skipped
path: ['/home/ubuntu/.local/lib/python3.10/site-packages/oneflow']
version: 0.9.1.dev20240307+cu121
git_commit: 88ece9e
cmake_build_type: Release
rdma: True
mlir: True
enterprise: False
How To Reproduce
Steps to reproduce the behavior(code or script):
Additional context
Each time it takes too long to compile, however, the save_pipe func seems doesn't work.
The text was updated successfully, but these errors were encountered: