Repository navigation
Conversation
Update generation configuration logic to prioritize extra kwargs.
Cover mapped stop words, random seeds, computed logprobs, explicit None and an offline custom generation_config.json.
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.
Motivation
A custom
--generation-configdirectory may contain LMDeploy-compatible keys such asstop_words. The loader retains those keys, while the serving endpoints also supply mapped/computed kwargs (for example,stop_words=request.stop). The builder currently removes overlaps only from the request before merging server defaults. The default therefore reaches the constructor alongside the explicit kwarg and raisesTypeError: GenerationConfig() got multiple values for keyword argument 'stop_words'.This is reproducible offline with a temporary
generation_config.jsoncontaining{"do_sample": true, "temperature": 0.6, "stop_words": ["default-stop"]}, loaded throughresolve_default_gen_configand passed tobuild_serving_generation_config. Both an omitted stop and an explicit request stop fail on main.random_seedand computedlogprobshave the same collision when present in the defaults.Modification
None, without mutating the defaults or changing the special handling of generation length and sampling mode.Validation
aba987ad2266d2fd2204e9d22d1ce43a5984dc91, the six added cases fail with duplicate-keywordTypeError.git diff --checkpasses.Local validation uses Python 3.12.3 on Windows with PyTorch 2.7.1 and Transformers 4.57.1. No model downloads, GPU inference, full-repository suite or dependency-version matrix was run. The existing deprecation/Pydantic/optional-JIT warnings remain.
Checklist
Developed with AI assistance; the patch, baseline failures and final test results were checked locally.