Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- backend/model_service.py +3 -3
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
backend/model_service.py
CHANGED
|
@@ -204,7 +204,7 @@ def detect_backbone(state_dict: dict[str, torch.Tensor]) -> str:
|
|
| 204 |
|
| 205 |
state_dict = torch.load(WEIGHTS_PATH, map_location=DEVICE)
|
| 206 |
model = EfficientNetFFTFusion(backbone=detect_backbone(state_dict)).to(DEVICE)
|
| 207 |
-
model.load_state_dict(state_dict, strict=
|
| 208 |
model.eval()
|
| 209 |
MODEL_INFO = {'model_type': 'efficientnet_fft', 'backbone': detect_backbone(state_dict), 'optimal_threshold': THRESHOLD_AI}
|
| 210 |
|
|
@@ -217,7 +217,7 @@ if GAN_DIFF_WEIGHTS_PATH.exists() and GAN_DIFF_CONFIG_PATH.exists():
|
|
| 217 |
gan_diff_state = torch.load(GAN_DIFF_WEIGHTS_PATH, map_location=DEVICE)
|
| 218 |
if isinstance(gan_diff_state, dict) and 'model_state' in gan_diff_state:
|
| 219 |
gan_diff_state = gan_diff_state['model_state']
|
| 220 |
-
gan_diff_model.load_state_dict(gan_diff_state, strict=
|
| 221 |
GAN_DIFF_MODEL = gan_diff_model.to(DEVICE)
|
| 222 |
GAN_DIFF_MODEL.eval()
|
| 223 |
|
|
@@ -234,7 +234,7 @@ if VIDEO_WEIGHTS_PATH.exists():
|
|
| 234 |
pretrained=False,
|
| 235 |
backbone_name=VIDEO_CONFIG.get('backbone', 'xception'),
|
| 236 |
).to(DEVICE)
|
| 237 |
-
VIDEO_MODEL.load_state_dict(video_ckpt['model_state'], strict=
|
| 238 |
VIDEO_MODEL.eval()
|
| 239 |
|
| 240 |
|
|
|
|
| 204 |
|
| 205 |
state_dict = torch.load(WEIGHTS_PATH, map_location=DEVICE)
|
| 206 |
model = EfficientNetFFTFusion(backbone=detect_backbone(state_dict)).to(DEVICE)
|
| 207 |
+
model.load_state_dict(state_dict, strict=False)
|
| 208 |
model.eval()
|
| 209 |
MODEL_INFO = {'model_type': 'efficientnet_fft', 'backbone': detect_backbone(state_dict), 'optimal_threshold': THRESHOLD_AI}
|
| 210 |
|
|
|
|
| 217 |
gan_diff_state = torch.load(GAN_DIFF_WEIGHTS_PATH, map_location=DEVICE)
|
| 218 |
if isinstance(gan_diff_state, dict) and 'model_state' in gan_diff_state:
|
| 219 |
gan_diff_state = gan_diff_state['model_state']
|
| 220 |
+
gan_diff_model.load_state_dict(gan_diff_state, strict=False)
|
| 221 |
GAN_DIFF_MODEL = gan_diff_model.to(DEVICE)
|
| 222 |
GAN_DIFF_MODEL.eval()
|
| 223 |
|
|
|
|
| 234 |
pretrained=False,
|
| 235 |
backbone_name=VIDEO_CONFIG.get('backbone', 'xception'),
|
| 236 |
).to(DEVICE)
|
| 237 |
+
VIDEO_MODEL.load_state_dict(video_ckpt['model_state'], strict=False)
|
| 238 |
VIDEO_MODEL.eval()
|
| 239 |
|
| 240 |
|