Comfy-Org / Comfy-Org/ComfyUI

mixed up beta schedules - linear and sqrt_linear

Open
#1,998 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 10h
Merged PRs (30d)
153

Description

it seems beta schedules in comfyui are inconsistent with those from diffusers library.

in diffusers, e.g. [euler](https://github.com/huggingface/diffusers/blob/4e54dfe985293df9e6e86828d7a2763d076879f5/src/diffusers/schedulers/scheduling_euler_discrete.py#L152) (it's the same elsewhere):
```
elif beta_schedule == "linear":
self.betas = torch.linspace(beta_start, beta_end, num_train_timesteps, dtype=torch.float32)
elif beta_schedule == "scaled_linear":
# this schedule is very specific to the latent diffusion model.
self.betas = torch.linspace(beta_start**0.5, beta_end**0.5, num_train_timesteps, dtype=torch.float32) ** 2
```

in [comfyui](https://github.com/comfyanonymous/ComfyUI/blob/8a451234b3090db488fbee9740a5f6be2f989253/comfy/ldm/modules/diffusionmodules/util.py#L22):
```
if schedule == "linear":
betas = torch.linspace(linear_start ** 0.5, linear_end ** 0.5, n_timestep, dtype=torch.float64) ** 2
. . .
elif schedule == "sqrt_linear":
betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64)
```

are the names simply mistaken or there is a logics behind such swap?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.