Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
2ab64ec8
Commit
2ab64ec8
authored
Sep 28, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
emergency fix for #1199
parent
15f333a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
sd_samplers.py
modules/sd_samplers.py
+13
-12
No files found.
modules/sd_samplers.py
View file @
2ab64ec8
...
...
@@ -3,6 +3,7 @@ import numpy as np
import
torch
import
tqdm
from
PIL
import
Image
import
inspect
import
k_diffusion.sampling
import
ldm.models.diffusion.ddim
...
...
@@ -38,11 +39,11 @@ samplers = [
samplers_for_img2img
=
[
x
for
x
in
samplers
if
x
.
name
!=
'PLMS'
]
sampler_extra_params
=
{
'sample_euler'
:
[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_euler_ancestral'
:[
'eta'
],
'sample_heun'
:[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_dpm_2'
:
[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_dpm_2_ancestral'
:[
'eta'
],
'sample_euler'
:
[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_euler_ancestral'
:
[
'eta'
],
'sample_heun'
:
[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_dpm_2'
:
[
's_churn'
,
's_tmin'
,
's_tmax'
,
's_noise'
],
'sample_dpm_2_ancestral'
:
[
'eta'
],
}
def
setup_img2img_steps
(
p
,
steps
=
None
):
...
...
@@ -231,7 +232,7 @@ class KDiffusionSampler:
self
.
model_wrap
=
k_diffusion
.
external
.
CompVisDenoiser
(
sd_model
,
quantize
=
shared
.
opts
.
enable_quantization
)
self
.
funcname
=
funcname
self
.
func
=
getattr
(
k_diffusion
.
sampling
,
self
.
funcname
)
self
.
extra_params
=
sampler_extra_params
.
get
(
funcname
,
[])
self
.
extra_params
=
sampler_extra_params
.
get
(
funcname
,
[])
self
.
model_wrap_cfg
=
CFGDenoiser
(
self
.
model_wrap
)
self
.
sampler_noises
=
None
self
.
sampler_noise_index
=
0
...
...
@@ -278,9 +279,9 @@ class KDiffusionSampler:
k_diffusion
.
sampling
.
torch
=
TorchHijack
(
self
)
extra_params_kwargs
=
{}
for
val
in
self
.
extra_params
:
if
hasattr
(
p
,
val
)
:
extra_params_kwargs
[
val
]
=
getattr
(
p
,
val
)
for
param_name
in
self
.
extra_params
:
if
hasattr
(
p
,
param_name
)
and
param_name
in
inspect
.
signature
(
self
.
func
)
.
parameters
:
extra_params_kwargs
[
param_name
]
=
getattr
(
p
,
param_name
)
return
self
.
func
(
self
.
model_wrap_cfg
,
xi
,
sigma_sched
,
extra_args
=
{
'cond'
:
conditioning
,
'uncond'
:
unconditional_conditioning
,
'cond_scale'
:
p
.
cfg_scale
},
disable
=
False
,
callback
=
self
.
callback_state
,
**
extra_params_kwargs
)
...
...
@@ -300,9 +301,9 @@ class KDiffusionSampler:
k_diffusion
.
sampling
.
torch
=
TorchHijack
(
self
)
extra_params_kwargs
=
{}
for
val
in
self
.
extra_params
:
if
hasattr
(
p
,
val
)
:
extra_params_kwargs
[
val
]
=
getattr
(
p
,
val
)
for
param_name
in
self
.
extra_params
:
if
hasattr
(
p
,
param_name
)
and
param_name
in
inspect
.
signature
(
self
.
func
)
.
parameters
:
extra_params_kwargs
[
param_name
]
=
getattr
(
p
,
param_name
)
samples
=
self
.
func
(
self
.
model_wrap_cfg
,
x
,
sigmas
,
extra_args
=
{
'cond'
:
conditioning
,
'uncond'
:
unconditional_conditioning
,
'cond_scale'
:
p
.
cfg_scale
},
disable
=
False
,
callback
=
self
.
callback_state
,
**
extra_params_kwargs
)
...
...
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