Spaces:
Running on Zero
Running on Zero
Vansh Chugh commited on
Commit ·
cfc17a5
1
Parent(s): 77d923d
force unbuffered stdout, skip model download if present
Browse files
app.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import os
|
| 3 |
# import spaces # uncomment when running on ZeroGPU
|
|
@@ -12,9 +15,14 @@ from anyaccomp.inference_utils import Sing2SongInferencePipeline
|
|
| 12 |
repo_id = "amphion/anyaccomp"
|
| 13 |
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
print(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
CFG_PATH = os.path.join(base_dir, "config/flow_matching.json")
|
| 20 |
VOCODER_CFG_PATH = os.path.join(base_dir, "config/vocoder.json")
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
sys.stdout.reconfigure(line_buffering=True)
|
| 3 |
+
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
# import spaces # uncomment when running on ZeroGPU
|
|
|
|
| 15 |
repo_id = "amphion/anyaccomp"
|
| 16 |
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 17 |
|
| 18 |
+
checkpoint_marker = os.path.join(base_dir, "pretrained", "flow_matching")
|
| 19 |
+
if not os.path.exists(checkpoint_marker):
|
| 20 |
+
print(f"Downloading model files from {repo_id}...", flush=True)
|
| 21 |
+
model_dir = snapshot_download(repo_id=repo_id, local_dir=base_dir)
|
| 22 |
+
print(f"Model files downloaded to: {model_dir}", flush=True)
|
| 23 |
+
else:
|
| 24 |
+
model_dir = base_dir
|
| 25 |
+
print(f"Model files already present, skipping download.", flush=True)
|
| 26 |
|
| 27 |
CFG_PATH = os.path.join(base_dir, "config/flow_matching.json")
|
| 28 |
VOCODER_CFG_PATH = os.path.join(base_dir, "config/vocoder.json")
|