Skip to content

Commit

Permalink
fp32 topk on cpu (#34)
Browse files Browse the repository at this point in the history
* fp32 topk on cpu

* black
  • Loading branch information
danjust authored Oct 27, 2023
1 parent 0fdb741 commit 14f39f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion besskge/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ def forward(self) -> Dict[str, Any]:
if self.return_scores:
scores.append(batch_scores_filt)
if self.return_topk:
topk_ids.append(torch.topk(batch_scores_filt, k=self.k, dim=-1).indices)
topk_ids.append(
torch.topk(
batch_scores_filt.to(torch.float32), k=self.k, dim=-1
).indices
)

out = dict()
if scores:
Expand Down

0 comments on commit 14f39f8

Please sign in to comment.