KublaiKhan1 commited on
Commit
1d92620
·
verified ·
1 Parent(s): 97dfd17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -19
app.py CHANGED
@@ -46,22 +46,9 @@ dinov2 = torch.hub.load('facebookresearch/dinov2', 'dinov2_vitg14_reg')
46
  print("Loading custom pathology checkpoint...")
47
  #ours = torch.load("/data/linears/teacher_checkpoint.pth")
48
 
49
- ours = torch.load("/data/linears/teacher_checkpoint_load.pt")
50
- checkpoint = ours#["teacher"]
51
- checkpoint_new = {}
52
 
53
- # Remove dino and ibot keys
54
- #for key in list(checkpoint.keys()):
55
- # if "dino" in str(key) or "ibot" in str(key):
56
- # checkpoint.pop(key, None)
57
 
58
- # Align keys with dinov2 state dict
59
- #for key, keyb in zip(checkpoint.keys(), dinov2.state_dict().keys()):
60
- # checkpoint_new[keyb] = checkpoint[key]
61
-
62
- #checkpoint = checkpoint_new
63
-
64
- # Update pos_embed
65
 
66
  new_shape = checkpoint["pos_embed"]
67
  dinov2.pos_embed = torch.nn.parameter.Parameter(new_shape)
@@ -102,16 +89,16 @@ def setup_linear_crc(path):
102
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
103
  dinov2 = dinov2.to(device)
104
 
105
- breakhis_path = "/data/linears/logs/dino_vits16/offline/breakhis/20251030-190409559498_5b47c293/run_0/checkpoints/best.ckpt"
106
  breakhis_linear = setup_linear(breakhis_path).to(device)
107
 
108
- gleason_path = "/data/linears/logs/dino_vits16/offline/gleason_arvaniti/20251110-164046988851_35daf081/run_4/checkpoints/best.ckpt"
109
  gleason_linear = setup_linear(gleason_path).to(device)
110
 
111
- bach_path = "/data/linears/logs/dino_vits16/offline/bach/20251110-164046453320_0b82d41d/run_4/checkpoints/best.ckpt"
112
  bach_linear = setup_linear(bach_path).to(device)
113
 
114
- crc_path = "/data/linears/logs/dino_vits16/offline/crc/20251110-164127567401_f6ae5d68/run_4/checkpoints/best.ckpt"
115
  crc_linear = setup_linear_crc(crc_path).to(device)
116
 
117
 
@@ -296,4 +283,4 @@ demo = gr.TabbedInterface([breakhis, gleason, crc, bach],["BreakHis", "Gleason",
296
 
297
 
298
  if __name__ == "__main__":
299
- demo.launch(share=True)
 
46
  print("Loading custom pathology checkpoint...")
47
  #ours = torch.load("/data/linears/teacher_checkpoint.pth")
48
 
49
+ checkpoint = torch.load("./teacher_checkpoint_load.pt")
 
 
50
 
 
 
 
 
51
 
 
 
 
 
 
 
 
52
 
53
  new_shape = checkpoint["pos_embed"]
54
  dinov2.pos_embed = torch.nn.parameter.Parameter(new_shape)
 
89
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
90
  dinov2 = dinov2.to(device)
91
 
92
+ breakhis_path = "./breakhis_best.ckpt"
93
  breakhis_linear = setup_linear(breakhis_path).to(device)
94
 
95
+ gleason_path = "./gleason_best.ckpt"
96
  gleason_linear = setup_linear(gleason_path).to(device)
97
 
98
+ bach_path = "./bach_best.ckpt"
99
  bach_linear = setup_linear(bach_path).to(device)
100
 
101
+ crc_path = "./crc_best.ckpt"
102
  crc_linear = setup_linear_crc(crc_path).to(device)
103
 
104
 
 
283
 
284
 
285
  if __name__ == "__main__":
286
+ demo.launch()