Skip to content

Commit

Permalink
Make faiss dependency optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojan-karlas committed Sep 30, 2024
1 parent 0291437 commit 7228cbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion experiments/datascope/experiments/pipelines/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import faiss
# import faiss
import numpy as np
import tempfile
import torch
Expand Down Expand Up @@ -100,6 +100,8 @@ def __init__(self, n_neighbors=5):
self.label_encoder = LabelEncoder()

def fit(self, X, y):
import faiss

self.X = X.astype(np.float32)
self.y = self.label_encoder.fit_transform(y)
d = self.X.shape[1]
Expand Down

0 comments on commit 7228cbb

Please sign in to comment.