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

Save and load usearch options from index header page #101

Merged

Conversation

var77
Copy link
Collaborator

@var77 var77 commented Sep 2, 2023

Description

With this changes we will keep the necessary usearch options (dimensions, ef, ef_construction, m, metric_kind) in our index header when building index and in scans read the options from index header instead of index options.
Also we will add ef and ef_construction params in usearch index header, and make it reload the values when loaded from file as you can see in this PR .

By doing this we can omit all the parameters when building index from file, as we will get the required values from the usearch header and save them in our index header to be used on table scans.

Currently the tests are failing, as the old versions of index files are being used, they need to be replaced in the bucket with newer versions.

@var77 var77 force-pushed the feature/save-usearch-options-in-header branch from 0ecf4b8 to 994917a Compare September 3, 2023 11:22
@var77 var77 marked this pull request as ready for review September 3, 2023 11:34
@var77 var77 changed the title [WIP] Save and load usearch options from index header page Save and load usearch options from index header page Sep 3, 2023
@var77 var77 requested review from Ngalstyan4 and dqii September 3, 2023 22:00
Copy link
Contributor

@Ngalstyan4 Ngalstyan4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/hnsw/build.c Outdated
assert(error == NULL);
opts.dimensions = usearch_dimensions(buildstate->usearch_index, &error);
assert(error == NULL);
opts.expansion_add = usearch_expansion_add(buildstate->usearch_index, &error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could all of these be retrieved from usearch_metadata?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be done some changes in usearch to return this data from metadata but yes technically it is possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this params to usearch_metadata in this PR

@@ -39,7 +39,7 @@ EXPLAIN (COSTS FALSE) SELECT ROUND(l2sq_dist(v, :'v777')::numeric, 2) FROM sift_

SELECT ROUND(l2sq_dist(v, :'v777')::numeric, 2) FROM sift_base1k order by v <-> :'v777' LIMIT 10;
INFO: began scanning with 0 keys and 1 orderbys
INFO: starting scan with dimensions=128 M=16 efConstruction=128 ef=64
INFO: starting scan with dimensions=128 M=16 efConstruction=64 ef=32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on what happened here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the ef search and ef construction to other values from the default ones we have now, so it would it more visible that the values are being loaded from the file header

@var77 var77 requested a review from Ngalstyan4 September 5, 2023 12:46
@var77 var77 force-pushed the feature/save-usearch-options-in-header branch 3 times, most recently from bff3ce7 to 89a05af Compare September 7, 2023 07:18
@var77 var77 force-pushed the feature/save-usearch-options-in-header branch from 89a05af to 36a4307 Compare September 7, 2023 07:28
@Ngalstyan4 Ngalstyan4 merged commit 4646afc into lanterndata:main Sep 7, 2023
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

Successfully merging this pull request may close these issues.

2 participants