Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a persistence function [python]? #20

Closed
HengDing890 opened this issue Mar 6, 2017 · 2 comments
Closed

Is there a persistence function [python]? #20

HengDing890 opened this issue Mar 6, 2017 · 2 comments

Comments

@HengDing890
Copy link

Hi everyone

whether there is a way to save cluster/index into a local file?

For example:

ncentroids = 1024
niter = 20
verbose = true
d = x.shape[1]
kmeans = faiss.Kmeans(d, ncentroids, niter, verbose)
kmeans.train (x)

after kmeans.train(x), I want to save the result into a local file, then next time I only need to load the file, and search cluster as follows (instead of re-run the clustering on the original data)

D, I = kmeans.index.search(x, 1)
@HengDing890 HengDing890 changed the title Is there a persistence function? Is there a persistence function [python]? Mar 6, 2017
@mdouze
Copy link
Contributor

mdouze commented Mar 7, 2017

Hi,

You can save index to a file with write_index and load it with read_index, see

https://github.com/facebookresearch/faiss/wiki/High-level-interface-and-auto-tuning#io-and-deep-copying-indexes

@seriousran
Copy link

Above link has changed. Check this out.

https://github.com/facebookresearch/faiss/wiki/Index-IO,-cloning-and-hyper-parameter-tuning

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants