IZERE HIRWA Roger commited on
Commit
0f522d6
·
1 Parent(s): 25e5690
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -19,7 +19,12 @@ def load_models():
19
  global sam_model, sd_pipe, predictor
20
  if sam_model is None:
21
  print("Loading SAM model...")
22
- sam_model = sam_model_registry["vit_h"](checkpoint="sam_vit_b_01ec64.pth")
 
 
 
 
 
23
  predictor = SamPredictor(sam_model)
24
 
25
  if sd_pipe is None:
 
19
  global sam_model, sd_pipe, predictor
20
  if sam_model is None:
21
  print("Loading SAM model...")
22
+ sam_model = sam_model_registry["vit_b"](checkpoint="sam_vit_b_01ec64.pth") # Use available checkpoint
23
+ missing_keys, unexpected_keys = sam_model.load_state_dict(
24
+ torch.load("sam_vit_b_01ec64.pth"), strict=False
25
+ )
26
+ if missing_keys or unexpected_keys:
27
+ print(f"Warning: Missing keys: {missing_keys}, Unexpected keys: {unexpected_keys}")
28
  predictor = SamPredictor(sam_model)
29
 
30
  if sd_pipe is None: