Spaces:
Runtime error
Runtime error
Commit
·
03a91c1
1
Parent(s):
c4fcbef
Update demo_dpr.py
Browse files- demo_dpr.py +1 -1
demo_dpr.py
CHANGED
@@ -152,7 +152,7 @@ def retrieve_with_dpr_embeddings(question):
|
|
152 |
question_embedding = torch.squeeze(question_embedding, dim=0)
|
153 |
corpus_embeddings = torch.stack(dpr_context_embeddings)
|
154 |
corpus_embeddings = torch.squeeze(corpus_embeddings, dim=1)
|
155 |
-
hits = util.semantic_search(question_embedding, corpus_embeddings, top_k=100)
|
156 |
if len(hits) == 0:
|
157 |
return []
|
158 |
hits = hits[0]
|
|
|
152 |
question_embedding = torch.squeeze(question_embedding, dim=0)
|
153 |
corpus_embeddings = torch.stack(dpr_context_embeddings)
|
154 |
corpus_embeddings = torch.squeeze(corpus_embeddings, dim=1)
|
155 |
+
hits = util.semantic_search(question_embedding, corpus_embeddings, top_k=100, score_function=util.dot_score)
|
156 |
if len(hits) == 0:
|
157 |
return []
|
158 |
hits = hits[0]
|