Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
d6b44440
Commit
d6b44440
authored
May 10, 2024
by
Logan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shared.sd_model.is_sdxl to determine base AYS sigmas
parent
73d1caf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
modules/sd_schedulers.py
modules/sd_schedulers.py
+6
-7
No files found.
modules/sd_schedulers.py
View file @
d6b44440
...
@@ -6,6 +6,8 @@ import k_diffusion
...
@@ -6,6 +6,8 @@ import k_diffusion
import
numpy
as
np
import
numpy
as
np
from
modules
import
shared
@
dataclasses
.
dataclass
@
dataclasses
.
dataclass
class
Scheduler
:
class
Scheduler
:
name
:
str
name
:
str
...
@@ -31,7 +33,7 @@ def sgm_uniform(n, sigma_min, sigma_max, inner_model, device):
...
@@ -31,7 +33,7 @@ def sgm_uniform(n, sigma_min, sigma_max, inner_model, device):
sigs
+=
[
0.0
]
sigs
+=
[
0.0
]
return
torch
.
FloatTensor
(
sigs
)
.
to
(
device
)
return
torch
.
FloatTensor
(
sigs
)
.
to
(
device
)
def
get_align_your_steps_sigmas
(
n
,
device
,
sigma_id
):
def
get_align_your_steps_sigmas
(
n
,
sigma_min
,
sigma_max
,
device
):
# https://research.nvidia.com/labs/toronto-ai/AlignYourSteps/howto.html
# https://research.nvidia.com/labs/toronto-ai/AlignYourSteps/howto.html
def
loglinear_interp
(
t_steps
,
num_steps
):
def
loglinear_interp
(
t_steps
,
num_steps
):
"""
"""
...
@@ -46,12 +48,10 @@ def get_align_your_steps_sigmas(n, device, sigma_id):
...
@@ -46,12 +48,10 @@ def get_align_your_steps_sigmas(n, device, sigma_id):
interped_ys
=
np
.
exp
(
new_ys
)[::
-
1
]
.
copy
()
interped_ys
=
np
.
exp
(
new_ys
)[::
-
1
]
.
copy
()
return
interped_ys
return
interped_ys
if
s
igma_id
==
"sdxl"
:
if
s
hared
.
sd_model
.
is_sdxl
:
sigmas
=
[
14.615
,
6.315
,
3.771
,
2.181
,
1.342
,
0.862
,
0.555
,
0.380
,
0.234
,
0.113
,
0.029
]
sigmas
=
[
14.615
,
6.315
,
3.771
,
2.181
,
1.342
,
0.862
,
0.555
,
0.380
,
0.234
,
0.113
,
0.029
]
elif
sigma_id
==
"sd15"
:
sigmas
=
[
14.615
,
6.475
,
3.861
,
2.697
,
1.886
,
1.396
,
0.963
,
0.652
,
0.399
,
0.152
,
0.029
]
else
:
else
:
print
(
f
'Align Your Steps sigma identifier "{sigma_id}" not recognized, defaulting to SD 1.5.'
)
# Default to SD 1.5 sigmas.
sigmas
=
[
14.615
,
6.475
,
3.861
,
2.697
,
1.886
,
1.396
,
0.963
,
0.652
,
0.399
,
0.152
,
0.029
]
sigmas
=
[
14.615
,
6.475
,
3.861
,
2.697
,
1.886
,
1.396
,
0.963
,
0.652
,
0.399
,
0.152
,
0.029
]
if
n
!=
len
(
sigmas
):
if
n
!=
len
(
sigmas
):
...
@@ -68,8 +68,7 @@ schedulers = [
...
@@ -68,8 +68,7 @@ schedulers = [
Scheduler
(
'exponential'
,
'Exponential'
,
k_diffusion
.
sampling
.
get_sigmas_exponential
),
Scheduler
(
'exponential'
,
'Exponential'
,
k_diffusion
.
sampling
.
get_sigmas_exponential
),
Scheduler
(
'polyexponential'
,
'Polyexponential'
,
k_diffusion
.
sampling
.
get_sigmas_polyexponential
,
default_rho
=
1.0
),
Scheduler
(
'polyexponential'
,
'Polyexponential'
,
k_diffusion
.
sampling
.
get_sigmas_polyexponential
,
default_rho
=
1.0
),
Scheduler
(
'sgm_uniform'
,
'SGM Uniform'
,
sgm_uniform
,
need_inner_model
=
True
,
aliases
=
[
"SGMUniform"
]),
Scheduler
(
'sgm_uniform'
,
'SGM Uniform'
,
sgm_uniform
,
need_inner_model
=
True
,
aliases
=
[
"SGMUniform"
]),
Scheduler
(
'align_your_steps_sdxl'
,
'Align Your Steps (SDXL)'
,
lambda
n
,
sigma_min
,
sigma_max
,
device
:
get_align_your_steps_sigmas
(
n
,
device
,
"sdxl"
)),
Scheduler
(
'align_your_steps'
,
'Align Your Steps'
,
get_align_your_steps_sigmas
),
Scheduler
(
'align_your_steps_sd15'
,
'Align Your Steps (SD 1.5)'
,
lambda
n
,
sigma_min
,
sigma_max
,
device
:
get_align_your_steps_sigmas
(
n
,
device
,
"sd15"
)),
]
]
schedulers_map
=
{
**
{
x
.
name
:
x
for
x
in
schedulers
},
**
{
x
.
label
:
x
for
x
in
schedulers
}}
schedulers_map
=
{
**
{
x
.
name
:
x
for
x
in
schedulers
},
**
{
x
.
label
:
x
for
x
in
schedulers
}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment