Repository navigation
fix(openai,mmlupro,vllm): handle multi-EOS lists, SDK request fields, and tokenizer outputs (#4014) - #4029
Merged
Qubitium merged 1 commit intoNov 14, 2026
Conversation
… and tokenizer outputs (ModelCloud#4014) Signed-off-by: Prajwal7-2002 <[email protected]>
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.
Summary
Fixes #4014
Addresses the audit findings identified on
main:TypeErroron Hugging Face tokenizers returning 1Dlist[int].generation_config.eos_token_id(e.g. Llama-3<|eom_id|>and<|end_of_text|>) in favor of a single tokenizer scalar, and_sequence_endonly checked a single token ID.max_completion_tokens,stream,seed) were silently ignored or defaulted, andOpenAiRequestaccepted unknown fields without validation.serve(host="::1")was rejecting all loopback IPv6 requests due to bracketedHost: [::1]check in Starlette'sTrustedHostMiddleware.stop_stringswas dropped when vLLM / SGLang generation adapters were invoked.What Changed
gptqmodel/utils/mmlupro.py:input_idsis a Python 1D list of ints, a nested list of lists, or a PyTorch tensor.gptqmodel/utils/openai_server.py:_resolve_eos_token_idsto collect the complete EOS list fromgeneration_config.eos_token_idand tokenizer._sequence_endto check membership against the full EOS set (int or collection) so sequences stop cleanly on special tokens like<|eom_id|>.max_completion_tokens: int | None = NonetoOpenAiRequest, aliasing tomax_tokens(falling back to 256 default).temperature >= 0.0and enforcedmodel_config = {"extra": "forbid"}to reject unexpected fields with HTTP 422.stream=Truewith HTTP 400 ("Streaming is not currently supported.").seedwithtorch.manual_seedand forwarded to runtime adapters when present."[::1]"to_allowed_hosts_forto permit IPv6 loopback requests throughTrustedHostMiddleware.gptqmodel/utils/vllm.py&gptqmodel/utils/sglang.py:stop_stringsinto thestopsampling parameter so prompt delimiters (such as"Question:") stop generation when using external runtime adapters.tests/test_mmlupro_prompt_budget.py: Updated_FixedTokenizerto return a Pythonlist[int]by default and added parameterized test verifying both list and tensor tokenizers pass withoutTypeError.tests/test_openai_server_contract.py: Added regression tests forstream=Truerejection (400),max_completion_tokensaliasing, negative temperature (422),extra="forbid"(422),seed, multi-EOS lists stopping on<|eom_id|>, and bracketed IPv6 loopback host"[::1]".tests/test_vllm_generate_alignment.py&tests/test_sglang_utils.py: Added tests verifyingstop_stringsis correctly converted intostop.Tests
pytest tests/test_mmlupro_prompt_budget.py tests/test_openai_server_contract.py tests/test_vllm_generate_alignment.py tests/test_sglang_utils.py # 98 passed in 9.42sLinting:
ruff check gptqmodel/utils/mmlupro.py gptqmodel/utils/openai_server.py gptqmodel/utils/sglang.py gptqmodel/utils/vllm.py tests/test_mmlupro_prompt_budget.py tests/test_openai_server_contract.py tests/test_sglang_utils.py tests/test_vllm_generate_alignment.py # All checks passed!Model Support / Module Plan
Not applicable (bug fix and API server compatibility; no new model architecture added).
Logic Flow Documentation
Not applicable (preserves existing routing while fixing EOS token set checking, host validation, and request parsing).
Review Requirements
Kernel Accuracy Requirements
Not applicable (no changes to quantization or dequantization kernels).
Notes
None.