Spaces:
Build error
Build error
Upload 16 files (#10)
Browse files- Upload 16 files (a04d3e844c023a7f912ca4b55ca1fd6b24a0ecdf)
app.py
CHANGED
@@ -371,7 +371,7 @@ if document_type == "Single-Document":
|
|
371 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
372 |
)
|
373 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
374 |
-
dense_query_embedding, sparse_query_embedding, 0.
|
375 |
)
|
376 |
query_results = query_pinecone_sparse(
|
377 |
dense_query_embedding,
|
@@ -430,7 +430,7 @@ else:
|
|
430 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
431 |
)
|
432 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
433 |
-
dense_query_embedding, sparse_query_embedding, 0.
|
434 |
)
|
435 |
year_quarter_list = year_quarter_range(
|
436 |
start_quarter, start_year, end_quarter, end_year
|
@@ -503,7 +503,7 @@ else:
|
|
503 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
504 |
)
|
505 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
506 |
-
dense_query_embedding, sparse_query_embedding, 0.
|
507 |
)
|
508 |
year_quarter_list = year_quarter_range(
|
509 |
start_quarter, start_year, end_quarter, end_year
|
|
|
371 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
372 |
)
|
373 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
374 |
+
dense_query_embedding, sparse_query_embedding, 0.3
|
375 |
)
|
376 |
query_results = query_pinecone_sparse(
|
377 |
dense_query_embedding,
|
|
|
430 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
431 |
)
|
432 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
433 |
+
dense_query_embedding, sparse_query_embedding, 0.3
|
434 |
)
|
435 |
year_quarter_list = year_quarter_range(
|
436 |
start_quarter, start_year, end_quarter, end_year
|
|
|
503 |
query_text, sparse_retriever_model, sparse_retriever_tokenizer
|
504 |
)
|
505 |
dense_query_embedding, sparse_query_embedding = hybrid_score_norm(
|
506 |
+
dense_query_embedding, sparse_query_embedding, 0.3
|
507 |
)
|
508 |
year_quarter_list = year_quarter_range(
|
509 |
start_quarter, start_year, end_quarter, end_year
|
utils/__pycache__/models.cpython-38.pyc
CHANGED
Binary files a/utils/__pycache__/models.cpython-38.pyc and b/utils/__pycache__/models.cpython-38.pyc differ
|
|
utils/__pycache__/vector_index.cpython-38.pyc
CHANGED
Binary files a/utils/__pycache__/vector_index.cpython-38.pyc and b/utils/__pycache__/vector_index.cpython-38.pyc differ
|
|
utils/vector_index.py
CHANGED
@@ -42,8 +42,10 @@ def hybrid_score_norm(dense, sparse, alpha: float):
|
|
42 |
"""
|
43 |
if alpha < 0 or alpha > 1:
|
44 |
raise ValueError("Alpha must be between 0 and 1")
|
45 |
-
|
46 |
"indices": sparse["indices"],
|
47 |
"values": [v * (1 - alpha) for v in sparse["values"]],
|
48 |
}
|
49 |
-
|
|
|
|
|
|
42 |
"""
|
43 |
if alpha < 0 or alpha > 1:
|
44 |
raise ValueError("Alpha must be between 0 and 1")
|
45 |
+
hsparse = {
|
46 |
"indices": sparse["indices"],
|
47 |
"values": [v * (1 - alpha) for v in sparse["values"]],
|
48 |
}
|
49 |
+
|
50 |
+
hdense = [[v * alpha for v in dense[0]]]
|
51 |
+
return hdense, hsparse
|