Skip to content

Commit df48987

Browse files
authored
fix(sample_utils): correct top_k error message to the exclusive (0, vocab_size) bound (ml-explore#1377)
1 parent 39c4019 commit df48987

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mlx_lm/sample_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def apply_top_k(
141141
vocab_size = logprobs.shape[-1]
142142
if not isinstance(top_k, int) or not (0 < top_k < vocab_size):
143143
raise ValueError(
144-
f"`top_k` has to be an integer in the (0, {vocab_size}] interval,"
144+
f"`top_k` has to be an integer in the (0, {vocab_size}) interval,"
145145
f" but is {top_k}."
146146
)
147147
mask_idx = mx.argpartition(-logprobs, kth=top_k - 1, axis=-1)[..., top_k:]

0 commit comments

Comments
 (0)