Comfy-Org / Comfy-Org/ComfyUI

Incorrect brownian parameters

Open
#6,474 1 comment 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Expected Behavior

No warnings.

### Actual Behavior

It seems incorrect parameters are being passed into `torchsde.BrownianTree` here:

https://github.com/comfyanonymous/ComfyUI/blob/cba58fff0bfebfc81fbe678bb80491890a3df14a/comfy/k_diffusion/sampling.py#L110

I receive a warning in the terminal stating:

> `UserWarning: Should have tb<=t1 but got tb=14.614644050598145 and t1=14.614643.`

This is the relevant code:

```python
def __call__(self, t0, t1):
t0, t1, sign = self.sort(t0, t1)
if self.cpu_tree:
w = torch.stack([tree(t0.cpu().float(), t1.cpu().float()).to(t0.dtype).to(t0.device) for tree in self.trees]) * (self.sign * sign)
else:
w = torch.stack([tree(t0, t1) for tree in self.trees]) * (self.sign * sign)

return w if self.batched else w[0]
```

At the point the warning is generated, these values are present:

```
t0 = tensor(8.3726, device='mps:0')
t1 = tensor(14.6146, device='mps:0')
sign = -1
self.trees = [BrownianTree(interval=BrownianInterval(t0=0.029, t1=14.615, size=(1, 4, 144, 112), dtype=torch.float32, device=device(type='cpu'), entropy=0, dt=None, tol=1e-06, pool_size=24, cache_size=45, levy_area_approximation='none'))]
```

### Steps to Reproduce

Generate an image using `dpmpp_sde` or `dpmpp_sde_gpu` on macOS / Apple silicon.

### Debug Logs

```powershell
See above.
```

### Other

This is with `master`, currently at `cba58fff0bfebfc81fbe678bb80491890a3df14a`.

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.