bourdoiscatie commited on
Commit
06d069c
1 Parent(s): 9026ec3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,7 +18,7 @@ wikipedia_dataset = wikipedia_dataset.map(add_link)
18
  # Load the int8 and binary indices. Int8 is loaded as a view to save memory, as we never actually perform search with it.
19
  int8_view = Index.restore("wikipedia_fr_2022_250K_int8_usearch.index", view=True)
20
  binary_index: faiss.IndexBinaryFlat = faiss.read_index_binary("wikipedia_fr_2022_250K_ubinary_faiss.index")
21
- # binary_ivf: faiss.IndexBinaryIVF = faiss.read_index_binary("wikipedia_fr_2022_250K_ubinary_ivf_faiss.index")
22
 
23
  # Load the SentenceTransformer model for embedding the queries
24
  model = SentenceTransformer("OrdalieTech/Solon-embeddings-large-0.1")
@@ -36,7 +36,7 @@ def search(query, top_k: int = 20, rescore_multiplier: int = 1, use_approx: bool
36
  quantize_time = time.time() - start_time
37
 
38
  # 3. Search the binary index (either exact or approximate)
39
- index = binary_index # binary_ivf if use_approx else binary_index
40
  start_time = time.time()
41
  _scores, binary_ids = index.search(query_embedding_ubinary, top_k * rescore_multiplier)
42
  binary_ids = binary_ids[0]
 
18
  # Load the int8 and binary indices. Int8 is loaded as a view to save memory, as we never actually perform search with it.
19
  int8_view = Index.restore("wikipedia_fr_2022_250K_int8_usearch.index", view=True)
20
  binary_index: faiss.IndexBinaryFlat = faiss.read_index_binary("wikipedia_fr_2022_250K_ubinary_faiss.index")
21
+ binary_ivf: faiss.IndexBinaryIVF = faiss.read_index_binary("wikipedia_fr_2022_250K_ubinary_ivf_faiss.index")
22
 
23
  # Load the SentenceTransformer model for embedding the queries
24
  model = SentenceTransformer("OrdalieTech/Solon-embeddings-large-0.1")
 
36
  quantize_time = time.time() - start_time
37
 
38
  # 3. Search the binary index (either exact or approximate)
39
+ index = binary_ivf if use_approx else binary_index
40
  start_time = time.time()
41
  _scores, binary_ids = index.search(query_embedding_ubinary, top_k * rescore_multiplier)
42
  binary_ids = binary_ids[0]