Support encoder input chunking for SALM vLLM inference#15716
Conversation
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
|
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. |
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
|
/ok to test 1ff85ad |
|
[🤖]: 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) |
There was a problem hiding this comment.
nit:
| 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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
_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 | ||
|
|
There was a problem hiding this comment.
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
Important
The
Update branchbutton 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
Usage
# Add a code snippet demonstrating how to use thisGitHub 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:
PR Type:
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