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
7c13ffdb
Commit
7c13ffdb
authored
Dec 30, 2023
by
AUTOMATIC1111
Committed by
GitHub
Dec 30, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14472 from akx/drop-move-code
Remove `cleanup_models` code
parents
a86f4411
5fbb13e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
53 deletions
+0
-53
modules/initialize.py
modules/initialize.py
+0
-3
modules/modelloader.py
modules/modelloader.py
+0
-50
No files found.
modules/initialize.py
View file @
7c13ffdb
...
@@ -54,9 +54,6 @@ def initialize():
...
@@ -54,9 +54,6 @@ def initialize():
initialize_util
.
configure_sigint_handler
()
initialize_util
.
configure_sigint_handler
()
initialize_util
.
configure_opts_onchange
()
initialize_util
.
configure_opts_onchange
()
from
modules
import
modelloader
modelloader
.
cleanup_models
()
from
modules
import
sd_models
from
modules
import
sd_models
sd_models
.
setup_model
()
sd_models
.
setup_model
()
startup_timer
.
record
(
"setup SD model"
)
startup_timer
.
record
(
"setup SD model"
)
...
...
modules/modelloader.py
View file @
7c13ffdb
...
@@ -2,7 +2,6 @@ from __future__ import annotations
...
@@ -2,7 +2,6 @@ from __future__ import annotations
import
logging
import
logging
import
os
import
os
import
shutil
import
importlib
import
importlib
from
urllib.parse
import
urlparse
from
urllib.parse
import
urlparse
...
@@ -10,7 +9,6 @@ import torch
...
@@ -10,7 +9,6 @@ import torch
from
modules
import
shared
from
modules
import
shared
from
modules.upscaler
import
Upscaler
,
UpscalerLanczos
,
UpscalerNearest
,
UpscalerNone
from
modules.upscaler
import
Upscaler
,
UpscalerLanczos
,
UpscalerNearest
,
UpscalerNone
from
modules.paths
import
script_path
,
models_path
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -96,54 +94,6 @@ def friendly_name(file: str):
...
@@ -96,54 +94,6 @@ def friendly_name(file: str):
return
model_name
return
model_name
def
cleanup_models
():
# This code could probably be more efficient if we used a tuple list or something to store the src/destinations
# and then enumerate that, but this works for now. In the future, it'd be nice to just have every "model" scaler
# somehow auto-register and just do these things...
root_path
=
script_path
src_path
=
models_path
dest_path
=
os
.
path
.
join
(
models_path
,
"Stable-diffusion"
)
move_files
(
src_path
,
dest_path
,
".ckpt"
)
move_files
(
src_path
,
dest_path
,
".safetensors"
)
src_path
=
os
.
path
.
join
(
root_path
,
"ESRGAN"
)
dest_path
=
os
.
path
.
join
(
models_path
,
"ESRGAN"
)
move_files
(
src_path
,
dest_path
)
src_path
=
os
.
path
.
join
(
models_path
,
"BSRGAN"
)
dest_path
=
os
.
path
.
join
(
models_path
,
"ESRGAN"
)
move_files
(
src_path
,
dest_path
,
".pth"
)
src_path
=
os
.
path
.
join
(
root_path
,
"gfpgan"
)
dest_path
=
os
.
path
.
join
(
models_path
,
"GFPGAN"
)
move_files
(
src_path
,
dest_path
)
src_path
=
os
.
path
.
join
(
root_path
,
"SwinIR"
)
dest_path
=
os
.
path
.
join
(
models_path
,
"SwinIR"
)
move_files
(
src_path
,
dest_path
)
src_path
=
os
.
path
.
join
(
root_path
,
"repositories/latent-diffusion/experiments/pretrained_models/"
)
dest_path
=
os
.
path
.
join
(
models_path
,
"LDSR"
)
move_files
(
src_path
,
dest_path
)
def
move_files
(
src_path
:
str
,
dest_path
:
str
,
ext_filter
:
str
=
None
):
try
:
os
.
makedirs
(
dest_path
,
exist_ok
=
True
)
if
os
.
path
.
exists
(
src_path
):
for
file
in
os
.
listdir
(
src_path
):
fullpath
=
os
.
path
.
join
(
src_path
,
file
)
if
os
.
path
.
isfile
(
fullpath
):
if
ext_filter
is
not
None
:
if
ext_filter
not
in
file
:
continue
print
(
f
"Moving {file} from {src_path} to {dest_path}."
)
try
:
shutil
.
move
(
fullpath
,
dest_path
)
except
Exception
:
pass
if
len
(
os
.
listdir
(
src_path
))
==
0
:
print
(
f
"Removing empty folder: {src_path}"
)
shutil
.
rmtree
(
src_path
,
True
)
except
Exception
:
pass
def
load_upscalers
():
def
load_upscalers
():
# We can only do this 'magic' method to dynamically load upscalers if they are referenced,
# 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__
# so we'll try to import any _model.py files before looking in __subclasses__
...
...
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