Skip to content

Commit

Permalink
Comment update for tensor size
Browse files Browse the repository at this point in the history
  • Loading branch information
opentaco committed Nov 15, 2022
1 parent d96b625 commit 6dd06f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bittensor/utils/tokenizer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def unravel_topk_token_phrases(compact_topk: torch.Tensor, topk: int, ignore_ind
f'{batch_size} * ({topk} + 1) != {len(prob_idx)}' # decoding irregularity otherwise

probs = torch.clamp(compact_topk[prob_idx], 0, 1) # [batch_size * (topk + 1)] ensure probabilities within [0, 1]
probs_sum = probs.reshape(batch_size, topk + 1).sum(dim=1) # [batch_size, (topk + 1)]
probs_sum = probs.reshape(batch_size, topk + 1).sum(dim=1) # [batch_size]
assert torch.all((-atol < probs_sum) & (probs_sum < 1 + atol)), f'unravel_topk_token_phrases(): probs_sum not in [0, 1]'

# Obtain phrase lengths and maximum phrase length
Expand Down

0 comments on commit 6dd06f9

Please sign in to comment.