Singularity666 commited on
Commit
1c4591c
1 Parent(s): 61e3710

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -54,8 +54,17 @@ device = torch.device("cpu")
54
 
55
  testing_df = pd.read_csv("testing_df.csv")
56
  model = CLIPModel() # Create an instance of CLIPModel
57
- model.load_state_dict(torch.load("weights.pt", map_location=torch.device('cpu')))
58
- # ...)
 
 
 
 
 
 
 
 
 
59
  text_embeddings = torch.load('saved_text_embeddings.pt', map_location=device)
60
 
61
  def download_link(content, filename, link_text):
 
54
 
55
  testing_df = pd.read_csv("testing_df.csv")
56
  model = CLIPModel() # Create an instance of CLIPModel
57
+ # Load the model
58
+ state_dict = torch.load("weights.pt", map_location=torch.device('cpu'))
59
+ print("Loaded State Dict Keys:", state_dict.keys())
60
+
61
+ # Create an instance of CLIPModel
62
+ model = CLIPModel().to(device)
63
+ print("Model Keys:", model.state_dict().keys())
64
+
65
+ # Load the state_dict into the model
66
+ model.load_state_dict(state_dict, strict=False) # Set strict=False to ignore unexpected keys
67
+
68
  text_embeddings = torch.load('saved_text_embeddings.pt', map_location=device)
69
 
70
  def download_link(content, filename, link_text):