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
eeb07330
Commit
eeb07330
authored
Nov 04, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change process_one virtual function for script to process_batch, add extra args and docs
parent
99043f33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
modules/processing.py
modules/processing.py
+1
-1
modules/scripts.py
modules/scripts.py
+11
-5
No files found.
modules/processing.py
View file @
eeb07330
...
...
@@ -502,7 +502,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
break
if
p
.
scripts
is
not
None
:
p
.
scripts
.
process_
one
(
p
,
n
)
p
.
scripts
.
process_
batch
(
p
,
batch_number
=
n
,
prompts
=
prompts
,
seeds
=
seeds
,
subseeds
=
subseeds
)
with
devices
.
autocast
():
uc
=
prompt_parser
.
get_learned_conditioning
(
shared
.
sd_model
,
len
(
prompts
)
*
[
p
.
negative_prompt
],
p
.
steps
)
...
...
modules/scripts.py
View file @
eeb07330
...
...
@@ -73,9 +73,15 @@ class Script:
pass
def
process_
one
(
self
,
p
,
n
,
*
args
):
def
process_
batch
(
self
,
p
,
*
args
,
**
kw
args
):
"""
Same as process(), but called for every iteration
Same as process(), but called for every batch.
**kwargs will have those items:
- batch_number - index of current batch, from 0 to number of batches-1
- prompts - list of prompts for current batch; you can change contents of this list but changing the number of entries will likely break things
- seeds - list of seeds for current batch
- subseeds - list of subseeds for current batch
"""
pass
...
...
@@ -303,13 +309,13 @@ class ScriptRunner:
print
(
f
"Error running process: {script.filename}"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
def
process_
one
(
self
,
p
,
n
):
def
process_
batch
(
self
,
p
,
**
kwargs
):
for
script
in
self
.
alwayson_scripts
:
try
:
script_args
=
p
.
script_args
[
script
.
args_from
:
script
.
args_to
]
script
.
process_
one
(
p
,
n
,
*
script_
args
)
script
.
process_
batch
(
p
,
*
script_args
,
**
kw
args
)
except
Exception
:
print
(
f
"Error running process_
one
: {script.filename}"
,
file
=
sys
.
stderr
)
print
(
f
"Error running process_
batch
: {script.filename}"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
def
postprocess
(
self
,
p
,
processed
):
...
...
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