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

Flag to avoid NaN check in clustering #3294

Open
moshaad7 opened this issue Mar 15, 2024 · 1 comment
Open

Flag to avoid NaN check in clustering #3294

moshaad7 opened this issue Mar 15, 2024 · 1 comment

Comments

@moshaad7
Copy link

moshaad7 commented Mar 15, 2024

https://github.com/facebookresearch/faiss/blob/e99ad124cbc40c03f72a37032ec25fcabf1479cf/faiss/Clustering.cpp#L283C1-L292C6

if (!codec) {
        // Check for NaNs in input data. Normally it is the user's
        // responsibility, but it may spare us some hard-to-debug
        // reports.
        const float* x = reinterpret_cast<const float*>(x_in);
        for (size_t i = 0; i < nx * d; i++) {
            FAISS_THROW_IF_NOT_MSG(
                    std::isfinite(x[i]), "input contains NaN's or Inf's");
        }
    }

Can you give users a flag to avoid this check ?
We already have a level above faiss which parse json docs to build vectors and check for all possible NaN/nil cases.

@mdouze
Copy link
Contributor

mdouze commented Mar 19, 2024

Marking as enhancement, but I don't think there is a significant win in terms of runtime, so low-priority for us.

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

No branches or pull requests

2 participants