Spaces:
Running
Running
[debug] auto download
Browse files
app.py
CHANGED
|
@@ -116,21 +116,24 @@ class ModelManager:
|
|
| 116 |
|
| 117 |
def _load_c2c_model(self):
|
| 118 |
"""Load Rosetta (C2C) model."""
|
| 119 |
-
print(f"\n[C2C] Loading
|
| 120 |
|
| 121 |
-
#
|
| 122 |
if not Path(self.c2c_checkpoint_path).exists():
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
"
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
# Load config
|
| 136 |
import yaml
|
|
|
|
| 116 |
|
| 117 |
def _load_c2c_model(self):
|
| 118 |
"""Load Rosetta (C2C) model."""
|
| 119 |
+
print(f"\n[C2C] Loading from {self.c2c_checkpoint_path}...")
|
| 120 |
|
| 121 |
+
# Auto-download if checkpoint doesn't exist
|
| 122 |
if not Path(self.c2c_checkpoint_path).exists():
|
| 123 |
+
print("[C2C] Downloading checkpoint from HuggingFace (may take a few minutes)...")
|
| 124 |
+
try:
|
| 125 |
+
from huggingface_hub import snapshot_download
|
| 126 |
+
checkpoint_name = Path(self.c2c_checkpoint_path).name
|
| 127 |
+
snapshot_download(
|
| 128 |
+
repo_id='nics-efc/C2C_Fuser',
|
| 129 |
+
allow_patterns=[f'{checkpoint_name}/*'],
|
| 130 |
+
local_dir=str(Path(self.c2c_checkpoint_path).parent)
|
| 131 |
+
)
|
| 132 |
+
print("[C2C] ✓ Download complete")
|
| 133 |
+
except ImportError:
|
| 134 |
+
raise ImportError("Install huggingface_hub: pip install huggingface_hub")
|
| 135 |
+
except Exception as e:
|
| 136 |
+
raise RuntimeError(f"Download failed: {e}\nManual download: https://huggingface.co/nics-efc/C2C_Fuser")
|
| 137 |
|
| 138 |
# Load config
|
| 139 |
import yaml
|