question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discrepancy in scheduler `offset` usage

See original GitHub issue

What API design would you like to have changed or added to the library? Why?

@jonatanklosko brought up an issue with some confusing code (why are alphas indexed differently across PNDMScheduler and DDIMScheduler), and some inconsistency in the offset usage.

Two questions:

  1. Why does only one shift by offset?
  2. Can offset be changed from an arbitrary int to a bool setting that shifts by 1 (the integer shift is more confusing if the only use case is stable diffusion inference with offset = 1)

Discussion began in #444, see here

https://github.com/huggingface/diffusers/blob/8eaaa546d89f836b716e92348786d878f883ee86/src/diffusers/schedulers/scheduling_pndm.py#L338-L339

https://github.com/huggingface/diffusers/blob/8eaaa546d89f836b716e92348786d878f883ee86/src/diffusers/schedulers/scheduling_ddim.py#L204-L205

I can tell you that the PNDMScheduler and DDIMScheduler have indexed the alpha’s differently for a while. Before introducing offset, PNDMScheduler had

alpha_prod_t = self.alphas_cumprod[timestep + 1]
alpha_prod_t_prev = self.alphas_cumprod[timestep_prev + 1]

And DDIMScheduler had

alpha_prod_t = self.alphas_cumprod[timestep]
alpha_prod_t_prev = self.alphas_cumprod[timestep_prev]

At minimum, we can figure this out and document better!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
jonatankloskocommented, Sep 12, 2022

By timesteps[n] you probably meant alphas_cumprod[n] in the list of cases above, no?

Also here:

alpha_prod_t_prev = self.alphas_cumprod[prev_timestep + self._offset] if prev_timestep >= 0 else self.final_alpha_cumprod

I don’t see why we need to add the offset. For example, at timestamp 101, prev timestamp would be 1, so we want to take alphas_cumprod[1] rather than alphas_cumprod[1 + self._offset].

1reaction
patrickvonplatencommented, Sep 12, 2022

Just to summarize, I think by having both:

steps_offset and set_alpha_to_one in the config as you suggested @jonatanklosko we should enable all use cases that we need. We should then indeed document this nicely.

@jonatanklosko very cool summary here, let me know if you need any help 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Offset Concepts - Cisco
Enterprise Scheduler follows certain concepts when it compiles a production schedule. The concepts are basic but can result in complicated timing scenarios ...
Read more >
Data Discrepancy Troubleshooting Guide | Stitch Documentation
Row count discrepancies describe discrepancies that affect the number of records in your destination. Complete records may be missing, ...
Read more >
Reports Scheduler
Enter the criteria you want to use to search for reports that are scheduled. Report Name. Name of the scheduled report you wish...
Read more >
VistA Scheduling Enhancements (VSE) VS GUI User Guide
1.2 Overview. VS GUI is a software module that allows schedulers to make appointments quickly by viewing multiple appointment request types ...
Read more >
Quantifying the Underlying Causes of a Discrepancy Between ...
This gives rise to significant discrepancies between simulation results and actual measured energy consumption, termed “the performance gap.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found