From f6f1ec3a7ccba5fb5acc2ff62a62e1d27751752c Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Tue, 10 Jan 2023 14:52:32 +0100 Subject: [PATCH] allow loading ddpm models into ddim (#1932) --- src/diffusers/pipelines/ddim/pipeline_ddim.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/diffusers/pipelines/ddim/pipeline_ddim.py b/src/diffusers/pipelines/ddim/pipeline_ddim.py index 562093ed..46d088ad 100644 --- a/src/diffusers/pipelines/ddim/pipeline_ddim.py +++ b/src/diffusers/pipelines/ddim/pipeline_ddim.py @@ -16,6 +16,7 @@ from typing import List, Optional, Tuple, Union import torch +from ...schedulers import DDIMScheduler from ...utils import deprecate, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput @@ -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()