fuvty commited on
Commit
dd85252
·
1 Parent(s): de2ba9d

[debug] auto download

Browse files
Files changed (1) hide show
  1. app.py +16 -13
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 Rosetta model from {self.c2c_checkpoint_path}...")
120
 
121
- # Check if checkpoint exists
122
  if not Path(self.c2c_checkpoint_path).exists():
123
- raise FileNotFoundError(
124
- f"C2C checkpoint not found: {self.c2c_checkpoint_path}\n"
125
- "You can download the checkpoints automatically with:\n"
126
- " from huggingface_hub import snapshot_download\n"
127
- " snapshot_download(\n"
128
- " repo_id='nics-efc/C2C_Fuser',\n"
129
- " allow_patterns=['qwen3_0.6b+qwen2.5_0.5b_Fuser/*'],\n"
130
- " local_dir='local/checkpoints'\n"
131
- " )\n"
132
- "Or see the project README for more details."
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