orionweller commited on
Commit
363466f
·
1 Parent(s): dec37a9

remove arguana

Browse files
app.py CHANGED
@@ -33,7 +33,7 @@ corpus_lookups = {}
33
  queries = {}
34
  q_lookups = {}
35
  qrels = {}
36
- datasets = ["scifact", "arguana"]
37
  current_dataset = "scifact"
38
 
39
  def pool(last_hidden_states, attention_mask):
@@ -71,7 +71,6 @@ def load_model():
71
  model = PeftModel.from_pretrained(base_model_instance, CUR_MODEL)
72
  model = model.merge_and_unload()
73
  model.eval()
74
- model.cuda()
75
 
76
  def load_corpus_embeddings(dataset_name):
77
  global retrievers, corpus_lookups
@@ -130,7 +129,10 @@ def encode_queries(dataset_name, postfix):
130
  embeds = pool(outputs.last_hidden_state, batch_dict['attention_mask'])
131
  embeds = F.normalize(embeds, p=2, dim=-1)
132
  encoded_embeds.append(embeds.cpu().numpy())
133
-
 
 
 
134
  return np.concatenate(encoded_embeds, axis=0)
135
 
136
  def search_queries(dataset_name, q_reps, depth=1000):
@@ -192,7 +194,7 @@ iface = gr.Interface(
192
  ],
193
  outputs=gr.JSON(label="Evaluation Results"),
194
  title="Promptriever Demo",
195
- description="Select a dataset and enter a postfix prompt to evaluate the model's performance. Note: it takes about **ten seconds** for each dataset."
196
  )
197
 
198
  # Launch the interface
 
33
  queries = {}
34
  q_lookups = {}
35
  qrels = {}
36
+ datasets = ["scifact"] # others are too large for the Space unfortunately :(
37
  current_dataset = "scifact"
38
 
39
  def pool(last_hidden_states, attention_mask):
 
71
  model = PeftModel.from_pretrained(base_model_instance, CUR_MODEL)
72
  model = model.merge_and_unload()
73
  model.eval()
 
74
 
75
  def load_corpus_embeddings(dataset_name):
76
  global retrievers, corpus_lookups
 
129
  embeds = pool(outputs.last_hidden_state, batch_dict['attention_mask'])
130
  embeds = F.normalize(embeds, p=2, dim=-1)
131
  encoded_embeds.append(embeds.cpu().numpy())
132
+
133
+
134
+ # remove model from GPU
135
+ model = model.cpu()
136
  return np.concatenate(encoded_embeds, axis=0)
137
 
138
  def search_queries(dataset_name, q_reps, depth=1000):
 
194
  ],
195
  outputs=gr.JSON(label="Evaluation Results"),
196
  title="Promptriever Demo",
197
+ description="Select a dataset and enter a prompt to evaluate the model's performance. Note: it takes about **ten seconds** to evaluate.",
198
  )
199
 
200
  # Launch the interface
arguana/corpus_emb.0.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:21742104cd3b5ff805fe1a7432c960b6933159c1092d49f5c4cad74922916a9b
3
- size 35619068
 
 
 
 
arguana/corpus_emb.1.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:37b86d66f10459bc2c032741f70e9f1edba68b2b3fbf9c7b1c1bb6f6139fef02
3
- size 35619074
 
 
 
 
arguana/corpus_emb.2.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f0ebf48b7b6ad18402a90da0ca92b71128b43d81a85fdb425edcaa3767f213d1
3
- size 35602692
 
 
 
 
arguana/corpus_emb.3.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:82bb37e7f6d7e0728da781aaccaad49830708cd44abc455f8c3a81db1e4b4b0f
3
- size 35602679