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
7e3539df
Commit
7e3539df
authored
May 13, 2023
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix upscalers disappearing after the user reloads UI
parent
47719935
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
22 deletions
+11
-22
modules/modelloader.py
modules/modelloader.py
+10
-17
webui.py
webui.py
+1
-5
No files found.
modules/modelloader.py
View file @
7e3539df
...
...
@@ -117,20 +117,6 @@ def move_files(src_path: str, dest_path: str, ext_filter: str = None):
pass
builtin_upscaler_classes
=
[]
forbidden_upscaler_classes
=
set
()
def
list_builtin_upscalers
():
builtin_upscaler_classes
.
clear
()
builtin_upscaler_classes
.
extend
(
Upscaler
.
__subclasses__
())
def
forbid_loaded_nonbuiltin_upscalers
():
for
cls
in
Upscaler
.
__subclasses__
():
if
cls
not
in
builtin_upscaler_classes
:
forbidden_upscaler_classes
.
add
(
cls
)
def
load_upscalers
():
# We can only do this 'magic' method to dynamically load upscalers if they are referenced,
# so we'll try to import any _model.py files before looking in __subclasses__
...
...
@@ -146,10 +132,17 @@ def load_upscalers():
datas
=
[]
commandline_options
=
vars
(
shared
.
cmd_opts
)
for
cls
in
Upscaler
.
__subclasses__
():
if
cls
in
forbidden_upscaler_classes
:
continue
# some of upscaler classes will not go away after reloading their modules, and we'll end
# up with two copies of those classes. The newest copy will always be the last in the list,
# so we go from end to beginning and ignore duplicates
used_classes
=
{}
for
cls
in
reversed
(
Upscaler
.
__subclasses__
()):
classname
=
str
(
cls
)
if
classname
not
in
used_classes
:
used_classes
[
classname
]
=
cls
for
cls
in
reversed
(
used_classes
.
values
()):
name
=
cls
.
__name__
cmd_name
=
f
"{name.lower().replace('upscaler', '')}_models_path"
scaler
=
cls
(
commandline_options
.
get
(
cmd_name
,
None
))
...
...
webui.py
View file @
7e3539df
...
...
@@ -181,14 +181,11 @@ def initialize():
gfpgan
.
setup_model
(
cmd_opts
.
gfpgan_models_path
)
startup_timer
.
record
(
"setup gfpgan"
)
modelloader
.
list_builtin_upscalers
()
startup_timer
.
record
(
"list builtin upscalers"
)
modules
.
scripts
.
load_scripts
()
startup_timer
.
record
(
"load scripts"
)
modelloader
.
load_upscalers
()
#
startup_timer.record("load upscalers") #Is this necessary? I don't know.
startup_timer
.
record
(
"load upscalers"
)
#Is this necessary? I don't know.
modules
.
sd_vae
.
refresh_vae_list
()
startup_timer
.
record
(
"refresh VAE"
)
...
...
@@ -388,7 +385,6 @@ def webui():
localization
.
list_localizations
(
cmd_opts
.
localizations_dir
)
modelloader
.
forbid_loaded_nonbuiltin_upscalers
()
modules
.
scripts
.
reload_scripts
()
startup_timer
.
record
(
"load scripts"
)
...
...
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