Haaribo commited on
Commit
dbf44ca
·
verified ·
1 Parent(s): 9b896f5

Update visualization_gary.py

Browse files
Files changed (1) hide show
  1. visualization_gary.py +3 -3
visualization_gary.py CHANGED
@@ -133,9 +133,9 @@ def genreate_intepriable_output(input,dataset="CUB2011", arch="resnet50",seed=12
133
  device = torch.device("cpu")
134
  if folder is None:
135
  folder = Path(f"tmp/{arch}/{dataset}/{seed}/")
136
- model.load_state_dict(torch.load(folder / "Trained_DenseModel.pth"))
137
- state_dict = torch.load(folder / f"{model_type}_{n_features}_{n_per_class}_FinetunedModel.pth")
138
- selection= torch.load(folder / f"SlDD_Selection_50.pt")
139
  state_dict['linear.selection']=selection
140
 
141
  feature_sel, sparse_layer, current_mean, current_std, bias_sparse = extract_sel_mean_std_bias_assignemnt(state_dict)
 
133
  device = torch.device("cpu")
134
  if folder is None:
135
  folder = Path(f"tmp/{arch}/{dataset}/{seed}/")
136
+ model.load_state_dict(torch.load(folder / "Trained_DenseModel.pth",map_location=torch.device('cpu')))
137
+ state_dict = torch.load(folder / f"{model_type}_{n_features}_{n_per_class}_FinetunedModel.pth", map_location=torch.device('cpu'))
138
+ selection= torch.load(folder / f"SlDD_Selection_50.pt", map_location=torch.device('cpu'))
139
  state_dict['linear.selection']=selection
140
 
141
  feature_sel, sparse_layer, current_mean, current_std, bias_sparse = extract_sel_mean_std_bias_assignemnt(state_dict)