Skip to content

Commit

Permalink
allow loading ddpm models into ddim (huggingface#1932)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickvonplaten authored Jan 10, 2023
1 parent beb932c commit f6f1ec3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/diffusers/pipelines/ddim/pipeline_ddim.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import torch

from ...schedulers import DDIMScheduler
from ...utils import deprecate, randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput

Expand All @@ -34,6 +35,10 @@ class DDIMPipeline(DiffusionPipeline):

def __init__(self, unet, scheduler):
super().__init__()

# make sure scheduler can always be converted to DDIM
scheduler = DDIMScheduler.from_config(scheduler.config)

self.register_modules(unet=unet, scheduler=scheduler)

@torch.no_grad()
Expand Down

0 comments on commit f6f1ec3

Please sign in to comment.