Skip to content

'PNDMScheduler' object has no attribute 'set_format' #646

Closed

Description

@jalexs82

Describe the bug

Getting this error from pipeline_stable_diffusion.py

Reproduction

No response

Logs

No response

System Info

On colab notebook: https://colab.research.google.com/github/WASasquatch/easydiffusion/blob/main/Stability_AI_Easy_Diffusion.ipynb

Activity

  1. WASasquatch commented on Sep 27, 2022

    @WASasquatch

    Same issue I got. Easy Diffusion uses the pipes for Negative Weights, and they have obviously made changes to the pipe resources again, making users modified versions incompatible. Looks to be one line that's the issue. Will attempt a patch though without changes being documented by Diffusers outside GitHub automatic system, this makes reference and finding out what's changed a chore.

    It's a little frustrating cause in stuff like Inpaint we have logger.info("StableDiffusionInpaintPipeline is experimental and will very likely change in the future.") Which is like OK, look out... but this is happening to all pipes a lot. Not just inpaint. Lol

  2. patrickvonplaten commented on Sep 27, 2022

    @patrickvonplaten
    Contributor

    You are totally right - we messed it up here! Very sorry about this 🙏

    Here the fix: #651

  3. WASasquatch commented on Sep 27, 2022

    @WASasquatch

    I commented out the offending line of code for now, and things seem to be working without error or loss of quality.

  4. hafriedlander commented on Sep 28, 2022

    @hafriedlander
    Contributor

    This (internal? unclear) API change will have also broken all custom schedulers, since most of them rely on set_format to convert from numpy to tensor. Might need a stronger warning? (I didn't see this in my console, and it took me a while to track down the issue).

  5. hafriedlander commented on Sep 28, 2022

    @hafriedlander
    Contributor

    Actually, I'll suggest a different fix. Put the old behaviour back into scheduling_utils - you don't use it in the core schedulers at all, so it won't matter, and it'll mean any custom schedulers will still work.

  6. patrickvonplaten commented on Sep 29, 2022

    @patrickvonplaten
    Contributor

    Hey @hafriedlander,

    It's now a deprecated functionality but that works again. Is this good for you? Since we only support Pytorch models at the moment, I don't ever see a use case when one would need a numpy scheduler.

    Does this work for you? Please let me know if it's there are some inconveniences (and which ones) with the behavior currently and whether you can transition your code to not use set_format(...)

  7. WASasquatch commented on Sep 30, 2022

    @WASasquatch

    Hey @hafriedlander,

    It's now a deprecated functionality but that works again. Is this good for you? Since we only support Pytorch models at the moment, I don't ever see a use case when one would need a numpy scheduler.

    Does this work for you? Please let me know if it's there are some inconveniences (and which ones) with the behavior currently and whether you can transition your code to not use set_format(...)

    Are these changes also related to this when trying to do inpaint on pndm? Can't seem to get inpaint to take any init mask in any mode.

    [/usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py](https://localhost:8080/#) in __call__(self, prompt, init_image, mask_image, strength, num_inference_steps, guidance_scale, eta, negative_prompt, generator, output_type, return_dict)
        318 
        319             # masking
    --> 320             init_latents_proper = self.scheduler.add_noise(init_latents_orig, noise, t)
        321             latents = (init_latents_proper * mask) + (latents * (1 - mask))
        322 
    
    [/usr/local/lib/python3.7/dist-packages/diffusers/schedulers/scheduling_pndm.py](https://localhost:8080/#) in add_noise(self, original_samples, noise, timesteps)
        393             self.alphas_cumprod = self.alphas_cumprod.to(original_samples.device)
        394 
    --> 395         if timesteps.device != original_samples.device:
        396             timesteps = timesteps.to(original_samples.device)
        397 
    
    AttributeError: 'numpy.int64' object has no attribute 'device'
    

    Interestingly, running the same init mask and init image through another scheduler like lms produces

    RuntimeError: CUDA error: device-side assert triggered
    CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
    For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
    
  8. patrickvonplaten commented on Oct 3, 2022

    @patrickvonplaten
    Contributor

    Hey @WASasquatch,

    Would you mind opening a new issue for this?

  9. hafriedlander commented on Oct 7, 2022

    @hafriedlander
    Contributor

    Hi. Sorry for delay on replay. I am using the additional schedulers Hlky put together at main...hlky:diffusers:main

    However I consider this solved now for two reasons:

    • I just copied the old scheduling_utils.py into my server and changed my schedulers to reference that
    • Hlky is going to update his schedulers to the new 0.4.0 syntax anyway, at which point he'll presumably drop the need for set_format.
  10. github-actions commented on Oct 31, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

    Please note that issues that do not follow the contributing guidelines are likely to be ignored.

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 workingstaleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions