Skip to content

fix(speechlm2): default offline vLLM engines to spawn in the SpeechLM plugin - #16667

Merged
pzelasko merged 1 commit into
mainfrom
task/speechlm2-vllm-spawn-default
Nov 19, 2026
Merged

pzelasko merged 1 commit into
mainfrom
task/speechlm2-vllm-spawn-default

Conversation

@vmendelev

Copy link
Copy Markdown
Collaborator

What does this PR do ?

Offline vllm.LLM engines in an environment with NeMo installed no longer need VLLM_WORKER_MULTIPROC_METHOD=spawn: the SpeechLM vLLM plugin now makes spawn the default.

Collection: speechlm2

Changelog

  • Cause. vLLM loads every installed general plugin in the parent process while it builds EngineArgs. Importing the SpeechLM plugin imports nemo.collections.speechlm2, which reaches nemo/core/utils/optional_libs.py, whose NUMBA_CUDA_AVAILABLE check calls numba.cuda.is_available() and initializes the CUDA driver. Torch's CUDA state stays uninitialized, so offline LLM keeps vLLM's default fork start method, and the forked EngineCore fails with RuntimeError: CUDA driver initialization failed. This hits any offline engine in such an environment, text-only models included. vllm serve is unaffected because its CLI already defaults to spawn.
  • Fix. register() sets VLLM_WORKER_MULTIPROC_METHOD to spawn unless the user chose a method, as vllm serve does. It runs before the version gate because the import has already initialized CUDA even when registration is skipped. Every Speech script that constructs LLM already has the __main__ guard that spawn needs.
  • Docs. Drops the now-redundant variable from the fine-tuning guide's environment table, the finetune-speech-llm skill, the quantization guide, the quantization README and the calibration script docstring. The troubleshooting entry now points at an explicit fork.

Making NeMo's numba-cuda check lazy would also fix the root cause for forked processes outside vLLM. NUMBA_CUDA_AVAILABLE is read at import time by numba_cuda_required and ASR's audio_preprocessing, though, so that is a wider core change. This PR only removes the vLLM failure.

Validation

  • pre-commit run --from-ref origin/main --to-ref HEAD and git diff --check pass; the commit is signed off by its author.
  • pytest --cpu -m "not pleasefixme" tests/collections/speechlm2/test_vllm_*.py tests/collections/speechlm2/test_finetuning_tools.py on vLLM 0.32.0: 554 passed, 6 skipped. The new test_register_defaults_vllm_workers_to_spawn[None-spawn] fails without the fix. The fake-vLLM helper restores the variable, so register() tests leave the session environment unchanged.
  • GPU, with no vLLM variables set: LLM(model="Qwen/Qwen3-0.6B") plus one generate call. On 0.33.0 the tree was build(speechlm2): bump the vllm extra to vLLM 0.33.0 #16666 + fix(speechlm2): find vLLM 0.33's chat parser for the prompt contract #16505, with and without this change.
Tree vLLM 0.32.0 vLLM 0.33.0
without this change CUDA driver initialization failed CUDA driver initialization failed
without this change, VLLM_PLUGINS= (plugin disabled) generates
this PR generates generates
  • vllm_task_eval.py --task asr on vLLM 0.32.0, nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-FP8 with MTP, 300 LibriSpeech test-clean utterances, no VLLM_WORKER_MULTIPROC_METHOD: WER 1.34%, the same as the earlier run that used the workaround.
  • Merges cleanly with build(speechlm2): bump the vllm extra to vLLM 0.33.0 #16666.
  • Not run: calibrate_activations.py, docs build (only code-block text changed).

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Additional Information

… plugin

Importing the plugin initializes the CUDA driver through NeMo's numba-cuda
availability check, so the EngineCore process that offline vllm.LLM forks
afterwards fails with 'CUDA driver initialization failed'. register() now
defaults VLLM_WORKER_MULTIPROC_METHOD to spawn, as vllm serve already does,
and keeps an explicit setting. Drop the now-redundant workaround from docs.

Signed-off-by: Valentin Mendelev <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 18, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR defaults vLLM workers to spawn, keeps explicit user settings, and removes the redundant environment setup from the docs. I completed the review of all seven changed files and found no blocking defects. Approval needs a maintainer decision because the registration hook changes process-start behavior for every engine loading this plugin, including text-only models and unsupported vLLM versions.

The new regression test covers an unset variable and explicit fork, and checks that the default applies before the version gate. Reading the base implementation shows the unset-variable case fails without this change. Environment restoration is sound, and the directly affected offline scripts have __main__ guards. The documentation edits match the new default.

I reviewed source only. I did not run tests, execute GPU inference, or build documentation; the reported validation results are author-provided. Third-party vLLM internals are not mounted, so I could not independently verify their loading order. The supplied commit message includes a DCO trailer, but author metadata was not supplied to verify the identity match.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@pzelasko
pzelasko enabled auto-merge (squash) November 18, 2026 16:59
@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test fb66728

@pzelasko

Copy link
Copy Markdown
Collaborator

/review-approve

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR defaults vLLM workers to spawn, keeps explicit user settings, and removes redundant environment setup from the docs. I completed this same-head follow-up with no eligible defect findings. Approval still needs a maintainer decision.

Review 5961138296 reviewed the current commit, so there are no subsequent changes or unresolved findings to assess. I accounted for all seven changed files and checked the earlier source observations without restarting broad defect discovery. The registration hook still sets the default before the version gate. The regression test and environment cleanup cover the changed contract appropriately: an unset variable becomes spawn, explicit fork stays unchanged, and teardown restores the original environment. The edited documentation matches that behavior, and the directly affected offline entrypoints have __main__ guards.

The maintainer guardrail still applies because the general-plugin entry point changes process-start defaults for every engine loading this plugin. A maintainer needs to accept that scope, including text-only models and unsupported vLLM versions.

I reviewed source only. I did not run tests, GPU inference, calibration, or a documentation build; the reported validation is author-provided. Third-party vLLM internals are not mounted, so I could not independently verify loading order. Commit author metadata was not supplied, so I could not check the DCO identity match.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

@github-actions

Copy link
Copy Markdown
Contributor

[🤖]: Hi @vmendelev 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully.

So it might be time to merge this PR or get some approvals.

@pzelasko
pzelasko merged commit 77bb40b into main Nov 19, 2026
140 checks passed
@pzelasko
pzelasko deleted the task/speechlm2-vllm-spawn-default branch November 19, 2026 13:25

This branch was previously deployed

2 inactive deployments
public — fb667288 Deployed Nov 18, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #2274
test — fb667288 Deployed Nov 18, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #21931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants