gabrielkasmi commited on
Commit
7f0920d
·
verified ·
1 Parent(s): 4d672d2

Upload model.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. model.py +4 -2
model.py CHANGED
@@ -63,10 +63,12 @@ def load_classification_model(provider: str = "google", device: str = "cpu"):
63
  assert provider in ("google", "ign"), "provider must be 'google' or 'ign'"
64
 
65
  path = hf_hub_download(REPO, f"inception_{provider}_best.pth")
66
- model = inception_v3(weights=None, aux_logits=False)
67
- model.fc = nn.Linear(model.fc.in_features, 1)
 
68
 
69
  state = torch.load(path, map_location=device, weights_only=False)
70
  model.load_state_dict(state)
 
71
 
72
  return model.eval().to(device)
 
63
  assert provider in ("google", "ign"), "provider must be 'google' or 'ign'"
64
 
65
  path = hf_hub_download(REPO, f"inception_{provider}_best.pth")
66
+ model = inception_v3(weights=None, aux_logits=True)
67
+ model.fc = nn.Linear(model.fc.in_features, 1)
68
+ model.AuxLogits.fc = nn.Linear(model.AuxLogits.fc.in_features, 1)
69
 
70
  state = torch.load(path, map_location=device, weights_only=False)
71
  model.load_state_dict(state)
72
+ model.aux_logits = False # désactive pour l'inférence
73
 
74
  return model.eval().to(device)