Skip to content
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

got an unexpected keyword argument eta #18

Open
wyf0912 opened this issue Dec 13, 2022 · 5 comments
Open

got an unexpected keyword argument eta #18

wyf0912 opened this issue Dec 13, 2022 · 5 comments

Comments

@wyf0912
Copy link

wyf0912 commented Dec 13, 2022

Thanks for sharing the code!

While I get the following error when I run the demo code of the diffusers.

diffusers/src/diffusers/schedulers/scheduling_ddpm.py line 258 got an unexpected keyword argument `eta`
@oliverow
Copy link

Hi @wyf0912, I encountered the same issue. Have you by any chance figured out a fix for it? Thanks!

@jiamings
Copy link
Member

@patrickvonplaten Can you take a look at this? This seems to be a diffusers issue. Thanks!

@patrickvonplaten
Copy link
Contributor

patrickvonplaten commented Jan 17, 2023

Sure!

@wyf0912, @oliverow could you try to update your diffusers version?

pip install --upgrade diffusers

I've tested:

from diffusers import DDIMPipeline

model_id = "google/ddpm-cifar10-32"

# load model and scheduler
ddim = DDIMPipeline.from_pretrained(model_id)

# run pipeline in inference (sample random noise and denoise)
image = ddim(num_inference_steps=50).images[0]

# save image
image.save("ddim_generated_image.png")

and it works as expected with:

import diffusers; print(diffusers.__verison__)  # 0.11.1

@wyf0912
Copy link
Author

wyf0912 commented Jan 17, 2023

Dear all, thanks a lot for your reply.
I just update the version of diffusers to the same version (0.11.1), but I still meet the same problem. @patrickvonplaten

In [4]: diffusers.__version__
Out[4]: '0.11.1'

In [5]: from diffusers import DDIMPipeline
   ...: 
   ...: model_id = "google/ddpm-cifar10-32"
   ...: 
   ...: # load model and scheduler
   ...: ddim = DDIMPipeline.from_pretrained(model_id)
   ...: 
   ...: # run pipeline in inference (sample random noise and denoise)
   ...: image = ddim(num_inference_steps=50).images[0]
   ...: 
   ...: # save image
   ...: image.save("ddim_generated_image.png")
Fetching 4 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 24139.88it/s]
  0%|                                                                                                                                                                               | 0/50 [00:00<?, ?it/s]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-5a1f38721518> in <module>
      7 
      8 # run pipeline in inference (sample random noise and denoise)
----> 9 image = ddim(num_inference_steps=50).images[0]
     10 
     11 # save image

~/anaconda3/lib/python3.9/site-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     25         def decorate_context(*args, **kwargs):
     26             with self.clone():
---> 27                 return func(*args, **kwargs)
     28         return cast(F, decorate_context)
     29 

~/anaconda3/lib/python3.9/site-packages/diffusers/pipelines/ddim/pipeline_ddim.py in __call__(self, batch_size, generator, eta, num_inference_steps, use_clipped_model_output, output_type, return_dict)
    127             # eta corresponds to η in paper and should be between [0, 1]
    128             # do x_t -> x_t-1
--> 129             image = self.scheduler.step(
    130                 model_output, t, image, eta=eta, use_clipped_model_output=use_clipped_model_output, generator=generator
    131             ).prev_sample

~/anaconda3/lib/python3.9/site-packages/diffusers/schedulers/scheduling_ddpm.py in step(self, model_output, timestep, sample, generator, return_dict, **kwargs)
    257             " DDPMScheduler.from_pretrained(<model_id>, prediction_type='epsilon')`."
    258         )
--> 259         predict_epsilon = deprecate("predict_epsilon", "0.12.0", message, take_from=kwargs)
    260         if predict_epsilon is not None:
    261             new_config = dict(self.config)

~/anaconda3/lib/python3.9/site-packages/diffusers/utils/deprecation_utils.py 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}`")
     44 
     45     if len(values) == 0:

TypeError: step in /home/yufei/anaconda3/lib/python3.9/site-packages/diffusers/schedulers/scheduling_ddpm.py line 258 got an unexpected keyword argument `eta`

@patrickvonplaten
Copy link
Contributor

I see! Sorry, I just noticed that the fix didn't make it into the last release: huggingface/diffusers#1932

Could you try to do:

pip install git+https://github.com/huggingface/diffusers.git

And try again. We'll do a release next week so that you won't have to install from "main" anymore then.

Sorry about this!

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

No branches or pull requests

4 participants