Skip to content

Typo in noise level formula in Karras scheduler #590

@sgrigory

Description

@sgrigory

Describe the bug

Comparing the formula for noise levels in KarrasVeScheduler

self.schedule = [
(
self.config.sigma_max
* (self.config.sigma_min**2 / self.config.sigma_max**2) ** (i / (num_inference_steps - 1))
)
for i in self.timesteps
]

with Karras, Tero, et al. (VE column of Table 1), it seems to me that there is **2 missing, and the correct formula should be

self.schedule = [
            (
                self.config.sigma_max**2
                * (self.config.sigma_min**2 / self.config.sigma_max**2) ** (i / (num_inference_steps - 1))
            )
            for i in self.timesteps
        ]

This way the noise indeed ranges from sigma_min to sigma_max, as the docstring says.

Please let me know if I'm misunderstanding something here

This actually affects the generated images: they become less grainy and oversaturated after this is fixed

Reproduction

No response

Logs

No response

System Info

  • diffusers version: 0.4.0.dev0
  • Platform: Linux-5.10.133+-x86_64-with-Ubuntu-18.04-bionic
  • Python version: 3.7.14
  • PyTorch version (GPU?): 1.12.1+cu113 (True)
  • Huggingface_hub version: 0.9.1
  • Transformers version: 4.22.1
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Metadata

Metadata

Assignees

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