alexandergagliano commited on
Commit
b622cf4
·
1 Parent(s): 20663a1
Files changed (1) hide show
  1. src/relaiss/relaiss.py +2 -1
src/relaiss/relaiss.py CHANGED
@@ -319,7 +319,8 @@ class ReLAISS:
319
  dim = pca.n_components_ if pca else len(lc_features + host_features)
320
 
321
  index_dir = f"{self.index_stem}.ngt"
322
- ngt.create(index_dir.encode(), dim, distance_type="L2")
 
323
  self._index = ngt.Index(index_dir.encode())
324
 
325
  self._ids = np.load(str(self.index_stem) + "_idx_arr.npy", allow_pickle=True)
 
319
  dim = pca.n_components_ if pca else len(lc_features + host_features)
320
 
321
  index_dir = f"{self.index_stem}.ngt"
322
+ if not os.path.exists(index_dir):
323
+ ngt.create(index_dir.encode(), dim, distance_type="L2")
324
  self._index = ngt.Index(index_dir.encode())
325
 
326
  self._ids = np.load(str(self.index_stem) + "_idx_arr.npy", allow_pickle=True)