Skip to content

[Type hint] Score SDE VE pipeline #325

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
#!/usr/bin/env python3
import warnings
from typing import Optional

import torch

from diffusers import DiffusionPipeline

from ...models import UNet2DModel
from ...schedulers import ScoreSdeVeScheduler


class ScoreSdeVePipeline(DiffusionPipeline):
def __init__(self, unet, scheduler):

unet: UNet2DModel
scheduler: ScoreSdeVeScheduler

def __init__(self, unet: UNet2DModel, scheduler: DiffusionPipeline):
super().__init__()
self.register_modules(unet=unet, scheduler=scheduler)

@torch.no_grad()
def __call__(self, batch_size=1, num_inference_steps=2000, generator=None, output_type="pil", **kwargs):
def __call__(
self,
batch_size: int = 1,
num_inference_steps: int = 2000,
generator: Optional[torch.Generator] = None,
output_type: Optional[str] = "pil",
**kwargs,
):
if "torch_device" in kwargs:
device = kwargs.pop("torch_device")
warnings.warn(
Expand Down