[Bugfix][LogitsProcessor] Validate ':' separator in custom logits processor FQCN (#56020)

Signed-off-by: 100milliongold <gadian88@gmail.com>
This commit is contained in:
김재억
2026-09-25 01:49:20 +00:00
committed by GitHub
parent 609731e8f5
commit 32fc82343f
2 changed files with 31 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Unit tests for loading custom logits processors by FQCN.
Kept separate from `test_custom_offline.py`, which runs end-to-end against a
downloaded model; these exercise the loader alone and need no model.
"""
import pytest
from vllm.v1.sample.logits_processor import _load_logitsprocs_by_fqcns
@pytest.mark.parametrize(
"fqcn",
[
"invalid_fqcn_without_colon",
"invalid:fqcn:with:multiple:colons",
],
ids=["missing-colon", "too-many-colons"],
)
def test_invalid_fqcn_rejected(fqcn: str):
with pytest.raises(ValueError, match="Invalid logits processor FQCN"):
_load_logitsprocs_by_fqcns([fqcn])
+7 -1
View File
@@ -125,7 +125,13 @@ def _load_logitsprocs_by_fqcns(
continue
logger.debug("- Loading logits processor %s", logitproc)
module_path, qualname = logitproc.split(":")
parts = logitproc.split(":")
if len(parts) != 2:
raise ValueError(
f"Invalid logits processor FQCN {logitproc!r}. "
"Expected format: '<module>:<type>'"
)
module_path, qualname = parts
try:
# Load module