Skip to content

fix(speechlm2): find vLLM 0.33's chat parser for the prompt contract - #16505

Merged
pzelasko merged 2 commits into
NVIDIA-NeMo:mainfrom
PhilflowIO:fix/vllm-0.33-chat-parts-adapter
Nov 19, 2026
Merged

pzelasko merged 2 commits into
NVIDIA-NeMo:mainfrom
PhilflowIO:fix/vllm-0.33-chat-parts-adapter

Conversation

@PhilflowIO

@PhilflowIO PhilflowIO commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Makes the SALM vLLM plugin start on vLLM 0.33.0 — today vllm serve aborts for every SpeechLM checkpoint (e.g. nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B) while the plugin registers.

Collection: speechlm2

TypeError: Unsupported vLLM chat API: _parse_chat_message_content_parts is missing.

vLLM 0.33.0 turned vllm.renderers.chat_utils into a package and made the parser public as vllm/renderers/chat_utils/chat_message.py::parse_chat_message_content_parts (same signature). parse_chat_message_content calls it as a module global of chat_message, so that is where the adapter has to sit.

Changelog

  • runtime_compat.py: _locate_chat_parser() returns the module + attribute name of the parser, newest layout first: chat_message.parse_chat_message_content_parts (0.33), vllm.renderers.chat_utils._parse_chat_message_content_parts (0.32), vllm.entrypoints.chat_utils._parse_chat_message_content_parts (older). _patch_speechlm_training_prompt_contract takes the attribute name (default unchanged). The wrapper itself, its idempotence and its fail-closed behaviour are unchanged.
  • test_vllm_runtime_compat.py: three tests for the 0.33 layout (patches chat_message, renders the exact text <|audio|> contract through it, idempotent, error names the missing public parser). The three fail on main and pass here; the existing 18 still pass.
  • The vllm extra stays pinned to vllm==0.32.0; whether to move the pin is your call. This change keeps 0.32 working.

Usage

No API change — vllm serve <SpeechLM checkpoint> now starts on vLLM 0.33.0 as it does on 0.32.0.

Validation

  • pytest tests/collections/speechlm2/test_vllm_runtime_compat.py: 23 passed (the cache fixture runs two tests twice)
  • black 24 / isort / flake8 (line length 119) clean

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? (None needed — internal compatibility shim, no user-facing change.)
  • 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? (vllm is imported inside the function, each layout behind try/except ImportError, as before.)

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Additional Information

We serve the model on a vLLM 0.33.0 environment shared with other models, so a second, 0.32-pinned environment is not an option for us. Until this is merged we pin a fork at this commit.

🤖 Generated with Claude Code

@copy-pr-bot

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

@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test 821e036

@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test 17220e6

@pzelasko

Copy link
Copy Markdown
Collaborator

/review

@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.

This adds discovery of vLLM 0.33's public chat parser while keeping the legacy adapter path. It is not ready to merge: the supplied merge commit has no DCO sign-off. I also found a non-blocking test-isolation regression described inline.

Blocking: sign off the merge commit

The supplied message for commit 17220e64d94d57782c0f88200510b3383df8d8c3 contains only Merge branch 'main' into fix/vllm-0.33-chat-parts-adapter, with no Signed-off-by trailer. Repository guidance requires an author-matching sign-off on every commit, so this blocks merging.

These commands rewrite published history. Coordinate with anyone using the branch before pushing.

  1. Configure user.name and user.email to the real identity used to author the commits.
  2. Run git rebase --signoff origin/main.
  3. Run git push --force-with-lease.

Acceptance: inspect the published PR commits with git log --format='%h %s%nAuthor: %an <%ae>%n%(trailers:key=Signed-off-by)' origin/main..HEAD. Every remaining commit must have a sign-off matching its author exactly. Keep the reviewed parser and test changes intact during this signing repair. The supplied metadata lacks author identities, so I could not check identity matching for the existing trailer.

Verification scope

I inspected both changed files and traced plugin registration into the prompt adapter. The new tests cover public-parser installation, exact prompt rendering, and idempotence; the inline finding addresses the legacy-layout isolation gap. The unchanged dependency pin agrees with the serving documentation, so this internal compatibility addition does not require a documentation correction. I did not run tests or independently verify startup against a real vLLM 0.33 installation.

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

* Earlier releases have ``vllm.entrypoints.chat_utils._parse_chat_message_content_parts``.
"""
try:
from vllm.renderers.chat_utils import chat_message # vLLM >= 0.33

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.

Should fix: isolate the legacy-layout tests from cached 0.33 modules.

This new import bypasses the mocks in the two existing legacy-layout tests when sys.modules["vllm.renderers.chat_utils"] already contains the 0.33 package. Python can return that cached child even when the tests replace vllm.renderers with a fake or None. Installation then patches the cached public parser instead of the test's legacy fake, so the final marker assertion raises AttributeError. Base selected the mocked renderer or entrypoints module directly.

A minimal proposed reproduction is to preload that cache entry with SimpleNamespace(chat_message=public), where public comes from _fake_vllm_chat_utils("parse_chat_message_content_parts"), then execute either legacy test's setup and installation call. This also represents running those tests after plugin registration has loaded the modern parser.

In both test_install_prompt_contract_patches_vllm_renderers_chat_utils and test_install_prompt_contract_falls_back_to_vllm_entrypoints_chat_utils, add this before installation:

monkeypatch.setitem(sys.modules, "vllm.renderers.chat_utils", None)

This deliberately disables modern discovery only for the legacy-layout simulations. Keep the 0.33 tests' explicit child-module mocks; do not change production discovery or block the module globally.

Acceptance, proposed rather than executed: exercise each legacy test with and without a preloaded public-parser module. Each must patch its own legacy fake and leave the preloaded parser unchanged. Retain the 0.33 assertions that the public parser is patched once, renders Transcribe <|audio|>, and keeps the audio payload registered.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9de5c17. Both legacy-layout tests now set sys.modules["vllm.renderers.chat_utils"] = None before installation. Each one also runs with and without a preloaded 0.33 public parser, and the fixture asserts that the preloaded parser is left unchanged. Without the fix, the two 0.33-parser-cached cases fail as you described. With it, all 23 tests in the file pass. The 0.33 tests and production discovery are unchanged.

PhilflowIO and others added 2 commits November 16, 2026 15:24
vLLM 0.33 turned vllm.renderers.chat_utils into a package and made the
content-part parser public as
chat_message.parse_chat_message_content_parts. The package has no
_parse_chat_message_content_parts any more, so install_prompt_contract
raised "Unsupported vLLM chat API" while the plugin registered, and
`vllm serve` aborted for every SpeechLM checkpoint on 0.33.

The adapter now looks the parser up where vLLM's chat path resolves it:
chat_message's module global on 0.33 (parse_chat_message_content calls
it there), the 0.32 module, then the pre-0.32 entrypoints module. The
signature is unchanged across all three, so the wrapper is the same;
it still fails closed when none of them has the parser. The vllm extra
stays pinned to 0.32.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: PhilflowIO <[email protected]>
Python returns a cached child module even when its parent is mocked
away, so once plugin registration has imported vllm.renderers.chat_utils
the two legacy-layout tests patched the real 0.33 parser instead of
their own fake. Block modern discovery explicitly in those tests and
run each of them with and without a preloaded public parser.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: PhilflowIO <[email protected]>
@PhilflowIO
PhilflowIO force-pushed the fix/vllm-0.33-chat-parts-adapter branch from 17220e6 to 9de5c17 Compare November 16, 2026 14:24
@PhilflowIO

Copy link
Copy Markdown
Contributor Author

Rebased onto main with sign-off, which drops the unsigned merge commit; all commits are now signed off. @pzelasko could you re-trigger /ok to test? Thanks!

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 16, 2026
@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test 9de5c17

@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.

This adds vLLM 0.33 parser discovery while keeping the legacy adapter path. The concrete prior findings are resolved, and I found no remaining in-scope blockers in this follow-up review.

The legacy-layout tests now block modern discovery before installation. Their parametrized fixture covers both cache states and checks that the preloaded public parser stays unchanged. Reading the tests shows that removing the isolation fix would reproduce the earlier failure. The modern-layout tests still check exact prompt rendering, audio registration and idempotence.

The unsigned merge commit 17220e64d94d57782c0f88200510b3383df8d8c3 is absent from the supplied current commit list. Both listed commits contain Signed-off-by trailers, closing the prior missing-trailer finding. Author identities were not supplied, so I could not verify exact author-to-sign-off matching. The serving instructions still agree with the unchanged vLLM 0.32.0 pin; these follow-up edits need no documentation change.

I inspected both changed files and traced plugin registration into the installer. The previously reviewed tree was unavailable, so I could not independently compare the complete inter-review delta. This review covers the earlier findings and identifiable follow-up edits, not a fresh full-PR review. I did not execute tests or verify startup against a real vLLM 0.33 installation.

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 @PhilflowIO 👋,

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.

@DongjiGao DongjiGao 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.

Thanks, this looks right. I checked the v0.33.0 source: chat_message.py resolves parse_chat_message_content_parts as a module global (L622, L637), so the patch covers both LLM.chat and /v1/chat/completions. The scoring path imports the package re-export and keeps the original parser, which is fine, since SALM does not serve pooling. Two non-blocking notes:

  1. The description still says 21 tests; the file now has 23 cases (the cache fixture runs two tests twice).
  2. CI pins vLLM 0.32 and the new tests use fake parser modules, so nothing here starts a real 0.33 server. If you have a log of vllm serve with a SpeechLM checkpoint on 0.33, please paste it here. Otherwise we will cover real 0.33 in the PR that moves the pin.

@PhilflowIO

Copy link
Copy Markdown
Contributor Author

Thanks for checking the 0.33 source.

  1. Fixed the description: 23 cases.
  2. Yes, we have a real 0.33 run. On 2026-11-08 we served our W8A16 quantization of nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B (PhilflowIO/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B-W8A16@1992cdbe) with vllm serve 0.33.0, TP=2 on 2×RTX 3090, with the nemo_speechlm plugin from our fork. The server started, and the benchmark sent it about 23,800 /v1/chat/completions requests with audio_url. All returned 200, and the WER matched the bf16 control within 0.1 pp.
INFO 11-08 14:34:28 [startup.py:38] ... version 0.33.0
INFO 11-08 14:34:28 [model.py:744] Resolved architecture: Nemotron3_5TranscribeForConditionalGeneration
INFO 11-08 14:36:47 [launcher.py:188] Available routes are:
INFO:     Application startup complete.
INFO:     127.0.0.1:37120 - "POST /v1/chat/completions HTTP/1.1" 200 OK
...
INFO:     127.0.0.1:59120 - "POST /v1/chat/completions HTTP/1.1" 200 OK

The same fork commit also carries a separate fix that lets our W8A16 weights load on vLLM's Marlin MoE path; it does not touch runtime_compat.py. The original bf16 checkpoint ran on 0.33 as well (2026-11-08/09, TP=2 with CPU offload, 862 chat requests per run, all 200). We could not try FP8: the FP8 encoder needs CUTLASS scaled-mm, which has no sm86 path, so that is the one combination left for your pin-move PR.

@pzelasko
pzelasko merged commit 9320b9f into NVIDIA-NeMo:main Nov 19, 2026
143 checks passed
@chtruong814

Copy link
Copy Markdown
Collaborator

/cherrypick to=r3.1.0

chtruong814 pushed a commit that referenced this pull request Dec 1, 2026
…16505) (#16760)

* fix(speechlm2): find vLLM 0.33's chat parser for the prompt contract

vLLM 0.33 turned vllm.renderers.chat_utils into a package and made the
content-part parser public as
chat_message.parse_chat_message_content_parts. The package has no
_parse_chat_message_content_parts any more, so install_prompt_contract
raised "Unsupported vLLM chat API" while the plugin registered, and
`vllm serve` aborted for every SpeechLM checkpoint on 0.33.

The adapter now looks the parser up where vLLM's chat path resolves it:
chat_message's module global on 0.33 (parse_chat_message_content calls
it there), the 0.32 module, then the pre-0.32 entrypoints module. The
signature is unchanged across all three, so the wrapper is the same;
it still fails closed when none of them has the parser. The vllm extra
stays pinned to 0.32.0.




* test(speechlm2): isolate legacy-layout tests from a cached 0.33 parser

Python returns a cached child module even when its parent is mocked
away, so once plugin registration has imported vllm.renderers.chat_utils
the two legacy-layout tests patched the real 0.33 parser instead of
their own fake. Block modern discovery explicitly in those tests and
run each of them with and without a preloaded public parser.




---------



(cherry picked from commit 9320b9f)

Signed-off-by: PhilflowIO <[email protected]>
Signed-off-by: svcnemo-autobot <[email protected]>
Co-authored-by: Philipp Lütje <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

2 inactive deployments
public — 9de5c171 Deployed Nov 16, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #2141
test — 9de5c171 Deployed Nov 16, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #21796
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.

5 participants