Comfy-Org / Comfy-Org/ComfyUI

Inconsistency between KSampler and SamplerCustom from discarding penultimate sigma

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

Description

### Expected Behavior

With same setting, the result of KSampler and SamplerCustom should be the same. If not, it would need to show a hint to explain the difference at somewhere.

### Actual Behavior

Currently, KSampler implements discarding penultimate sigma for specific samplers (dpm2, unipc) to try to make their result better. ([code here](https://github.com/comfyanonymous/ComfyUI/blob/ab4dd19b913be95dc7f1a8080cd49aa940345c96/comfy/samplers.py#L768))
However, sigmas and sampler for SamplerCustom are created individually, which cannot handle penultimate sigma now.
It leads to different result when using those sampler even with same setting.

### Steps to Reproduce

Make a workflow including KSampler and SamplerCustom with same setting. Use dpm_2, dpm_2_ancestral, uni_pc or uni_pc_bh2 would find result different. Other samplers would be same.

The first image uses UniPC, and second one uses DPM++ 2M to show the difference.
![sampler_example](https://github.com/user-attachments/assets/fc79404c-e85b-4a1c-8ac4-ab166f8831b2)
![sampler_example2](https://github.com/user-attachments/assets/2678c7dc-4fbf-411e-8735-deba40c7f1fd)
Workflow above: [unipc_workflow.json](https://github.com/user-attachments/files/16620705/unipc_workflow.json)

### Debug Logs

```powershell
No relevant log
```

### Other

_No response_

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.