-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
add skip_storage flag to HNSW #3487
Conversation
This pull request was exported from Phabricator. Differential Revision: D57911060 |
faiss/impl/index_write.cpp
Outdated
WRITE1(n4); | ||
} else { | ||
write_index(idxhnsw->storage, f); | ||
} | ||
write_index(idxhnsw->storage, f); |
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.
writing the storage twice, dupilcate rows 770 and 772
@@ -251,7 +249,8 @@ void hnsw_search( | |||
const SearchParameters* params_in) { | |||
FAISS_THROW_IF_NOT_MSG( | |||
index->storage, | |||
"Please use IndexHNSWFlat (or variants) instead of IndexHNSW directly"); | |||
"No storage index, please use IndexHNSWFlat (or variants) " | |||
"instead of IndexHNSW directly"); |
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.
When do we prefer to using IndexHNSW and when should we use IndexHNSWFlat?
@@ -531,7 +530,10 @@ Index* read_index(IOReader* f, int io_flags) { | |||
Index* idx = nullptr; | |||
uint32_t h; | |||
READ1(h); | |||
if (h == fourcc("IxFI") || h == fourcc("IxF2") || h == fourcc("IxFl")) { | |||
if (h == fourcc("null")) { |
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.
When do we see the caller provide null ?
@@ -765,6 +763,12 @@ void write_index(const Index* idx, IOWriter* f) { | |||
WRITE1(h); | |||
write_index_header(idxhnsw, f); | |||
write_HNSW(&idxhnsw->hnsw, f); | |||
if (io_flags & IO_FLAG_SKIP_STORAGE) { | |||
uint32_t n4 = fourcc("null"); | |||
WRITE1(n4); |
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.
is it gonna to output in stdout?
np.testing.assert_array_equal(Dnew, Dref) | ||
np.testing.assert_array_equal(Inew, Iref) | ||
|
||
if False: |
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.
where do we define the False?
format & internal linter |
Summary: Sometimes it is not useful to serialize the storage index along with a HNSW index. This diff adds a flag that supports skipping the storage of the index. Searchign and adding to the index is not possible until a storage index is added back in. Reviewed By: junjieqi Differential Revision: D57911060
This pull request was exported from Phabricator. Differential Revision: D57911060 |
This pull request has been merged in bf73e38. |
Summary: Pull Request resolved: facebookresearch#3487 Sometimes it is not useful to serialize the storage index along with a HNSW index. This diff adds a flag that supports skipping the storage of the index. Searchign and adding to the index is not possible until a storage index is added back in. Reviewed By: junjieqi Differential Revision: D57911060 fbshipit-source-id: 5a4ceee4a8f53f6f746df59af3942b813a99c14f
Summary: Pull Request resolved: facebookresearch#3487 Sometimes it is not useful to serialize the storage index along with a HNSW index. This diff adds a flag that supports skipping the storage of the index. Searchign and adding to the index is not possible until a storage index is added back in. Reviewed By: junjieqi Differential Revision: D57911060 fbshipit-source-id: 5a4ceee4a8f53f6f746df59af3942b813a99c14f
Summary: Pull Request resolved: facebookresearch#3487 Sometimes it is not useful to serialize the storage index along with a HNSW index. This diff adds a flag that supports skipping the storage of the index. Searchign and adding to the index is not possible until a storage index is added back in. Reviewed By: junjieqi Differential Revision: D57911060 fbshipit-source-id: 5a4ceee4a8f53f6f746df59af3942b813a99c14f
Summary:
Sometimes it is not useful to serialize the storage index along with a HNSW index. This diff adds a flag that supports skipping the storage of the index.
Searchign and adding to the index is not possible until a storage index is added back in.
Differential Revision: D57911060