Skip to content

Commit

Permalink
fixed not being added while training
Browse files Browse the repository at this point in the history
  • Loading branch information
soldni committed Oct 11, 2022
1 parent 288d729 commit 094f2dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pyterrier_sentence_transformers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def __init__(
def index_data(self, ids: List[Any], embeddings: np.ndarray):
self._update_id_mapping(ids)
embeddings = embeddings.astype('float32')

if not self.index.is_trained:
self.index.train(embeddings)
else:
self.index.add(embeddings)

self.index.add(embeddings)

print(f'Total data indexed {len(self.index_id_to_db_id)}')

Expand Down

0 comments on commit 094f2dd

Please sign in to comment.