Repository navigation
Description
Summary
The Nemotron-H Nano Omni audio path (the Parakeet/Conformer SoundEncoder) works from the CLI (mlxcel generate --audio) but is NOT reachable from the server. POST /v1/chat/completions with an input_audio content block only dispatches audio to the two Gemma 4 paths, so a loaded Nemotron-H Nano Omni model returns "model does not support audio" for audio chat requests.
Background
The server entry prepare_request_vlm_embeddings (src/server/model_worker.rs, around line 959) handles input_audio like this: when !audio.is_empty(), it tries prepare_gemma4_unified_audio_embeddings and then prepare_gemma4_audio_embeddings; if neither matches the loaded model, it falls through to the "model does not support audio (not Gemma4 or no audio tower)" branch. There is no prepare_nemotron_*_audio_embeddings server path. The CLI equivalent exists: compute_nemotron_h_nano_omni_audio_embeddings (src/commands/generate_vlm.rs), which loads the audio, runs NemotronHNanoOmniVlModel's extract_audio_features (now fallible after #435/#439), and expands the sound_context_token_id block via expand_nemotron_h_nano_omni_audio_tokens.
This is the same shape of gap that #437 (PR #440) just closed for Gemma 4 server audio: the model surface and the CLI embedding builder already exist; only the server input_audio dispatch and prompt placement are missing.
Scope
- Add a server
prepare_nemotron_h_nano_omni_audio_embeddings(mirroring the gemma4 server audio fns insrc/server/model_worker.rs) that loads theinput_audiobytes, resamples if the model's feature extractor expects a fixed rate (see how the CLI path handles the Nemotron feature extractor; note the Nemotron extractor differs from the Gemma 4AudioFeatureExtractorand may hard-error on a rate mismatch rather than silently assuming 16 kHz, so confirm the right resample target), runs the encoder, and scatters the audio embeddings. - Insert the Nemotron sound-token block into the user turn of the server prompt, mirroring the fix: Gemma 4 server audio (input_audio) places <|audio|> outside the user turn (0-token output) #437/fix: place Gemma 4 server <|audio|> block inside the user turn #440 approach (the server flattens chat messages to text-only, so the
sound_context_token_idmarker must be placed into the user turn rather than appended; reuse or generalize the end-of-turn-anchored placement helper added in fix: place Gemma 4 server <|audio|> block inside the user turn #440 /expand_gemma4_audio_tokens_for_server, or the Nemotron CLI expanderexpand_nemotron_h_nano_omni_audio_tokensadapted for the server's text-only prompt). - Wire it into the
!audio.is_empty()dispatch inprepare_request_vlm_embeddingsalongside the two gemma4 calls. - Validate with a real-model server E2E: load a Nemotron-H Nano Omni checkpoint,
POST /v1/chat/completionswith aninput_audiopart, confirm a coherent (non-empty, non-0-token) response rather than "model does not support audio" or an immediate EOS. (Per fix: Gemma 4 server audio (input_audio) places <|audio|> outside the user turn (0-token output) #437's lesson, unit tests and code review are not sufficient for this class; the server must actually be run with the model.)
Acceptance Criteria
- A Nemotron-H Nano Omni model loaded in
mlxcel-serveraccepts aninput_audiocontent block inPOST /v1/chat/completionsand produces a coherent response (audio is conditioned on, not ignored), validated end to end on a real checkpoint. - The audio block lands in the user turn (not the model turn), so the model does not EOS at prefill.
- Gemma 4 server audio, image, and video requests, and all text-only requests, are unchanged (no prefix-cache or dispatch regression).
Related
Follow-up to #437 / PR #440 (the analogous Gemma 4 server input_audio fix; root cause there was a model-turn misplacement plus the Gemma 4 <turn|> end-of-turn-token rename). Nemotron-H Nano Omni audio fault isolation was hardened in #435 / PR #439. The CLI Nemotron audio path is in src/commands/generate_vlm.rs (compute_nemotron_h_nano_omni_audio_embeddings).
Activity
test: add ChatML im_end coverage for resolve_end_of_turn_token_id
feat: wire Nemotron-H Nano Omni input_audio into server chat audio (l…
feat: wire Nemotron-H Nano Omni input_audio into server chat audio (l…