mirror of https://github.com/vladmandic/automatic
fix models dir
parent
08d7829478
commit
6c66228cde
|
|
@ -1,9 +1,9 @@
|
|||
# defaults
|
||||
__pycache__
|
||||
setup.log
|
||||
/cache.json
|
||||
/config.json
|
||||
/params.txt
|
||||
/setup.log
|
||||
/styles.csv
|
||||
/ui-config.json
|
||||
/user.css
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import importlib
|
||||
|
|
@ -21,20 +20,11 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
|
|||
@return: A list of paths containing the desired model(s)
|
||||
"""
|
||||
output = []
|
||||
|
||||
try:
|
||||
places = []
|
||||
|
||||
if command_path is not None and command_path != model_path:
|
||||
pretrained_path = os.path.join(command_path, 'experiments/pretrained_models')
|
||||
if os.path.exists(pretrained_path):
|
||||
print(f"Appending path: {pretrained_path}")
|
||||
places.append(pretrained_path)
|
||||
elif os.path.exists(command_path):
|
||||
places.append(command_path)
|
||||
|
||||
places.append(model_path)
|
||||
|
||||
if command_path is not None and command_path != model_path and os.path.isdir(command_path):
|
||||
places.append(command_path)
|
||||
for place in places:
|
||||
for full_path in shared.walk_files(place, allowed_extensions=ext_filter):
|
||||
if os.path.islink(full_path) and not os.path.exists(full_path):
|
||||
|
|
@ -44,7 +34,6 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
|
|||
continue
|
||||
if full_path not in output:
|
||||
output.append(full_path)
|
||||
|
||||
if model_url is not None and len(output) == 0:
|
||||
if download_name is not None:
|
||||
from basicsr.utils.download_util import load_file_from_url
|
||||
|
|
@ -52,7 +41,6 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
|
|||
output.append(dl)
|
||||
else:
|
||||
output.append(model_url)
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ def checkpoint_tiles():
|
|||
|
||||
def list_models():
|
||||
global model_path # pylint: disable=global-statement
|
||||
model_path = shared.opts.ckpt_dir
|
||||
model_path = shared.cmd_opts.models_dir
|
||||
checkpoints_list.clear()
|
||||
checkpoint_aliases.clear()
|
||||
model_list = modelloader.load_models(model_path=model_path, model_url=None, command_path=shared.opts.ckpt_dir, ext_filter=[".ckpt", ".safetensors"], download_name=None, ext_blacklist=[".vae.ckpt", ".vae.safetensors"])
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ kornia
|
|||
lark
|
||||
lmdb
|
||||
lpips
|
||||
numpy
|
||||
omegaconf
|
||||
open-clip-torch
|
||||
opencv-contrib-python
|
||||
|
|
@ -54,6 +53,7 @@ diffusers==0.16.1
|
|||
einops==0.4.1
|
||||
gradio==3.29.0
|
||||
numexpr==2.8.4
|
||||
numpy==1.24.3
|
||||
pandas==1.5.3
|
||||
protobuf==3.20.3
|
||||
pytorch_lightning==1.9.4
|
||||
|
|
|
|||
Loading…
Reference in New Issue