Haaribo commited on
Commit
5cfc674
·
verified ·
1 Parent(s): 40e7aed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -48,12 +48,12 @@ def genreate_intepriable_output(input,dataset="CUB2011", arch="resnet50",seed=12
48
 
49
  model = get_model(arch, n_classes, reduced_strides)
50
  tr=transforms.ToTensor()
51
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
52
  if folder is None:
53
  folder = Path(f"tmp/{arch}/{dataset}/{seed}/")
54
 
55
- state_dict = torch.load(folder / f"{model_type}_{n_features}_{n_per_class}_FinetunedModel.pth")
56
- selection= torch.load(folder / f"SlDD_Selection_50.pt")
57
  state_dict['linear.selection']=selection
58
 
59
  feature_sel, sparse_layer, current_mean, current_std, bias_sparse = extract_sel_mean_std_bias_assignemnt(state_dict)
 
48
 
49
  model = get_model(arch, n_classes, reduced_strides)
50
  tr=transforms.ToTensor()
51
+ device = torch.device("cpu")
52
  if folder is None:
53
  folder = Path(f"tmp/{arch}/{dataset}/{seed}/")
54
 
55
+ state_dict = torch.load(folder / f"{model_type}_{n_features}_{n_per_class}_FinetunedModel.pth", map_location=torch.device('cpu'))
56
+ selection= torch.load(folder / f"SlDD_Selection_50.pt", map_location=torch.device('cpu'))
57
  state_dict['linear.selection']=selection
58
 
59
  feature_sel, sparse_layer, current_mean, current_std, bias_sparse = extract_sel_mean_std_bias_assignemnt(state_dict)