Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Converting the list to ndarray for speedup (#4470)
Browse files Browse the repository at this point in the history
  • Loading branch information
askender authored Apr 9, 2022
1 parent 1d70b0e commit 755b9dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parlai/agents/rag/retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def index_retrieve(
query.cpu().detach().to(torch.float32).numpy(), n_docs
)
ids, np_vectors = zip(*top_docs_and_scores)
vectors = torch.tensor(np_vectors).to(query)
vectors = torch.tensor(np.array(np_vectors)).to(query)
if isinstance(self.indexer, DenseHNSWFlatIndexer):
vectors = vectors[:, :, :-1]
# recompute exact FAISS scores
Expand Down

0 comments on commit 755b9dc

Please sign in to comment.