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
7578b50b
Unverified
Commit
7578b50b
authored
Dec 24, 2022
by
AUTOMATIC1111
Committed by
GitHub
Dec 24, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5873 from philpax/override-settings-restore-afterwards
feat(api): add override_settings_restore_afterwards
parents
fac92610
22f1527f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
processing.py
modules/processing.py
+10
-7
No files found.
modules/processing.py
View file @
7578b50b
...
@@ -80,7 +80,7 @@ class StableDiffusionProcessing():
...
@@ -80,7 +80,7 @@ class StableDiffusionProcessing():
"""
"""
The first set of paramaters: sd_models -> do_not_reload_embeddings represent the minimum required to create a StableDiffusionProcessing
The first set of paramaters: sd_models -> do_not_reload_embeddings represent the minimum required to create a StableDiffusionProcessing
"""
"""
def
__init__
(
self
,
sd_model
=
None
,
outpath_samples
=
None
,
outpath_grids
=
None
,
prompt
:
str
=
""
,
styles
:
List
[
str
]
=
None
,
seed
:
int
=
-
1
,
subseed
:
int
=
-
1
,
subseed_strength
:
float
=
0
,
seed_resize_from_h
:
int
=
-
1
,
seed_resize_from_w
:
int
=
-
1
,
seed_enable_extras
:
bool
=
True
,
sampler_name
:
str
=
None
,
batch_size
:
int
=
1
,
n_iter
:
int
=
1
,
steps
:
int
=
50
,
cfg_scale
:
float
=
7.0
,
width
:
int
=
512
,
height
:
int
=
512
,
restore_faces
:
bool
=
False
,
tiling
:
bool
=
False
,
do_not_save_samples
:
bool
=
False
,
do_not_save_grid
:
bool
=
False
,
extra_generation_params
:
Dict
[
Any
,
Any
]
=
None
,
overlay_images
:
Any
=
None
,
negative_prompt
:
str
=
None
,
eta
:
float
=
None
,
do_not_reload_embeddings
:
bool
=
False
,
denoising_strength
:
float
=
0
,
ddim_discretize
:
str
=
None
,
s_churn
:
float
=
0.0
,
s_tmax
:
float
=
None
,
s_tmin
:
float
=
0.0
,
s_noise
:
float
=
1.0
,
override_settings
:
Dict
[
str
,
Any
]
=
None
,
sampler_index
:
int
=
None
):
def
__init__
(
self
,
sd_model
=
None
,
outpath_samples
=
None
,
outpath_grids
=
None
,
prompt
:
str
=
""
,
styles
:
List
[
str
]
=
None
,
seed
:
int
=
-
1
,
subseed
:
int
=
-
1
,
subseed_strength
:
float
=
0
,
seed_resize_from_h
:
int
=
-
1
,
seed_resize_from_w
:
int
=
-
1
,
seed_enable_extras
:
bool
=
True
,
sampler_name
:
str
=
None
,
batch_size
:
int
=
1
,
n_iter
:
int
=
1
,
steps
:
int
=
50
,
cfg_scale
:
float
=
7.0
,
width
:
int
=
512
,
height
:
int
=
512
,
restore_faces
:
bool
=
False
,
tiling
:
bool
=
False
,
do_not_save_samples
:
bool
=
False
,
do_not_save_grid
:
bool
=
False
,
extra_generation_params
:
Dict
[
Any
,
Any
]
=
None
,
overlay_images
:
Any
=
None
,
negative_prompt
:
str
=
None
,
eta
:
float
=
None
,
do_not_reload_embeddings
:
bool
=
False
,
denoising_strength
:
float
=
0
,
ddim_discretize
:
str
=
None
,
s_churn
:
float
=
0.0
,
s_tmax
:
float
=
None
,
s_tmin
:
float
=
0.0
,
s_noise
:
float
=
1.0
,
override_settings
:
Dict
[
str
,
Any
]
=
None
,
override_settings_restore_afterwards
:
bool
=
True
,
sampler_index
:
int
=
None
):
if
sampler_index
is
not
None
:
if
sampler_index
is
not
None
:
print
(
"sampler_index argument for StableDiffusionProcessing does not do anything; use sampler_name"
,
file
=
sys
.
stderr
)
print
(
"sampler_index argument for StableDiffusionProcessing does not do anything; use sampler_name"
,
file
=
sys
.
stderr
)
...
@@ -121,6 +121,7 @@ class StableDiffusionProcessing():
...
@@ -121,6 +121,7 @@ class StableDiffusionProcessing():
self
.
s_tmax
=
s_tmax
or
float
(
'inf'
)
# not representable as a standard ui option
self
.
s_tmax
=
s_tmax
or
float
(
'inf'
)
# not representable as a standard ui option
self
.
s_noise
=
s_noise
or
opts
.
s_noise
self
.
s_noise
=
s_noise
or
opts
.
s_noise
self
.
override_settings
=
{
k
:
v
for
k
,
v
in
(
override_settings
or
{})
.
items
()
if
k
not
in
shared
.
restricted_opts
}
self
.
override_settings
=
{
k
:
v
for
k
,
v
in
(
override_settings
or
{})
.
items
()
if
k
not
in
shared
.
restricted_opts
}
self
.
override_settings_restore_afterwards
=
override_settings_restore_afterwards
self
.
is_using_inpainting_conditioning
=
False
self
.
is_using_inpainting_conditioning
=
False
if
not
seed_enable_extras
:
if
not
seed_enable_extras
:
...
@@ -466,12 +467,14 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
...
@@ -466,12 +467,14 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
res
=
process_images_inner
(
p
)
res
=
process_images_inner
(
p
)
finally
:
# restore opts to original state
finally
:
for
k
,
v
in
stored_opts
.
items
():
# restore opts to original state
setattr
(
opts
,
k
,
v
)
if
p
.
override_settings_restore_afterwards
:
if
k
==
'sd_hypernetwork'
:
shared
.
reload_hypernetworks
()
for
k
,
v
in
stored_opts
.
items
():
if
k
==
'sd_model_checkpoint'
:
sd_models
.
reload_model_weights
()
setattr
(
opts
,
k
,
v
)
if
k
==
'sd_vae'
:
sd_vae
.
reload_vae_weights
()
if
k
==
'sd_hypernetwork'
:
shared
.
reload_hypernetworks
()
if
k
==
'sd_model_checkpoint'
:
sd_models
.
reload_model_weights
()
if
k
==
'sd_vae'
:
sd_vae
.
reload_vae_weights
()
return
res
return
res
...
...
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