-
Notifications
You must be signed in to change notification settings - Fork 61
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
Save and load usearch options from index header page #101
Conversation
0ecf4b8
to
994917a
Compare
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
bff3ce7
to
89a05af
Compare
89a05af
to
36a4307
Compare
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
andef_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.