telecomadm1145 commited on
Commit
f8b2050
·
verified ·
1 Parent(s): 8b95acd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -72,7 +72,7 @@ print(f"Checkpoint path: {ckpt_path}")
72
  # ---------------------------------------------------------------------------
73
  # 3. 实例化 & 加载权重
74
  model = SwinClassifier(MODEL_NAME, NUM_CLASSES, pretrained=False).to(device)
75
- state = torch.load(ckpt_path, map_location=device)
76
  model.load_state_dict(state.get("model_state_dict", state), strict=True)
77
  model.eval()
78
  print("✅ Model loaded.")
 
72
  # ---------------------------------------------------------------------------
73
  # 3. 实例化 & 加载权重
74
  model = SwinClassifier(MODEL_NAME, NUM_CLASSES, pretrained=False).to(device)
75
+ state = torch.load(ckpt_path, map_location=device, weights_only=False)
76
  model.load_state_dict(state.get("model_state_dict", state), strict=True)
77
  model.eval()
78
  print("✅ Model loaded.")