Skip to content

[Refactor] TensorRTStableDiffusionPipeline - Remove StableDiffusionReferencePipeline inheriting from DiffusionPipeline #11829

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

krishnakalyan3
Copy link

This pull request refactors the StableDiffusionReferencePipeline class to inherit from the DiffusionPipeline class rather than the StableDiffusionPipeline class.

Fixes # (issue)
#6984

@krishnakalyan3
Copy link
Author

cc: @yiyixuxu

@krishnakalyan3
Copy link
Author

tensorrt_mt_fuji

Example output for this code

import torch
from diffusers import DDIMScheduler
from diffusers.pipelines import DiffusionPipeline

# Use the DDIMScheduler scheduler here instead
scheduler = DDIMScheduler.from_pretrained("stabilityai/stable-diffusion-2-1", subfolder="scheduler")

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1",
    custom_pipeline="stable_diffusion_tensorrt_txt2img",
    variant='fp16',
    torch_dtype=torch.float16,
    scheduler=scheduler,)

# re-use cached folder to save ONNX models and TensorRT Engines
pipe.set_cached_folder("stabilityai/stable-diffusion-2-1", variant='fp16',)

pipe = pipe.to("cuda")

prompt = "a beautiful photograph of Mt. Fuji during cherry blossom"
image = pipe(prompt).images[0]
image.save('tensorrt_mt_fuji.png')

@krishnakalyan3 krishnakalyan3 changed the title [Refactor] StableDiffusionReferencePipeline inheriting from DiffusionPipeline [Refactor] TensorRTStableDiffusionPipeline - Remove StableDiffusionReferencePipeline inheriting from DiffusionPipeline Jun 29, 2025
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

Successfully merging this pull request may close these issues.

1 participant