Spaces:
Runtime error
Runtime error
Update models.py
Browse files
models.py
CHANGED
|
@@ -87,13 +87,6 @@ def load_face_analysis():
|
|
| 87 |
"scrfd_10g_bnkps.onnx"
|
| 88 |
]
|
| 89 |
|
| 90 |
-
# Download config to control download location
|
| 91 |
-
download_config = HfHubDownloadConfig(
|
| 92 |
-
local_dir=local_model_path,
|
| 93 |
-
local_dir_use_symlinks=False,
|
| 94 |
-
resume_download=True
|
| 95 |
-
)
|
| 96 |
-
|
| 97 |
for file_name in required_files:
|
| 98 |
local_file_path = os.path.join(local_model_path, file_name)
|
| 99 |
|
|
@@ -304,7 +297,7 @@ def load_sdxl_pipeline(controlnets):
|
|
| 304 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 305 |
controlnet=controlnets,
|
| 306 |
torch_dtype=dtype,
|
| 307 |
-
|
| 308 |
).to(device)
|
| 309 |
return pipe, False
|
| 310 |
|
|
@@ -490,7 +483,7 @@ def optimize_pipeline(pipe):
|
|
| 490 |
pipe.enable_xformers_memory_efficient_attention()
|
| 491 |
print(" [OK] xformers enabled")
|
| 492 |
except Exception as e:
|
| 493 |
-
print(f" [INFO]
|
| 494 |
|
| 495 |
|
| 496 |
def load_caption_model():
|
|
@@ -526,7 +519,7 @@ def load_caption_model():
|
|
| 526 |
torch_dtype=dtype
|
| 527 |
).to(device)
|
| 528 |
print(" [OK] BLIP base model loaded (standard captions)")
|
| 529 |
-
return
|
| 530 |
except Exception as e2:
|
| 531 |
print(f" [WARNING] Caption models not available: {e2}")
|
| 532 |
print(" Caption generation will be disabled")
|
|
|
|
| 87 |
"scrfd_10g_bnkps.onnx"
|
| 88 |
]
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
for file_name in required_files:
|
| 91 |
local_file_path = os.path.join(local_model_path, file_name)
|
| 92 |
|
|
|
|
| 297 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 298 |
controlnet=controlnets,
|
| 299 |
torch_dtype=dtype,
|
| 300 |
+
use_safetponsors=True
|
| 301 |
).to(device)
|
| 302 |
return pipe, False
|
| 303 |
|
|
|
|
| 483 |
pipe.enable_xformers_memory_efficient_attention()
|
| 484 |
print(" [OK] xformers enabled")
|
| 485 |
except Exception as e:
|
| 486 |
+
print(f" [INFO] xformers not available: {e}")
|
| 487 |
|
| 488 |
|
| 489 |
def load_caption_model():
|
|
|
|
| 519 |
torch_dtype=dtype
|
| 520 |
).to(device)
|
| 521 |
print(" [OK] BLIP base model loaded (standard captions)")
|
| 522 |
+
return caption_primary, caption_model, True, 'blip'
|
| 523 |
except Exception as e2:
|
| 524 |
print(f" [WARNING] Caption models not available: {e2}")
|
| 525 |
print(" Caption generation will be disabled")
|