kohya-ss / kohya-ss/sd-scripts

step_offset for dpmsolver++ sampler now crashes

Open
#1,121 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

There has been this deprecation error for stable diffusion 1.5 sampling scheduler. But in the latest versions in requirements has made this crash instead.

```
/mnt/900/builds/sd-scripts/.venv/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py:182: FutureWarning: The configuration file of this scheduler: DPMSolverMultistepScheduler {
"_class_name": "DPMSolverMultistepScheduler",
"_diffusers_version": "0.25.0",
"algorithm_type": "dpmsolver++",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"dynamic_thresholding_ratio": 0.995,
"euler_at_final": false,
"lambda_min_clipped": -Infinity,
"lower_order_final": true,
"num_train_timesteps": 1000,
"prediction_type": "epsilon",
"sample_max_value": 1.0,
"solver_order": 2,
"solver_type": "midpoint",
"steps_offset": 0,
"thresholding": false,
"timestep_spacing": "linspace",
"trained_betas": null,
"use_karras_sigmas": false,
"use_lu_lambdas": false,
"variance_type": null
}
is outdated. `steps_offset` should be set to 1 instead of 0. Please make sure to update the config accordingly as leaving `steps_offset` might led to incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very nice if
you could open a Pull request for the `scheduler/scheduler_config.json` file
deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False)
```

I was able to resolve this by adding in `library/train_util.py`

```python
def get_my_scheduler(...):
...
elif sample_sampler == "dpmsolver" or sample_sampler == "dpmsolver++":
...
# this sets it to 1
sched_init_args["steps_offset"] = 1
```

I can make a PR but in the middle of something at the moment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in library/train_util.py and inspect get_my_scheduler, specifically the dpmsolver and dpmsolver++ branches and their scheduler initialization arguments. Reproduce Stable Diffusion 1.5 sampling with the current requirements, then verify that setting steps_offset to 1 prevents the reported crash and deprecation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.