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
53924aea
Commit
53924aea
authored
Jul 08, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jul 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11477 from hako-mikan/master
add `before_hr` script callback
parents
953147bf
b0ec69b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
modules/processing.py
modules/processing.py
+3
-0
modules/scripts.py
modules/scripts.py
+14
-0
No files found.
modules/processing.py
View file @
53924aea
...
...
@@ -1078,6 +1078,9 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
sd_models
.
apply_token_merging
(
self
.
sd_model
,
self
.
get_token_merging_ratio
(
for_hr
=
True
))
if
self
.
scripts
is
not
None
:
self
.
scripts
.
before_hr
(
self
)
samples
=
self
.
sampler
.
sample_img2img
(
self
,
samples
,
noise
,
self
.
hr_c
,
self
.
hr_uc
,
steps
=
self
.
hr_second_pass_steps
or
self
.
steps
,
image_conditioning
=
image_conditioning
)
sd_models
.
apply_token_merging
(
self
.
sd_model
,
self
.
get_token_merging_ratio
())
...
...
modules/scripts.py
View file @
53924aea
...
...
@@ -187,6 +187,11 @@ class Script:
return
f
'script_{tabname}{title}_{item_id}'
def
before_hr
(
self
,
p
,
*
args
):
"""
This function is called before hires fix start.
"""
pass
current_basedir
=
paths
.
script_path
...
...
@@ -549,6 +554,15 @@ class ScriptRunner:
self
.
scripts
[
si
]
.
args_to
=
args_to
def
before_hr
(
self
,
p
):
for
script
in
self
.
alwayson_scripts
:
try
:
script_args
=
p
.
script_args
[
script
.
args_from
:
script
.
args_to
]
script
.
before_hr
(
p
,
*
script_args
)
except
Exception
:
errors
.
report
(
f
"Error running before_hr: {script.filename}"
,
exc_info
=
True
)
scripts_txt2img
:
ScriptRunner
=
None
scripts_img2img
:
ScriptRunner
=
None
scripts_postproc
:
scripts_postprocessing
.
ScriptPostprocessingRunner
=
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