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
10923f9b
Commit
10923f9b
authored
Nov 27, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
calculate dictionary for sampler names only once
parent
40ca34b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
12 deletions
+9
-12
modules/sd_samplers.py
modules/sd_samplers.py
+7
-0
scripts/xy_grid.py
scripts/xy_grid.py
+2
-12
No files found.
modules/sd_samplers.py
View file @
10923f9b
...
...
@@ -52,6 +52,7 @@ all_samplers_map = {x.name: x for x in all_samplers}
samplers
=
[]
samplers_for_img2img
=
[]
samplers_map
=
{}
def
create_sampler
(
name
,
model
):
...
...
@@ -77,6 +78,12 @@ def set_samplers():
samplers
=
[
x
for
x
in
all_samplers
if
x
.
name
not
in
hidden
]
samplers_for_img2img
=
[
x
for
x
in
all_samplers
if
x
.
name
not
in
hidden_img2img
]
samplers_map
.
clear
()
for
sampler
in
all_samplers
:
samplers_map
[
sampler
.
name
.
lower
()]
=
sampler
.
name
for
alias
in
sampler
.
aliases
:
samplers_map
[
alias
.
lower
()]
=
sampler
.
name
set_samplers
()
...
...
scripts/xy_grid.py
View file @
10923f9b
...
...
@@ -58,19 +58,10 @@ def apply_order(p, x, xs):
prompt_tmp
+=
part
prompt_tmp
+=
x
[
idx
]
p
.
prompt
=
prompt_tmp
+
p
.
prompt
def
build_samplers_dict
():
samplers_dict
=
{}
for
sampler
in
sd_samplers
.
all_samplers
:
samplers_dict
[
sampler
.
name
.
lower
()]
=
sampler
.
name
for
alias
in
sampler
.
aliases
:
samplers_dict
[
alias
.
lower
()]
=
sampler
.
name
return
samplers_dict
def
apply_sampler
(
p
,
x
,
xs
):
sampler_name
=
build_samplers_dict
()
.
get
(
x
.
lower
(),
None
)
sampler_name
=
sd_samplers
.
samplers_map
.
get
(
x
.
lower
(),
None
)
if
sampler_name
is
None
:
raise
RuntimeError
(
f
"Unknown sampler: {x}"
)
...
...
@@ -78,9 +69,8 @@ def apply_sampler(p, x, xs):
def
confirm_samplers
(
p
,
xs
):
samplers_dict
=
build_samplers_dict
()
for
x
in
xs
:
if
x
.
lower
()
not
in
s
amplers_dict
:
if
x
.
lower
()
not
in
s
d_samplers
.
samplers_map
:
raise
RuntimeError
(
f
"Unknown sampler: {x}"
)
...
...
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