Skip to content

fix: mark None-default parameters as Optional in vLLMExporter#724

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/vllm-exporter-optional-hints
Open

fix: mark None-default parameters as Optional in vLLMExporter#724
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/vllm-exporter-optional-hints

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

Bug

vLLMExporter.export and vLLMExporter.forward declare several parameters with a default of None but annotate them as non-optional str or int (e.g., tokenizer: str = None). This misrepresents the API and triggers type-checker warnings.

Fix

Annotate all None-default parameters as Optional[...].

Test

Added a static regression test in tests/unit_tests/export/test_vllm_exporter.py that asserts every parameter defaulting to None in these two methods is a typing.Union (i.e., Optional).

Verification

python -m py_compile nemo_export/vllm_exporter.py tests/unit_tests/export/test_vllm_exporter.py passes.

Several arguments in vLLMExporter.export and vLLMExporter.forward use
None as a default but were annotated as non-optional str/int. This
causes type-checker warnings and violates the documented signatures.
Annotate them as Optional.

Adds a static regression test that asserts every parameter with a None
default in these methods is Optional.

Signed-off-by: Andrew White <andrewh@cdw.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant