Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
2d006ce1
Commit
2d006ce1
authored
Oct 09, 2022
by
Milly
Committed by
AUTOMATIC1111
Oct 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xy_grid: Find hypernetwork by closest name
parent
4aeacaef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
hypernetwork.py
modules/hypernetworks/hypernetwork.py
+11
-0
xy_grid.py
scripts/xy_grid.py
+5
-1
No files found.
modules/hypernetworks/hypernetwork.py
View file @
2d006ce1
...
@@ -120,6 +120,17 @@ def load_hypernetwork(filename):
...
@@ -120,6 +120,17 @@ def load_hypernetwork(filename):
shared
.
loaded_hypernetwork
=
None
shared
.
loaded_hypernetwork
=
None
def
find_closest_hypernetwork_name
(
search
:
str
):
if
not
search
:
return
None
search
=
search
.
lower
()
applicable
=
[
name
for
name
in
shared
.
hypernetworks
if
search
in
name
.
lower
()]
if
not
applicable
:
return
None
applicable
=
sorted
(
applicable
,
key
=
lambda
name
:
len
(
name
))
return
applicable
[
0
]
def
apply_hypernetwork
(
hypernetwork
,
context
,
layer
=
None
):
def
apply_hypernetwork
(
hypernetwork
,
context
,
layer
=
None
):
hypernetwork_layers
=
(
hypernetwork
.
layers
if
hypernetwork
is
not
None
else
{})
.
get
(
context
.
shape
[
2
],
None
)
hypernetwork_layers
=
(
hypernetwork
.
layers
if
hypernetwork
is
not
None
else
{})
.
get
(
context
.
shape
[
2
],
None
)
...
...
scripts/xy_grid.py
View file @
2d006ce1
...
@@ -84,7 +84,11 @@ def apply_checkpoint(p, x, xs):
...
@@ -84,7 +84,11 @@ def apply_checkpoint(p, x, xs):
def
apply_hypernetwork
(
p
,
x
,
xs
):
def
apply_hypernetwork
(
p
,
x
,
xs
):
hypernetwork
.
load_hypernetwork
(
x
)
if
x
.
lower
()
in
[
""
,
"none"
]:
name
=
None
else
:
name
=
hypernetwork
.
find_closest_hypernetwork_name
(
x
)
hypernetwork
.
load_hypernetwork
(
name
)
def
apply_clip_skip
(
p
,
x
,
xs
):
def
apply_clip_skip
(
p
,
x
,
xs
):
...
...
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