Skip to content

Support encoder input chunking for SALM vLLM inference#15716

Open
pzelasko wants to merge 4 commits into
mainfrom
chunked-vllm-salm-inference
Open

Support encoder input chunking for SALM vLLM inference#15716
pzelasko wants to merge 4 commits into
mainfrom
chunked-vllm-salm-inference

Conversation

@pzelasko
Copy link
Copy Markdown
Collaborator

Important

The Update branch button must only be pressed in very rare occassions.
An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

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

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 21, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

pzelasko added 3 commits May 21, 2026 08:25
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
@pzelasko pzelasko marked this pull request as ready for review May 21, 2026 20:43
@pzelasko
Copy link
Copy Markdown
Collaborator Author

/ok to test 1ff85ad

@github-actions
Copy link
Copy Markdown
Contributor

[🤖]: Hi @pzelasko 👋,

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.

)

return tuple(audio_embeds[i, : audio_embed_lens[i]] for i in range(audio_embeds.shape[0]))
return tuple(emb.to(torch.bfloat16) for emb in audio_embeds)
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.

nit:

Suggested change
return tuple(emb.to(torch.bfloat16) for emb in audio_embeds)
return tuple(emb.to(_PERCEPTION_DTYPE) for emb in audio_embeds)

for begin in range(0, audio_length_samples, chunk_size_samples):
end = min(begin + chunk_size_samples, audio_length_samples)
spans.append((begin, end))
if len(spans) > 1 and spans[-1][1] - spans[-1][0] < _MIN_CHUNK_SIZE_SAMPLES:
Copy link
Copy Markdown
Contributor

@DongjiGao DongjiGao May 22, 2026

Choose a reason for hiding this comment

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

I think len(spans) > 1 is redundant here. But we can keep it for now.

return sum(cls._estimate_audio_tokens_single_pass(end - begin) for begin, end in spans)

@classmethod
def _samples_for_audio_tokens(cls, target_tokens: int, chunk_size_seconds: float | None = None) -> int:
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.

_samples_for_audio_tokens() can return the max-duration cap even when that audio is still too short to produce target_tokens (e.g., if max_model_len is very large)

def test_estimator_min_one() -> None:
"""Even for very short audio the estimator must return at least 1."""
assert NeMoSpeechLMProcessingInfo._estimate_audio_tokens(1) >= 1

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.

I think we also need test for _samples_for_audio_tokens(), audio sizing when audio.length is provided in mm_options, and _MIN_CHUNK_SIZE_SAMPLES = 320

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.

2 participants