Spaces:
Running
Running
Developer
commited on
Commit
Β·
84c5aae
1
Parent(s):
e90532d
π§ FIX MODEL LOADING: Check downloaded_models directory
Browse filesβ
CRITICAL FIX: Modified load_model() to check downloaded_models/
β
PRIORITY: Check downloaded_models/video and downloaded_models/audio first
β
VALIDATION: Verify files exist (>5 files in each directory)
β
SUCCESS PATH: Set model_loaded = True when downloaded models found
β
FALLBACK: Still check traditional pretrained_models/ paths
π Problem solved:
- Models downloaded via /download-models to downloaded_models/
- But load_model() was only checking pretrained_models/
- Now checks BOTH locations with downloaded_models/ as priority
π Result:
- Video generation API should work after HF Spaces rebuild
- Downloaded models will be properly detected and loaded
app.py
CHANGED
|
@@ -298,17 +298,29 @@ class OmniAvatarAPI:
|
|
| 298 |
"""Load the OmniAvatar model - now more flexible"""
|
| 299 |
try:
|
| 300 |
# Check if models are downloaded (but don't require them)
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
"./pretrained_models/wav2vec2-base-960h"
|
| 305 |
-
]
|
| 306 |
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
|
|
|
|
|
|
| 310 |
missing_models.append(path)
|
| 311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
if missing_models:
|
| 313 |
logger.warning("WARNING: Some OmniAvatar models not found:")
|
| 314 |
for model in missing_models:
|
|
@@ -978,6 +990,8 @@ if __name__ == "__main__":
|
|
| 978 |
|
| 979 |
|
| 980 |
|
|
|
|
|
|
|
| 981 |
|
| 982 |
|
| 983 |
|
|
|
|
| 298 |
"""Load the OmniAvatar model - now more flexible"""
|
| 299 |
try:
|
| 300 |
# Check if models are downloaded (but don't require them)
|
| 301 |
+
# Check both traditional and downloaded model paths
|
| 302 |
+
downloaded_video = "./downloaded_models/video"
|
| 303 |
+
downloaded_audio = "./downloaded_models/audio"
|
|
|
|
|
|
|
| 304 |
|
| 305 |
+
# Check downloaded models first
|
| 306 |
+
if os.path.exists(downloaded_video) and os.path.exists(downloaded_audio):
|
| 307 |
+
video_files = len([f for f in os.listdir(downloaded_video) if os.path.isfile(os.path.join(downloaded_video, f))]) if os.path.isdir(downloaded_video) else 0
|
| 308 |
+
audio_files = len([f for f in os.listdir(downloaded_audio) if os.path.isfile(os.path.join(downloaded_audio, f))]) if os.path.isdir(downloaded_audio) else 0
|
| 309 |
+
if video_files > 5 and audio_files > 5:
|
| 310 |
missing_models.append(path)
|
| 311 |
|
| 312 |
+
# Check downloaded models first
|
| 313 |
+
if os.path.exists("./downloaded_models/video") and os.path.exists("./downloaded_models/audio"):
|
| 314 |
+
try:
|
| 315 |
+
video_files = len(os.listdir("./downloaded_models/video"))
|
| 316 |
+
audio_files = len(os.listdir("./downloaded_models/audio"))
|
| 317 |
+
if video_files > 5 and audio_files > 5:
|
| 318 |
+
self.model_loaded = True
|
| 319 |
+
logger.info(f"SUCCESS: Downloaded models loaded - Video: {video_files}, Audio: {audio_files}")
|
| 320 |
+
return True
|
| 321 |
+
except:
|
| 322 |
+
pass
|
| 323 |
+
|
| 324 |
if missing_models:
|
| 325 |
logger.warning("WARNING: Some OmniAvatar models not found:")
|
| 326 |
for model in missing_models:
|
|
|
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
+
|
| 994 |
+
|
| 995 |
|
| 996 |
|
| 997 |
|