Spaces:
Running
Running
colonelwatch
commited on
Commit
•
e7eed8f
1
Parent(s):
635d813
Double nlist, halve nprobes
Browse files* This achieves ~68% performance while cutting problem size in half
- app.py +3 -3
- index.faiss +2 -2
- index.ivfdata +1 -1
app.py
CHANGED
@@ -17,7 +17,7 @@ index = faiss.read_index('index.faiss')
|
|
17 |
|
18 |
ps = faiss.ParameterSpace()
|
19 |
ps.initialize(index)
|
20 |
-
ps.set_index_parameters(index, 'nprobe=
|
21 |
|
22 |
|
23 |
def _recover_abstract(inverted_index):
|
@@ -37,7 +37,7 @@ def search(query):
|
|
37 |
|
38 |
query_embedding = model.encode(query)
|
39 |
query_embedding = query_embedding.reshape(1, -1)
|
40 |
-
distances, faiss_ids = index.search(query_embedding,
|
41 |
|
42 |
distances = distances[0]
|
43 |
faiss_ids = faiss_ids[0]
|
@@ -148,5 +148,5 @@ with gr.Blocks() as demo:
|
|
148 |
.success(execute_request, inputs=[request_str_var], outputs=[response_var]) \
|
149 |
.success(format_response, inputs=[neighbors_var, response_var], outputs=[results])
|
150 |
|
151 |
-
demo.queue()
|
152 |
demo.launch()
|
|
|
17 |
|
18 |
ps = faiss.ParameterSpace()
|
19 |
ps.initialize(index)
|
20 |
+
ps.set_index_parameters(index, 'nprobe=16,ht=512')
|
21 |
|
22 |
|
23 |
def _recover_abstract(inverted_index):
|
|
|
37 |
|
38 |
query_embedding = model.encode(query)
|
39 |
query_embedding = query_embedding.reshape(1, -1)
|
40 |
+
distances, faiss_ids = index.search(query_embedding, 20)
|
41 |
|
42 |
distances = distances[0]
|
43 |
faiss_ids = faiss_ids[0]
|
|
|
148 |
.success(execute_request, inputs=[request_str_var], outputs=[response_var]) \
|
149 |
.success(format_response, inputs=[neighbors_var, response_var], outputs=[results])
|
150 |
|
151 |
+
demo.queue(2)
|
152 |
demo.launch()
|
index.faiss
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf114f0cc57e5674b171e113553e182aa705be7df530493862d21bb48b7ecf9b
|
3 |
+
size 138019116
|
index.ivfdata
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 6868108080
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4d1bbbbb3094702c549d2a2576280a2587622241d0e7ec2765955a3461d89bae
|
3 |
size 6868108080
|