• Pedro Cuenca's avatar
    Add `timestep_spacing` and `steps_offset` to schedulers (#3947) · 07c9a08e
    Pedro Cuenca authored
    
    
    * Add timestep_spacing to DDPM, LMSDiscrete, PNDM.
    
    * Remove spurious line.
    
    * More easy schedulers.
    
    * Add `linspace` to DDIM
    
    * Noise sigma for `trailing`.
    
    * Add timestep_spacing to DEISMultistepScheduler.
    
    Not sure the range is the way it was intended.
    
    * Fix: remove line used to debug.
    
    * Support timestep_spacing in DPMSolverMultistep, DPMSolverSDE, UniPC
    
    * Fix: convert to numpy.
    
    * Use sched. defaults when instantiating from_config
    
    For params not present in the original configuration.
    
    This makes it possible to switch pipeline schedulers even if they use
    different timestep_spacing (or any other param).
    
    * Apply suggestions from code review
    Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
    
    * Missing args in DPMSolverMultistep
    
    * Test: default args not in config
    
    * Style
    
    * Fix scheduler name in test
    
    * Remove duplicated entries
    
    * Add test for solver_type
    
    This test currently fails in main. When switching from DEIS to UniPC,
    solver_type is "logrho" (the default value from DEIS), which gets
    translated to "bh1" by UniPC. This is different to the default value for
    UniPC: "bh2". This is where the translation happens: https://github.com/huggingface/diffusers/blob/36d22d0709dc19776e3016fb3392d0f5578b0ab2/src/diffusers/schedulers/scheduling_unipc_multistep.py#L171
    
    
    
    * UniPC: use same default for solver_type
    
    Fixes a bug when switching from UniPC from another scheduler (i.e.,
    DEIS) that uses a different solver type. The solver is now the same as
    if we had instantiated the scheduler directly.
    
    * do not save use default values
    
    * fix more
    
    * fix all
    
    * fix schedulers
    
    * fix more
    
    * finish for real
    
    * finish for real
    
    * flaky tests
    
    * Update tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py
    
    * Default steps_offset to 0.
    
    * Add missing docstrings
    
    * Apply suggestions from code review
    
    ---------
    Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
    07c9a08e
scheduling_ddpm_parallel.py 28.1 KB