Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Mar 8, 2024
1 parent 8234762 commit 70375ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ann_benchmarks/algorithms/descartes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN apt install -y git cmake g++ python3 python3-setuptools python3-pip libblas-
RUN pip3 install wheel pybind11==2.5.0

WORKDIR /home/app
RUN git clone https://github.com/xiaoming-01ai/pydescartes.git
RUN cp pydescartes/py01ai.cpython-310-x86_64-linux-gnu.so ./py01ai.cpython-310-x86_64-linux-gnu.so
RUN git clone https://github.com/xiaoming-01ai/descartes.git
RUN pip3 install descartes/descartes-*-linux_x86_64.whl
16 changes: 8 additions & 8 deletions ann_benchmarks/algorithms/descartes/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ def __init__(self, metric, method_param):
self.name = "01ai (%s)" % (self.method_param)

def fit(self, X):
self.index = py01ai.FNGIndex(self.metric, len(X[0]))
self.index.init(len(X),
self.method_param["M"],
self.method_param["S"],
self.method_param["L"])
self.index = py01ai.FNGIndex(metric=self.metric, dimension=len(X[0]))
self.index.init(count=len(X),
m=self.method_param["M"],
s=self.method_param["S"],
l=self.method_param["L"])
try:
self.index.add_vector(np.asarray(X))
self.index.add_vector(input=np.asarray(X))
except Exception as e:
print(str(e))

def set_query_arguments(self, ex, ef):
self.search_ef = ef
self.search_ex = ex
self.index.set_query_param(ef, ex)
self.index.set_query_param(ef=ef, ex=ex)

def query(self, v, n):
return self.index.search(v, n)
return self.index.search(query=v, topk=n)

def freeIndex(self):
del self.index
Expand Down

0 comments on commit 70375ee

Please sign in to comment.