[Bugfix][LogitsProcessor] Validate ':' separator in custom logits processor FQCN (#56020)
Signed-off-by: 100milliongold <gadian88@gmail.com>
This commit is contained in:
@@ -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])
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user