Skip to content

issue with DDIM scheduler for google/ddpm-celebahq-256 example #1918

Description

@murphyk

Describe the bug

Referring to the example "Unconditional Diffusion with discrete scheduler" at https://github.com/huggingface/diffusers#running-code
The comment says you can use DDIMPipeline but this fails to run on
(got an unexpected keyword argument eta).
Also, the PNDMPipeline runs but just returns noise.

Reproduction


# !pip install diffusers["torch"]
from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline
model_id = "google/ddpm-celebahq-256"
device = "cuda"
# load model and scheduler
#ddpm = DDPMPipeline.from_pretrained(model_id)
ddpm = DDIMPipeline.from_pretrained(model_id)
#ddpm = PNDMPipeline.from_pretrained(model_id)
# you can replace DDPMPipeline with DDIMPipeline or PNDMPipeline for faster inference
ddpm.to(device)
# run pipeline in inference (sample random noise and denoise)
image = ddpm().images[0]
image

Logs

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [21], in<cell line: 17>()
14 ddpm.to(device)
16 # run pipeline in inference (sample random noise and denoise)
---> 17 image = ddpm().images[0]
18 image
File /usr/local/lib/python3.9/dist-packages/torch/autograd/grad_mode.py:27, in _DecoratorContextManager.__call__.<locals>.decorate_context(*args, **kwargs)
24 @functools.wraps(func)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
File /usr/local/lib/python3.9/dist-packages/diffusers/pipelines/ddim/pipeline_ddim.py:114, in DDIMPipeline.__call__(self, batch_size, generator, eta, num_inference_steps, use_clipped_model_output, output_type, return_dict, **kwargs)
109 model_output = self.unet(image, t).sample
111 # 2. predict previous mean of image x_t-1 and add variance depending on eta
112 # eta corresponds to η in paper and should be between [0, 1]
113 # do x_t -> x_t-1
--> 114 image = self.scheduler.step(
115 model_output, t, image, eta=eta, use_clipped_model_output=use_clipped_model_output, generator=generator
116 ).prev_sample
118 image = (image / 2 + 0.5).clamp(0, 1)
119 image = image.cpu().permute(0, 2, 3, 1).numpy()
File /usr/local/lib/python3.9/dist-packages/diffusers/schedulers/scheduling_ddpm.py:259, in DDPMScheduler.step(self, model_output, timestep, sample, generator, return_dict, **kwargs)
237 """ 238 Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion 239 process from the learned model outputs (most often the predicted noise). (...) 253  254 """
255 message = (
256 "Please make sure to instantiate your scheduler with `prediction_type` instead. E.g. `scheduler =" 257 " DDPMScheduler.from_pretrained(<model_id>, prediction_type='epsilon')`."
258 )
--> 259 predict_epsilon = deprecate("predict_epsilon", "0.11.0", message, take_from=kwargs)
260 if predict_epsilon is not None:
261 new_config = dict(self.config)
File /usr/local/lib/python3.9/dist-packages/diffusers/utils/deprecation_utils.py:43, in deprecate(take_from, standard_warn, *args)
41 function= call_frame.function
42 key, value = next(iter(deprecated_kwargs.items()))
---> 43 raise TypeError(f"{function} in {filename} line {line_number-1} got an unexpected keyword argument `{key}`")
45 if len(values) == 0:
46 return
TypeError: step in /usr/local/lib/python3.9/dist-packages/diffusers/schedulers/scheduling_ddpm.py line 258 got an unexpected keyword argument `eta`

### System Info
- `diffusers` version: 0.10.2
- Platform: Linux-5.4.0-122-generic-x86_64-with-glibc2.31
- Python version: 3.9.13
- PyTorch version (GPU?): 1.12.0+cu116 (True)
- Huggingface_hub version: 0.11.1
- Transformers version: 4.20.1
- Using GPU in script?: Yes. P6000
- Using distributed or parallel set-up in script?: No

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions