sd-scripts icon indicating copy to clipboard operation
sd-scripts copied to clipboard

step_offset for dpmsolver++ sampler now crashes

Open rockerBOO opened this issue 1 year ago • 2 comments

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

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.

rockerBOO avatar Feb 14 '24 19:02 rockerBOO

Thank you for reporting. I will completer other tasks sooner.

kohya-ss avatar Feb 15 '24 13:02 kohya-ss

you haven't solve this problem yet by updating https://github.com/kohya-ss/sd-scripts/blob/f9317052edb4ab3b3c531ac3b28825ee78b4a966/library/train_util.py

yinghuan007 avatar Apr 25 '24 11:04 yinghuan007