Repository navigation
fix: preserve custom logits processors when applying logit bias - #2454
Open
charan-rathore wants to merge 4 commits into
Open
charan-rathore wants to merge 4 commits into
charan-rathore wants to merge 4 commits into
Conversation
This branch has not been deployed
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.
What changed
create_completion()passedNoneto generation when bothlogits_processorandlogit_biaswere supplied.list.extend()mutates the list and returnsNone, so the custom processors and the bias callback were discarded from that request. The caller's list was also left with an extra bias callback after the call.Build a new
LogitsProcessorListinstead. Custom processors keep their order and run before the bias callback. Reusing the caller's list no longer carries an earlier request's bias into a later request. The processor-only and bias-only paths are unchanged.Tests
Added model-free tests at the public completion-to-generation boundary for streaming and non-streaming requests, empty processor lists, reused lists, and processor-only, bias-only and neither-option controls. The generation boundary is replaced with a recorder, so these test composition and forwarding, not native model sampling.
Local validation used normal package imports from the checked-out wrapper and the standard upstream 0.3.38 CPU wheel's shared library, without building or changing vendor code:
The full upstream suite was not run. No model was downloaded or loaded, and these results do not establish native inference or sampling behavior.
AI assistance was used for implementation, tests and review. No native/vendor code changed. No model-sampling or performance claim.