Roll20 commited on
Commit
718e2e4
1 Parent(s): 5df2a5d
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -134,7 +134,7 @@ def score(input_img):
134
  test_preds_model = []
135
  test_preds_fold = []
136
  model = PetNet(model_name = 'swin_large_patch4_window7_224', out_features = 1, inp_channels = 3, pretrained=False)
137
- model.load_state_dict(torch.load('swin_large_patch4_window7_224_fold0_half.pth'))
138
  model = model.float()
139
  model.eval()
140
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [1])
@@ -147,7 +147,7 @@ def score(input_img):
147
  test_preds_model = []
148
  test_preds_fold = []
149
  model = PetNet(model_name = 'beit_large_patch16_224', out_features = 1, inp_channels = 3, pretrained=False)
150
- model.load_state_dict(torch.load('beit_large_patch16_224_fold0_half.pth'))
151
  model = model.float()
152
  model.eval()
153
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [0])
@@ -159,7 +159,7 @@ def score(input_img):
159
  test_preds_model = []
160
  test_preds_fold = []
161
  model = PetNet(model_name = 'swin_large_patch4_window12_384_in22k', out_features = 1, inp_channels = 3, pretrained=False)
162
- model.load_state_dict(torch.load('swin_large_patch4_window12_384_in22k_fold0_half.pth'))
163
  model = model.float()
164
  model.eval()
165
  test_preds_fold = tta_fn(thefile, model, 384, [0])
@@ -186,7 +186,7 @@ def score(input_img):
186
  modelfiles = glob(Config.model_base_dir + Config_exp77.model_dir + Config.model_file_ext)
187
  test_preds_fold = []
188
  model = PetNet_exp77(model_name = 'beit_large_patch16_224', out_features = 1, inp_channels = 3, pretrained=False)
189
- model.load_state_dict(torch.load('beit_large_patch16_224_fold1_half.pth'))
190
  model = model.float()
191
  model.eval()
192
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [0])
 
134
  test_preds_model = []
135
  test_preds_fold = []
136
  model = PetNet(model_name = 'swin_large_patch4_window7_224', out_features = 1, inp_channels = 3, pretrained=False)
137
+ model.load_state_dict(torch.load('swin_large_patch4_window7_224_fold0_half.pth', map_location=torch.device('cpu')))
138
  model = model.float()
139
  model.eval()
140
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [1])
 
147
  test_preds_model = []
148
  test_preds_fold = []
149
  model = PetNet(model_name = 'beit_large_patch16_224', out_features = 1, inp_channels = 3, pretrained=False)
150
+ model.load_state_dict(torch.load('beit_large_patch16_224_fold0_half.pth', map_location=torch.device('cpu')))
151
  model = model.float()
152
  model.eval()
153
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [0])
 
159
  test_preds_model = []
160
  test_preds_fold = []
161
  model = PetNet(model_name = 'swin_large_patch4_window12_384_in22k', out_features = 1, inp_channels = 3, pretrained=False)
162
+ model.load_state_dict(torch.load('swin_large_patch4_window12_384_in22k_fold0_half.pth', map_location=torch.device('cpu')))
163
  model = model.float()
164
  model.eval()
165
  test_preds_fold = tta_fn(thefile, model, 384, [0])
 
186
  modelfiles = glob(Config.model_base_dir + Config_exp77.model_dir + Config.model_file_ext)
187
  test_preds_fold = []
188
  model = PetNet_exp77(model_name = 'beit_large_patch16_224', out_features = 1, inp_channels = 3, pretrained=False)
189
+ model.load_state_dict(torch.load('beit_large_patch16_224_fold1_half.pth', map_location=torch.device('cpu')))
190
  model = model.float()
191
  model.eval()
192
  test_preds_fold = tta_fn(thefile, model, Config.im_size, [0])