mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: only use hash cache logs for exceptions
This commit is contained in:
@@ -762,12 +762,14 @@ if args_manager.args.rebuild_hash_cache:
|
|||||||
from modules.hash_cache import sha256_from_cache
|
from modules.hash_cache import sha256_from_cache
|
||||||
from modules.util import get_file_from_folder_list
|
from modules.util import get_file_from_folder_list
|
||||||
|
|
||||||
|
print('[Cache] Rebuilding hash cache')
|
||||||
for filename in model_filenames:
|
for filename in model_filenames:
|
||||||
filepath = get_file_from_folder_list(filename, paths_checkpoints)
|
filepath = get_file_from_folder_list(filename, paths_checkpoints)
|
||||||
sha256_from_cache(filepath)
|
sha256_from_cache(filepath)
|
||||||
for filename in lora_filenames:
|
for filename in lora_filenames:
|
||||||
filepath = get_file_from_folder_list(filename, paths_loras)
|
filepath = get_file_from_folder_list(filename, paths_loras)
|
||||||
sha256_from_cache(filepath)
|
sha256_from_cache(filepath)
|
||||||
|
print('[Cache] Done')
|
||||||
|
|
||||||
# write cache to file again for sorting and cleanup of invalid cache entries
|
# write cache to file again for sorting and cleanup of invalid cache entries
|
||||||
save_cache_to_file()
|
save_cache_to_file()
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ def load_cache_from_file():
|
|||||||
print(f'[Cache] Skipping invalid cache entry: {filepath}')
|
print(f'[Cache] Skipping invalid cache entry: {filepath}')
|
||||||
continue
|
continue
|
||||||
hash_cache[filepath] = hash_value
|
hash_cache[filepath] = hash_value
|
||||||
print(f'[Cache] Warmed cache from file')
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'[Cache] Warming failed: {e}')
|
print(f'[Cache] Loading failed: {e}')
|
||||||
|
|
||||||
|
|
||||||
def save_cache_to_file(filename=None, hash_value=None):
|
def save_cache_to_file(filename=None, hash_value=None):
|
||||||
@@ -50,6 +49,5 @@ def save_cache_to_file(filename=None, hash_value=None):
|
|||||||
for filepath, hash_value in items:
|
for filepath, hash_value in items:
|
||||||
json.dump({filepath: hash_value}, fp)
|
json.dump({filepath: hash_value}, fp)
|
||||||
fp.write('\n')
|
fp.write('\n')
|
||||||
print(f'[Cache] Updated cache file')
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'[Cache] Saving failed: {e}')
|
print(f'[Cache] Saving failed: {e}')
|
||||||
|
|||||||
Reference in New Issue
Block a user