This commit is contained in:
Eric Lam
2025-05-18 22:09:13 -07:00
parent d9a36dc901
commit 82895efcec
3 changed files with 55 additions and 8 deletions
+31 -1
View File
@@ -891,6 +891,21 @@ def check_model_installed(json_obj):
return True
return False
def get_base_folder_path(model_dir_name, filename, url):
if filename == '<huggingface>':
filename = os.path.basename(url)
dirs = folder_paths.get_folder_paths(model_dir_name)
results = []
for x in dirs:
full_path = os.path.join(x, filename)
if os.path.exists(full_path):
results.append(full_path)
return results
model_dir_names = ['checkpoints', 'loras', 'vae', 'text_encoders', 'diffusion_models', 'clip_vision', 'embeddings',
'diffusers', 'vae_approx', 'controlnet', 'gligen', 'upscale_models', 'hypernetworks',
@@ -902,19 +917,34 @@ def check_model_installed(json_obj):
total_models_files.add(y)
def process_model_phase(item):
def add_to_full_paths(path):
if 'full_paths' in item:
item['full_paths'].append(path)
else:
item['full_paths'] = [ path ]
if 'diffusion' not in item['filename'] and 'pytorch' not in item['filename'] and 'model' not in item['filename']:
model_dir_name = model_dir_name_map.get(item['type'].lower())
full_paths = get_base_folder_path(model_dir_name, item['filename'], item['url'])
item['group'] = f"A"
# non-general name case
if item['filename'] in total_models_files:
item['installed'] = 'True'
item['full_paths'] = full_paths
return
if item['save_path'] == 'default':
item['group'] = 'B'
model_dir_name = model_dir_name_map.get(item['type'].lower())
if model_dir_name is not None:
item['installed'] = str(is_exists(model_dir_name, item['filename'], item['url']))
else:
item['installed'] = 'False'
else:
item['group'] = 'C'
model_dir_name = item['save_path'].split('/')[0]
if model_dir_name in folder_paths.folder_names_and_paths:
if is_exists(model_dir_name, item['filename'], item['url']):
@@ -937,7 +967,7 @@ def check_model_installed(json_obj):
if os.path.exists(fullpath):
item['installed'] = 'True'
item['folder_path_source'] = base_path
add_to_full_paths(fullpath)
with concurrent.futures.ThreadPoolExecutor(8) as executor:
for item in json_obj['models']: