Jacky2305 commited on
Commit
9000477
·
1 Parent(s): f151a75

Add model verification with torch.load to catch format issues

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -91,12 +91,28 @@ for fname, target_dir in files_to_download:
91
  print(f"✗ FAILED to download {fname}", flush=True)
92
  all_ok = False
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  if not all_ok:
95
- print("⚠ Some model files failed to download. Inference may fail.", flush=True)
96
  else:
97
- print("=== All model files ready ===", flush=True)
98
 
99
  # 5. Launch RVC WebUI (webui.py is the new entry point)
 
100
  run([
101
  sys.executable,
102
  "webui.py",
 
91
  print(f"✗ FAILED to download {fname}", flush=True)
92
  all_ok = False
93
 
94
+ # Verify model file can be loaded
95
+ if all_ok:
96
+ print("=== Verifying model file ===", flush=True)
97
+ try:
98
+ import torch
99
+ pth_path = weights_dir / "OldChineseMan.pth"
100
+ print(f"Loading {pth_path}...", flush=True)
101
+ state = torch.load(pth_path, map_location="cpu")
102
+ print(f"✓ Model loaded. Keys: {list(state.keys())[:10]}...", flush=True)
103
+ if "config" in state:
104
+ print(f" Config: {state['config']}", flush=True)
105
+ except Exception as e:
106
+ print(f"✗ Model verification failed: {e}", flush=True)
107
+ all_ok = False
108
+
109
  if not all_ok:
110
+ print("⚠ Some model files failed verification. Inference may fail.", flush=True)
111
  else:
112
+ print("=== All model files ready and verified ===", flush=True)
113
 
114
  # 5. Launch RVC WebUI (webui.py is the new entry point)
115
+ print("=== Starting RVC WebUI ===", flush=True)
116
  run([
117
  sys.executable,
118
  "webui.py",