File size: 1,123 Bytes
eb65e9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from diffusers import (
    DDIMScheduler,
    DPMSolverMultistepScheduler,
    EulerAncestralDiscreteScheduler,
    EulerDiscreteScheduler,
    HeunDiscreteScheduler,
    LMSDiscreteScheduler,
)

diff_scheduler_list = ["DDIM", "EulerA", "Euler", "LMS", "Heun", "UniPC", "DPMSolver"]


def get_scheduler_list(pipe, scheduler):
    if scheduler == diff_scheduler_list[0]:
        pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)

    elif scheduler == diff_scheduler_list[1]:
        pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)

    elif scheduler == diff_scheduler_list[2]:
        pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config)

    elif scheduler == diff_scheduler_list[3]:
        pipe.scheduler = LMSDiscreteScheduler.from_config(pipe.scheduler.config)

    elif scheduler == diff_scheduler_list[4]:
        pipe.scheduler = HeunDiscreteScheduler.from_config(pipe.scheduler.config)

    elif scheduler == diff_scheduler_list[5]:
        pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

    return pipe