Fix paths for windows
windows install has an extra subdirectory 'ComfyUI' in the path beats me
This commit is contained in:
+7
-2
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user