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
2ab2bce7
Commit
2ab2bce7
authored
Jan 22, 2023
by
invincibledude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hr conditioning
parent
c5d4c87c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
modules/processing.py
modules/processing.py
+12
-7
No files found.
modules/processing.py
View file @
2ab2bce7
...
@@ -235,7 +235,7 @@ class StableDiffusionProcessing:
...
@@ -235,7 +235,7 @@ class StableDiffusionProcessing:
def
init
(
self
,
all_prompts
,
all_seeds
,
all_subseeds
):
def
init
(
self
,
all_prompts
,
all_seeds
,
all_subseeds
):
pass
pass
def
sample
(
self
,
conditioning
,
unconditional_conditioning
,
hr_conditioning
,
hr_uconditional_conditioning
,
seeds
,
subseeds
,
subseed_strength
,
prompts
):
def
sample
(
self
,
conditioning
,
unconditional_conditioning
,
hr_conditioning
=
None
,
hr_unconditional_conditioning
=
None
,
seeds
,
subseeds
,
subseed_strength
,
prompts
):
raise
NotImplementedError
()
raise
NotImplementedError
()
def
close
(
self
):
def
close
(
self
):
...
@@ -517,7 +517,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -517,7 +517,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
p
.
all_negative_prompts
=
p
.
batch_size
*
p
.
n_iter
*
[
shared
.
prompt_styles
.
apply_negative_styles_to_prompt
(
p
.
negative_prompt
,
p
.
styles
)]
p
.
all_negative_prompts
=
p
.
batch_size
*
p
.
n_iter
*
[
shared
.
prompt_styles
.
apply_negative_styles_to_prompt
(
p
.
negative_prompt
,
p
.
styles
)]
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
p
.
enable_hr
:
if
p
.
enable_hr
and
p
.
hr_prompt
!=
''
:
if
type
(
p
.
prompt
)
==
list
:
if
type
(
p
.
prompt
)
==
list
:
p
.
all_hr_prompts
=
[
shared
.
prompt_styles
.
apply_styles_to_prompt
(
x
,
p
.
styles
)
for
x
in
p
.
hr_prompt
]
p
.
all_hr_prompts
=
[
shared
.
prompt_styles
.
apply_styles_to_prompt
(
x
,
p
.
styles
)
for
x
in
p
.
hr_prompt
]
else
:
else
:
...
@@ -601,7 +601,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -601,7 +601,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
negative_prompts
=
p
.
all_negative_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
negative_prompts
=
p
.
all_negative_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
p
.
enable_hr
:
if
p
.
enable_hr
and
p
.
hr_prompt
!=
''
:
hr_prompts
=
p
.
all_hr_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
hr_prompts
=
p
.
all_hr_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
hr_negative_prompts
=
p
.
all_negative_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
hr_negative_prompts
=
p
.
all_negative_prompts
[
n
*
p
.
batch_size
:(
n
+
1
)
*
p
.
batch_size
]
...
@@ -619,7 +619,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -619,7 +619,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
uc
=
get_conds_with_caching
(
prompt_parser
.
get_learned_conditioning
,
negative_prompts
,
p
.
steps
,
cached_uc
)
uc
=
get_conds_with_caching
(
prompt_parser
.
get_learned_conditioning
,
negative_prompts
,
p
.
steps
,
cached_uc
)
c
=
get_conds_with_caching
(
prompt_parser
.
get_multicond_learned_conditioning
,
prompts
,
p
.
steps
,
cached_c
)
c
=
get_conds_with_caching
(
prompt_parser
.
get_multicond_learned_conditioning
,
prompts
,
p
.
steps
,
cached_c
)
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
p
.
enable_hr
:
if
p
.
enable_hr
and
p
.
hr_prompt
!=
''
:
hr_uc
=
get_conds_with_caching
(
prompt_parser
.
get_learned_conditioning
,
hr_negative_prompts
,
p
.
steps
,
hr_uc
=
get_conds_with_caching
(
prompt_parser
.
get_learned_conditioning
,
hr_negative_prompts
,
p
.
steps
,
cached_uc
)
cached_uc
)
hr_c
=
get_conds_with_caching
(
prompt_parser
.
get_multicond_learned_conditioning
,
hr_prompts
,
p
.
steps
,
hr_c
=
get_conds_with_caching
(
prompt_parser
.
get_multicond_learned_conditioning
,
hr_prompts
,
p
.
steps
,
...
@@ -635,7 +635,12 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -635,7 +635,12 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
with
devices
.
autocast
():
with
devices
.
autocast
():
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
type
(
p
)
==
StableDiffusionProcessingTxt2Img
:
if
p
.
enable_hr
:
if
p
.
enable_hr
:
samples_ddim
=
p
.
sample
(
conditioning
=
c
,
unconditional_conditioning
=
uc
,
hr_conditioning
=
hr_c
,
hr_unconditional_conditioning
=
hr_uc
,
seeds
=
seeds
,
subseeds
=
subseeds
,
subseed_strength
=
p
.
subseed_strength
,
prompts
=
prompts
)
if
p
.
hr_prompts
!=
''
:
samples_ddim
=
p
.
sample
(
conditioning
=
c
,
unconditional_conditioning
=
uc
,
hr_conditioning
=
hr_c
,
hr_unconditional_conditioning
=
hr_uc
,
seeds
=
seeds
,
subseeds
=
subseeds
,
subseed_strength
=
p
.
subseed_strength
,
prompts
=
prompts
)
else
:
samples_ddim
=
p
.
sample
(
conditioning
=
c
,
unconditional_conditioning
=
uc
,
hr_conditioning
=
c
,
hr_unconditional_conditioning
=
uc
,
seeds
=
seeds
,
subseeds
=
subseeds
,
subseed_strength
=
p
.
subseed_strength
,
prompts
=
prompts
)
else
:
else
:
samples_ddim
=
p
.
sample
(
conditioning
=
c
,
unconditional_conditioning
=
uc
,
seeds
=
seeds
,
subseeds
=
subseeds
,
samples_ddim
=
p
.
sample
(
conditioning
=
c
,
unconditional_conditioning
=
uc
,
seeds
=
seeds
,
subseeds
=
subseeds
,
subseed_strength
=
p
.
subseed_strength
,
prompts
=
prompts
)
subseed_strength
=
p
.
subseed_strength
,
prompts
=
prompts
)
...
@@ -756,8 +761,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
...
@@ -756,8 +761,8 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
self
.
hr_upscale_to_x
=
hr_resize_x
self
.
hr_upscale_to_x
=
hr_resize_x
self
.
hr_upscale_to_y
=
hr_resize_y
self
.
hr_upscale_to_y
=
hr_resize_y
self
.
hr_sampler
=
hr_sampler
self
.
hr_sampler
=
hr_sampler
self
.
hr_prompt
=
hr_prompt
if
hr_prompt
!=
''
else
self
.
prompt
self
.
hr_prompt
=
hr_prompt
if
hr_prompt
!=
''
else
''
self
.
hr_negative_prompt
=
hr_negative_prompt
if
hr_negative_prompt
!=
''
else
self
.
negative_prompt
self
.
hr_negative_prompt
=
hr_negative_prompt
if
hr_negative_prompt
!=
''
else
''
self
.
all_hr_prompts
=
None
self
.
all_hr_prompts
=
None
self
.
all_hr_negative_prompts
=
None
self
.
all_hr_negative_prompts
=
None
...
...
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