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
6214aa7d
Commit
6214aa7d
authored
Jun 09, 2024
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
performance: check for nans in unet only once, after all steps have been completed
parent
41ee2db5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
modules/processing.py
modules/processing.py
+5
-0
modules/sd_samplers_cfg_denoiser.py
modules/sd_samplers_cfg_denoiser.py
+0
-2
No files found.
modules/processing.py
View file @
6214aa7d
...
@@ -625,6 +625,9 @@ class DecodedSamples(list):
...
@@ -625,6 +625,9 @@ class DecodedSamples(list):
def
decode_latent_batch
(
model
,
batch
,
target_device
=
None
,
check_for_nans
=
False
):
def
decode_latent_batch
(
model
,
batch
,
target_device
=
None
,
check_for_nans
=
False
):
samples
=
DecodedSamples
()
samples
=
DecodedSamples
()
if
check_for_nans
:
devices
.
test_for_nans
(
batch
,
"unet"
)
for
i
in
range
(
batch
.
shape
[
0
]):
for
i
in
range
(
batch
.
shape
[
0
]):
sample
=
decode_first_stage
(
model
,
batch
[
i
:
i
+
1
])[
0
]
sample
=
decode_first_stage
(
model
,
batch
[
i
:
i
+
1
])[
0
]
...
@@ -987,6 +990,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -987,6 +990,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
if
getattr
(
samples_ddim
,
'already_decoded'
,
False
):
if
getattr
(
samples_ddim
,
'already_decoded'
,
False
):
x_samples_ddim
=
samples_ddim
x_samples_ddim
=
samples_ddim
else
:
else
:
devices
.
test_for_nans
(
samples_ddim
,
"unet"
)
if
opts
.
sd_vae_decode_method
!=
'Full'
:
if
opts
.
sd_vae_decode_method
!=
'Full'
:
p
.
extra_generation_params
[
'VAE Decoder'
]
=
opts
.
sd_vae_decode_method
p
.
extra_generation_params
[
'VAE Decoder'
]
=
opts
.
sd_vae_decode_method
x_samples_ddim
=
decode_latent_batch
(
p
.
sd_model
,
samples_ddim
,
target_device
=
devices
.
cpu
,
check_for_nans
=
True
)
x_samples_ddim
=
decode_latent_batch
(
p
.
sd_model
,
samples_ddim
,
target_device
=
devices
.
cpu
,
check_for_nans
=
True
)
...
...
modules/sd_samplers_cfg_denoiser.py
View file @
6214aa7d
...
@@ -273,8 +273,6 @@ class CFGDenoiser(torch.nn.Module):
...
@@ -273,8 +273,6 @@ class CFGDenoiser(torch.nn.Module):
denoised_params
=
CFGDenoisedParams
(
x_out
,
state
.
sampling_step
,
state
.
sampling_steps
,
self
.
inner_model
)
denoised_params
=
CFGDenoisedParams
(
x_out
,
state
.
sampling_step
,
state
.
sampling_steps
,
self
.
inner_model
)
cfg_denoised_callback
(
denoised_params
)
cfg_denoised_callback
(
denoised_params
)
devices
.
test_for_nans
(
x_out
,
"unet"
)
if
is_edit_model
:
if
is_edit_model
:
denoised
=
self
.
combine_denoised_for_edit_model
(
x_out
,
cond_scale
)
denoised
=
self
.
combine_denoised_for_edit_model
(
x_out
,
cond_scale
)
elif
skip_uncond
:
elif
skip_uncond
:
...
...
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