Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
jalammar committed Feb 7, 2021
1 parent cad51f3 commit 2bd80e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ecco/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ def rankings(self, **kwargs):
# Sort by score (ascending)
sorted = torch.argsort(logits)
# What token was sampled in this position?
token_id = self.token_ids[self.n_input_tokens + j].clone().detach()

token_id = torch.tensor(self.token_ids[self.n_input_tokens + j])
# token_id = self.token_ids.clone().detach()[self.n_input_tokens + j]
# What's the index of the sampled token in the sorted list?
r = torch.nonzero((sorted == token_id)).flatten()
# subtract to get ranking (where 1 is the top scoring, because sorting was in ascending order)
Expand Down

0 comments on commit 2bd80e5

Please sign in to comment.