Spaces:
Runtime error
Runtime error
Commit
·
ba30afb
1
Parent(s):
4bab053
Upload app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ query_embedding = model_msmarco_v3.encode(query)
|
|
76 |
|
77 |
passage_embedding = model_msmarco_v3.encode(hf_data[:1000].Lyric)
|
78 |
|
79 |
-
corpus_embeddings = torch.from_numpy(passage_embedding).float()
|
80 |
corpus_embeddings = util.normalize_embeddings(corpus_embeddings)
|
81 |
|
82 |
# query_embeddings = torch.from_numpy(query_embedding).float().to('cuda')
|
@@ -93,7 +93,7 @@ corpus_embeddings = util.normalize_embeddings(corpus_embeddings)
|
|
93 |
|
94 |
def msmarco_match(query, return_top = True):
|
95 |
query_embedding = model_msmarco_v3.encode(query)
|
96 |
-
query_embeddings = torch.from_numpy(query_embedding).float()
|
97 |
query_embeddings = util.normalize_embeddings(query_embeddings)
|
98 |
hits = util.semantic_search(query_embeddings, corpus_embeddings, score_function=util.dot_score)
|
99 |
top_hits = hits[0][0:3]
|
|
|
76 |
|
77 |
passage_embedding = model_msmarco_v3.encode(hf_data[:1000].Lyric)
|
78 |
|
79 |
+
corpus_embeddings = torch.from_numpy(passage_embedding).float()#.to('cuda')
|
80 |
corpus_embeddings = util.normalize_embeddings(corpus_embeddings)
|
81 |
|
82 |
# query_embeddings = torch.from_numpy(query_embedding).float().to('cuda')
|
|
|
93 |
|
94 |
def msmarco_match(query, return_top = True):
|
95 |
query_embedding = model_msmarco_v3.encode(query)
|
96 |
+
query_embeddings = torch.from_numpy(query_embedding).float()#.to('cuda')
|
97 |
query_embeddings = util.normalize_embeddings(query_embeddings)
|
98 |
hits = util.semantic_search(query_embeddings, corpus_embeddings, score_function=util.dot_score)
|
99 |
top_hits = hits[0][0:3]
|