Fix paths for windows

windows install has an extra subdirectory 'ComfyUI' in the path

beats me
This commit is contained in:
Jan Minar
2024-10-02 22:16:44 +01:00
committed by GitHub
parent af5d09af56
commit 19322e7fc8
+7 -2
View File
@@ -34,9 +34,12 @@ def load_sam_image_model(
# 2. Check if the "models" and "models/sam2" directories exist
models_dir = os.path.join(current_working_directory, "models")
if not os.path.exists(models_dir):
# We're probably on Windows
models_dir = os.path.join(current_working_directory, "ComfyUI", "models")
sam2_dir = os.path.join(models_dir, "sam2")
if os.path.exists(models_dir):
if not os.path.exists(models_dir):
print(f"'models' directory exists: {models_dir}", flush=True)
else:
print(f"'models' directory does not exist: {models_dir}", flush=True)
@@ -52,7 +55,9 @@ def load_sam_image_model(
else:
print(f"'models/sam2/{checkpoint}' directory does not exist: {model_path}", flush=True)
model = build_sam2(config, model_path, device=device)
try:
model = build_sam2(config, model_path, device=device)
except:
return SAM2ImagePredictor(sam_model=model)