1.1 Configure environment dependencies (recommended in the Docker container created by the Ubuntu image)
sudo apt update && sudo apt install -y git cmake g++ python3 python3-setuptools python3-pip libblas-dev liblapack-dev '''
git clone https://github.com/xiaoming-01ai/descartes.git
pip3 install descartes/descartes-*-linux_x86_64.whl
python3 descartes.py
n, d = 10000, 128
X = np.random.randn(n, d)
def ivecs_read(fname):
a = np.fromfile(fname, dtype='int32')
d = a[0]
return a.reshape(-1, d + 1)[:, 1:].copy()
def fvecs_read(fname):
return ivecs_read(fname).view('float32')
X = fvecs_read("sift_base.fvecs")
index = py01ai.FNGIndex(metric="square_l2", dimension=dimension))
index.init(count=1000000, m=32, s=1, l=200)
index.add_vector(input=X)
v = np.random.randn(1, 128)
results = index.search(query=v, topk=10)
print(results)
The team members come from 01AI: Xiaoming Peng, Gaofei Wang