Skip to content

Commit 9f93cf6

Browse files
committed
fix: resolve circular dependency for sha256, update files and init cache after initial model download
fixes lllyasviel/Fooocus#2372 (cherry picked from commit 5c43a4bece059a70fc6246dd01622093cac2c0c9)
1 parent 1f429ff commit 9f93cf6

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

launch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def ini_args():
8585
print("Set hf_mirror to:", args.hf_mirror)
8686

8787
from modules import config
88+
from modules.hash_cache import init_cache
8889
os.environ["U2NET_HOME"] = config.path_inpaint
8990

9091
os.environ['GRADIO_TEMP_DIR'] = config.temp_path
@@ -140,4 +141,7 @@ def download_models(default_model, previous_default_models, checkpoint_downloads
140141
config.default_base_model_name, config.previous_default_models, config.checkpoint_downloads,
141142
config.embeddings_downloads, config.lora_downloads, config.vae_downloads)
142143

144+
config.update_files()
145+
init_cache(config.model_filenames, config.paths_checkpoints, config.lora_filenames, config.paths_loras)
146+
143147
from webui import *

modules/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import tempfile
88
import modules.flags
99
import modules.sdxl_styles
10-
from modules.hash_cache import init_cache
1110

1211
from modules.model_loader import load_file_from_url
1312
from modules.extra_utils import makedirs_with_log, get_files_from_folder, try_eval_env_var
@@ -889,7 +888,3 @@ def downloading_sam_vit_h():
889888
file_name='sam_vit_h_4b8939.pth'
890889
)
891890
return os.path.join(path_sam, 'sam_vit_h_4b8939.pth')
892-
893-
894-
update_files()
895-
init_cache(model_filenames, paths_checkpoints, lora_filenames, paths_loras)

modules/hash_cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
from multiprocessing import cpu_count
55

66
import args_manager
7-
from modules.util import get_file_from_folder_list
8-
from modules.util import sha256, HASH_SHA256_LENGTH
7+
from modules.util import sha256, HASH_SHA256_LENGTH, get_file_from_folder_list
98

109
hash_cache_filename = 'hash_cache.txt'
1110
hash_cache = {}

0 commit comments

Comments
 (0)