Skip to content

Instantly share code, notes, and snippets.

@mdouze
Created August 31, 2020 07:57
Show Gist options
  • Save mdouze/93edbc5cf08a122a08decdfb39cd6d1e to your computer and use it in GitHub Desktop.
Save mdouze/93edbc5cf08a122a08decdfb39cd6d1e to your computer and use it in GitHub Desktop.
import faiss
import numpy as np
tab = {}
for i in range(10**6):
print(f'i={i} RSS={faiss.get_mem_usage_kb()} kB', end='\n' if i % 200 == 0 else '\r', flush=True)
quant = faiss.IndexFlatL2(32)
index = faiss.IndexIVFPQ(quant, 32, 100, 4, 4)
x = np.random.rand(5000, 32).astype('float32')
index.train(x)
index.add(x)
tab[50] = index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment