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
92a17a7a
Commit
92a17a7a
authored
Oct 20, 2022
by
random_thoughtss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made dummy latents smaller. Minor code cleanups
parent
aa7ff2a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
modules/processing.py
modules/processing.py
+4
-3
modules/sd_samplers.py
modules/sd_samplers.py
+4
-2
No files found.
modules/processing.py
View file @
92a17a7a
...
@@ -557,7 +557,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
...
@@ -557,7 +557,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
else
:
else
:
# Dummy zero conditioning if we're not using inpainting model.
# Dummy zero conditioning if we're not using inpainting model.
# Still takes up a bit of memory, but no encoder call.
# Still takes up a bit of memory, but no encoder call.
image_conditioning
=
torch
.
zeros
(
x
.
shape
[
0
],
5
,
x
.
shape
[
-
2
],
x
.
shape
[
-
1
],
dtype
=
x
.
dtype
,
device
=
x
.
device
)
# Pretty sure we can just make this a 1x1 image since its not going to be used besides its batch size.
image_conditioning
=
torch
.
zeros
(
x
.
shape
[
0
],
5
,
1
,
1
,
dtype
=
x
.
dtype
,
device
=
x
.
device
)
return
image_conditioning
return
image_conditioning
...
@@ -759,8 +760,8 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
...
@@ -759,8 +760,8 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self
.
image_conditioning
=
self
.
image_conditioning
.
to
(
shared
.
device
)
.
type
(
self
.
sd_model
.
dtype
)
self
.
image_conditioning
=
self
.
image_conditioning
.
to
(
shared
.
device
)
.
type
(
self
.
sd_model
.
dtype
)
else
:
else
:
self
.
image_conditioning
=
torch
.
zeros
(
self
.
image_conditioning
=
torch
.
zeros
(
self
.
init_latent
.
shape
[
0
],
5
,
self
.
init_latent
.
shape
[
-
2
],
self
.
init_latent
.
shape
[
-
1
],
self
.
init_latent
.
shape
[
0
],
5
,
1
,
1
,
dtype
=
self
.
init_latent
.
dtype
,
dtype
=
self
.
init_latent
.
dtype
,
device
=
self
.
init_latent
.
device
device
=
self
.
init_latent
.
device
)
)
...
...
modules/sd_samplers.py
View file @
92a17a7a
...
@@ -138,7 +138,7 @@ class VanillaStableDiffusionSampler:
...
@@ -138,7 +138,7 @@ class VanillaStableDiffusionSampler:
if
self
.
stop_at
is
not
None
and
self
.
step
>
self
.
stop_at
:
if
self
.
stop_at
is
not
None
and
self
.
step
>
self
.
stop_at
:
raise
InterruptedException
raise
InterruptedException
# Have to unwrap the inpainting conditioning here to perform pre-pr
e
ocessing
# Have to unwrap the inpainting conditioning here to perform pre-processing
image_conditioning
=
None
image_conditioning
=
None
if
isinstance
(
cond
,
dict
):
if
isinstance
(
cond
,
dict
):
image_conditioning
=
cond
[
"c_concat"
][
0
]
image_conditioning
=
cond
[
"c_concat"
][
0
]
...
@@ -146,7 +146,7 @@ class VanillaStableDiffusionSampler:
...
@@ -146,7 +146,7 @@ class VanillaStableDiffusionSampler:
unconditional_conditioning
=
unconditional_conditioning
[
"c_crossattn"
][
0
]
unconditional_conditioning
=
unconditional_conditioning
[
"c_crossattn"
][
0
]
conds_list
,
tensor
=
prompt_parser
.
reconstruct_multicond_batch
(
cond
,
self
.
step
)
conds_list
,
tensor
=
prompt_parser
.
reconstruct_multicond_batch
(
cond
,
self
.
step
)
unconditional_conditioning
=
prompt_parser
.
reconstruct_cond_batch
(
unconditional_conditioning
,
self
.
step
)
unconditional_conditioning
=
prompt_parser
.
reconstruct_cond_batch
(
unconditional_conditioning
,
self
.
step
)
assert
all
([
len
(
conds
)
==
1
for
conds
in
conds_list
]),
'composition via AND is not supported for DDIM/PLMS samplers'
assert
all
([
len
(
conds
)
==
1
for
conds
in
conds_list
]),
'composition via AND is not supported for DDIM/PLMS samplers'
cond
=
tensor
cond
=
tensor
...
@@ -165,6 +165,8 @@ class VanillaStableDiffusionSampler:
...
@@ -165,6 +165,8 @@ class VanillaStableDiffusionSampler:
img_orig
=
self
.
sampler
.
model
.
q_sample
(
self
.
init_latent
,
ts
)
img_orig
=
self
.
sampler
.
model
.
q_sample
(
self
.
init_latent
,
ts
)
x_dec
=
img_orig
*
self
.
mask
+
self
.
nmask
*
x_dec
x_dec
=
img_orig
*
self
.
mask
+
self
.
nmask
*
x_dec
# Wrap the image conditioning back up since the DDIM code can accept the dict directly.
# Note that they need to be lists because it just concatenates them later.
if
image_conditioning
is
not
None
:
if
image_conditioning
is
not
None
:
cond
=
{
"c_concat"
:
[
image_conditioning
],
"c_crossattn"
:
[
cond
]}
cond
=
{
"c_concat"
:
[
image_conditioning
],
"c_crossattn"
:
[
cond
]}
unconditional_conditioning
=
{
"c_concat"
:
[
image_conditioning
],
"c_crossattn"
:
[
unconditional_conditioning
]}
unconditional_conditioning
=
{
"c_concat"
:
[
image_conditioning
],
"c_crossattn"
:
[
unconditional_conditioning
]}
...
...
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