Skip to content

Commit c048917

Browse files
ddrcodermeta-codesync[bot]
authored andcommitted
Enable quieting FAISS warning "inverted lists not stored" (facebookresearch#4964)
Summary: Pull Request resolved: facebookresearch#4964 This unthrottled log site is leading to log spew. Reviewed By: luciang Differential Revision: D97350834 fbshipit-source-id: 824a98cc20504bc363bad662e4b57b68d0699758
1 parent b2ddb46 commit c048917

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

faiss/impl/index_read.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,19 @@ static void read_ArrayInvertedLists_sizes(
413413
}
414414
}
415415

416+
bool index_read_warn_on_null_invlists = true;
417+
416418
std::unique_ptr<InvertedLists> read_InvertedLists_up(
417419
IOReader* f,
418420
int io_flags) {
419421
uint32_t h;
420422
READ1(h);
421423
if (h == fourcc("il00")) {
422-
fprintf(stderr,
423-
"read_InvertedLists:"
424-
" WARN! inverted lists not stored with IVF object\n");
424+
if (index_read_warn_on_null_invlists) {
425+
fprintf(stderr,
426+
"read_InvertedLists:"
427+
" WARN! inverted lists not stored with IVF object\n");
428+
}
425429
return nullptr;
426430
} else if (h == fourcc("ilpn") && !(io_flags & IO_FLAG_SKIP_IVF_DATA)) {
427431
size_t nlist, code_size, n_levels;

faiss/index_io.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <cstdio>
1414
#include <memory>
1515

16+
#include <faiss/impl/platform_macros.h>
17+
1618
/** I/O functions can read/write to a filename, a file handle or to an
1719
* object that abstracts the medium.
1820
*
@@ -68,6 +70,8 @@ const int IO_FLAG_MMAP = IO_FLAG_SKIP_IVF_DATA | 0x646f0000;
6870
// after OnDiskInvertedLists get properly updated.
6971
const int IO_FLAG_MMAP_IFC = 1 << 9;
7072

73+
FAISS_API extern bool index_read_warn_on_null_invlists;
74+
7175
Index* read_index(const char* fname, int io_flags = 0);
7276
Index* read_index(FILE* f, int io_flags = 0);
7377
Index* read_index(IOReader* reader, int io_flags = 0);

0 commit comments

Comments
 (0)