Repository navigation
fix(sampler): bound top_k to the vocabulary before the int32 cast - #848
Closed
techsaurabh-394 wants to merge 1 commit into
Closed
techsaurabh-394 wants to merge 1 commit into
techsaurabh-394 wants to merge 1 commit into
Conversation
KarrAcaRn
pushed a commit
to KarrAcaRn/FreeToken-ByAI
that referenced
this pull request
Nov 2, 2026
FlashML-org#850 adopted with fixups, FlashML-org#848/FlashML-org#849 superseded (FlashML-org#790/FlashML-org#788), FlashML-org#845 and FlashML-org#844 deferred (no NVFP4 qwen4exp GGUF; GPU driver down). FlashML-org#316 was closed upstream without merge and is kept for the ROCm branches. Assisted-by: Claude Opus 5.5
Collaborator
|
Close as #790 fix it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #789
Sampler.prepare()failed with an OverflowError when a request'stop_kdid not fit in int32 (for example2**31or2**80), and one such row broke preparation of a whole mixed batch. Atop_kat or above the vocabulary size is the same as no top-k, so it is now capped atvocab_sizebefore the int32 tensor is built.Tested: ran the issue's repro on CPU with
make_device_tensorreplaced by a plain CPU tensor and CUDA-only modules mocked (no GPU on my machine).top_k=2**31and2**80no longer raise andprepare()returnstop_k=None;top_k=5still givestensor([5]). Not run on a GPU; the repo's pytest suite was not run. No test added.