Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions faiss/python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# causes a ton of useless warnings.

import numpy as np
import logging
import sys
import inspect

Expand All @@ -30,6 +31,8 @@
FAISS_VERSION_MINOR,
FAISS_VERSION_PATCH)

logger = logging.getLogger(__name__)

class_wrappers.handle_Clustering(Clustering)
class_wrappers.handle_Clustering1D(Clustering1D)
class_wrappers.handle_MatrixStats(MatrixStats)
Expand Down Expand Up @@ -161,14 +164,13 @@ def replacement_function(*args):


try:
from swigfaiss_gpu import GpuIndexIVFFlat, GpuIndexBinaryFlat, GpuIndexFlat, GpuIndexIVFPQ, GpuIndexIVFScalarQuantizer
add_ref_in_constructor(GpuIndexIVFFlat, 1)
add_ref_in_constructor(GpuIndexBinaryFlat, 1)
add_ref_in_constructor(GpuIndexFlat, 1)
add_ref_in_constructor(GpuIndexIVFPQ, 1)
add_ref_in_constructor(GpuIndexIVFScalarQuantizer, 1)
except ImportError as e:
print("Failed to load GPU Faiss: %s. Will not load constructor refs for GPU indexes." % e.args[0])
except NameError as e:
logger.info("Failed to load GPU Faiss: %s. Will not load constructor refs for GPU indexes." % e.args[0])

add_ref_in_constructor(IndexIVFFlat, 0)
add_ref_in_constructor(IndexIVFFlatDedup, 0)
Expand Down