LTEnjoy commited on
Commit
5c9db02
1 Parent(s): 63c4ae7

Update demo/modules/search.py

Browse files
Files changed (1) hide show
  1. demo/modules/search.py +1 -2
demo/modules/search.py CHANGED
@@ -74,13 +74,12 @@ def search(input: str, nprobe: int, topk: int, input_type: str, query_type: str,
74
  index = all_index[query_type][db]["index"]
75
  ids = all_index[query_type][db]["ids"]
76
 
77
- if check_index_ivf(query_type, subsection_type):
78
  if index.nlist < nprobe:
79
  raise gr.Error(f"The number of clusters to search must be less than or equal to the number of clusters in the index ({index.nlist}).")
80
  else:
81
  index.nprobe = nprobe
82
 
83
- print(nprobe)
84
  if topk > index.ntotal:
85
  raise gr.Error(f"You cannot retrieve more than the database size ({index.ntotal}).")
86
 
 
74
  index = all_index[query_type][db]["index"]
75
  ids = all_index[query_type][db]["ids"]
76
 
77
+ if hasattr(index, "nprobe"):
78
  if index.nlist < nprobe:
79
  raise gr.Error(f"The number of clusters to search must be less than or equal to the number of clusters in the index ({index.nlist}).")
80
  else:
81
  index.nprobe = nprobe
82
 
 
83
  if topk > index.ntotal:
84
  raise gr.Error(f"You cannot retrieve more than the database size ({index.ntotal}).")
85