Skip to content

Commit f16c605

Browse files
committed
Fix model paths
1 parent 0ba83c0 commit f16c605

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/inference_core_nodes/prompt_expansion/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010
def _add_folder_paths():
1111
from pathlib import Path
1212
import folder_paths
13-
14-
folder_paths.add_model_folder_path(
15-
MODEL_FOLDER_NAME,
16-
str(Path(folder_paths.models_dir).joinpath(MODEL_FOLDER_NAME)),
17-
)
13+
14+
folder_names_and_paths = folder_paths.folder_names_and_paths
15+
16+
model_folder_path = str(Path(folder_paths.models_dir).joinpath(MODEL_FOLDER_NAME))
17+
supported_extensions = {'.ckpt', '.pt', '.bin', '.pth', '.safetensors'}
18+
19+
if MODEL_FOLDER_NAME in folder_names_and_paths:
20+
folder_names_and_paths[MODEL_FOLDER_NAME][0].append(model_folder_path)
21+
else:
22+
folder_names_and_paths[MODEL_FOLDER_NAME] = ([model_folder_path], supported_extensions)
1823

1924

2025
_add_folder_paths()

src/inference_core_nodes/prompt_expansion/prompt_expansion.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ def expand_and_join(self, prompt: str, seed: int) -> str:
101101
@cache
102102
def load_expansion_runner(model_name: str):
103103
model_path = folder_paths.get_full_path(MODEL_FOLDER_NAME, model_name)
104+
105+
# If model is a file, use the parent directory
106+
if Path(model_path).is_file():
107+
model_path = str(Path(model_path).parent)
108+
104109
return FooocusExpansion(model_path)
105110

106111

0 commit comments

Comments
 (0)