Upload app.py
Browse files
app.py
CHANGED
|
@@ -79,19 +79,26 @@ def download_checkpoint(output_dir: Path, model: str) -> None:
|
|
| 79 |
|
| 80 |
def ensure_data_ready(data_dir: Path, checkpoints: list) -> bool:
|
| 81 |
"""Ensure data and checkpoints are downloaded."""
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
print("Data not found, downloading...")
|
| 90 |
download_data(data_dir)
|
| 91 |
else:
|
| 92 |
-
print(f"Data
|
| 93 |
|
| 94 |
-
# Download checkpoints
|
| 95 |
for model in checkpoints:
|
| 96 |
download_checkpoint(data_dir, model)
|
| 97 |
|
|
|
|
| 79 |
|
| 80 |
def ensure_data_ready(data_dir: Path, checkpoints: list) -> bool:
|
| 81 |
"""Ensure data and checkpoints are downloaded."""
|
| 82 |
+
print(f"Checking for existing data in {data_dir.absolute()}...")
|
| 83 |
+
|
| 84 |
+
# Check which models have data (config + embeddings)
|
| 85 |
+
models_with_data = []
|
| 86 |
+
for model in ["dmd2", "edm"]:
|
| 87 |
+
config_path = data_dir / model / "config.json"
|
| 88 |
+
embeddings_dir = data_dir / model / "embeddings"
|
| 89 |
+
if config_path.exists() and embeddings_dir.exists():
|
| 90 |
+
csv_files = list(embeddings_dir.glob("*.csv"))
|
| 91 |
+
if csv_files:
|
| 92 |
+
models_with_data.append(model)
|
| 93 |
+
print(f" Found {model}: {config_path}")
|
| 94 |
+
|
| 95 |
+
if not models_with_data:
|
| 96 |
print("Data not found, downloading...")
|
| 97 |
download_data(data_dir)
|
| 98 |
else:
|
| 99 |
+
print(f"Data already present: {models_with_data}")
|
| 100 |
|
| 101 |
+
# Download checkpoints only if not present
|
| 102 |
for model in checkpoints:
|
| 103 |
download_checkpoint(data_dir, model)
|
| 104 |
|