8000 compile vae causes segmentation fault at deconstruction. · Issue #118 · chengzeyi/stable-fast · GitHub
[go: up one dir, main page]

Skip to content
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

compile vae causes segmentation fault at deconstruction. #118

Closed
turbo0628 opened this issue Feb 7, 2024 · 0 comments
Closed

compile vae causes segmentation fault at deconstruction. #118

turbo0628 opened this issue Feb 7, 2024 · 0 comments

Comments

@turbo0628
Copy link
turbo0628 commented Feb 7, 2024

Thanks for your awesome work!

Recently I'm trying to use stable fast to accelerate VAE computation and encountered segmentation faults at program exit. I have made a minimal reproduction and hope it could help stable-fast become more stable :)

Minimal reproduction:

import torch
import torch.nn.functional as F

from diffusers import AutoencoderKL

from sfast.compilers.stable_diffusion_pipeline_compiler import (
    compile_vae,
    CompilationConfig,
)

device = torch.device("cuda:0")

SD_2_1_DIFFUSERS_MODEL = "stabilityai/stable-diffusion-2-1"
variant = {"variant": "fp16"}
vae_orig = AutoencoderKL.from_pretrained(
        SD_2_1_DIFFUSERS_MODEL,
        subfolder="vae",
        torch_dtype=torch.float16,
        **variant,
    )

vae_orig.to(device)

sfast_config = CompilationConfig.Default()
sfast_config.enable_xformers = False
sfast_config.enable_triton = True
sfast_config.enable_cuda_graph = False
vae = compile_vae(vae_orig, sfast_config)

sample_imgs = torch.randn(4, 3, 128, 128, dtype=vae.dtype, device=device)
latents1 = torch.randn(4, 4, 16, 16, dtype=vae.dtype, device=device)

latents = vae.encode(sample_imgs).latent_dist.sample()

sample_imgs_dup = sample_imgs.clone().detach().requires_grad_(True)
latents2 = vae_orig.encode(sample_imgs_dup).latent_dist.sample()
print("Test done")

The gdb points to this line at core dump but I'm not very sure about the course. It's not a null pointer but definitely something not accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0