Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,20 +7,23 @@ MODEL_REPO = "tencent/HunyuanVideo-Avatar"
|
|
7 |
BASE_DIR = os.getcwd() # current working directory, absolute path
|
8 |
WEIGHTS_DIR = os.path.join(BASE_DIR, "weights")
|
9 |
|
10 |
-
|
|
|
11 |
|
12 |
def download_model():
|
13 |
-
print("β¬οΈ Model not found. Downloading with huggingface-cli inside
|
14 |
os.makedirs(WEIGHTS_DIR, exist_ok=True)
|
15 |
-
|
16 |
-
#
|
17 |
-
cmd = [
|
18 |
-
|
|
|
|
|
|
|
19 |
if proc.returncode != 0:
|
20 |
print("β huggingface-cli download failed.")
|
21 |
sys.exit(1)
|
22 |
-
|
23 |
-
# Check if checkpoint file exists now
|
24 |
if not os.path.isfile(CHECKPOINT_FILE):
|
25 |
print(f"β Checkpoint file not found at {CHECKPOINT_FILE} after download.")
|
26 |
sys.exit(1)
|
@@ -60,7 +63,7 @@ def main():
|
|
60 |
download_model()
|
61 |
|
62 |
flask_proc = run_flask_audio()
|
63 |
-
time.sleep(5) # Wait for flask_audio.py to
|
64 |
gradio_proc = run_gradio_ui()
|
65 |
|
66 |
if __name__ == "__main__":
|
|
|
7 |
BASE_DIR = os.getcwd() # current working directory, absolute path
|
8 |
WEIGHTS_DIR = os.path.join(BASE_DIR, "weights")
|
9 |
|
10 |
+
# This path assumes the checkpoint is inside weights/transformers/...
|
11 |
+
CHECKPOINT_FILE = os.path.join(WEIGHTS_DIR, "transformers", "mp_rank_00_model_states.pt")
|
12 |
|
13 |
def download_model():
|
14 |
+
print("β¬οΈ Model not found. Downloading with huggingface-cli inside weights directory...")
|
15 |
os.makedirs(WEIGHTS_DIR, exist_ok=True)
|
16 |
+
|
17 |
+
# Use --local-dir as absolute path (important!)
|
18 |
+
cmd = [
|
19 |
+
"huggingface-cli", "download", MODEL_REPO,
|
20 |
+
"--local-dir", WEIGHTS_DIR
|
21 |
+
]
|
22 |
+
proc = subprocess.run(cmd)
|
23 |
if proc.returncode != 0:
|
24 |
print("β huggingface-cli download failed.")
|
25 |
sys.exit(1)
|
26 |
+
|
|
|
27 |
if not os.path.isfile(CHECKPOINT_FILE):
|
28 |
print(f"β Checkpoint file not found at {CHECKPOINT_FILE} after download.")
|
29 |
sys.exit(1)
|
|
|
63 |
download_model()
|
64 |
|
65 |
flask_proc = run_flask_audio()
|
66 |
+
time.sleep(5) # Wait a bit for flask_audio.py to start
|
67 |
gradio_proc = run_gradio_ui()
|
68 |
|
69 |
if __name__ == "__main__":
|