Skip to content

[Refactor] Remove sox from dependencies#2745

Merged
gcanlin merged 4 commits into
vllm-project:mainfrom
NickCao:fix/remove-sox
Apr 17, 2026
Merged

[Refactor] Remove sox from dependencies#2745
gcanlin merged 4 commits into
vllm-project:mainfrom
NickCao:fix/remove-sox

Conversation

@NickCao
Copy link
Copy Markdown
Contributor

@NickCao NickCao commented Apr 13, 2026

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

#1725

Test Plan

pytest tests/utils/test_audio.py
#!/usr/bin/env python3
"""One-off verification that peak_normalize matches sox norm output.

Requires pysox: pip install sox
Run once before removing the sox dependency, then discard.

Usage: python tests/utils/verify_sox_equivalence.py
"""

import numpy as np
import sox


def peak_normalize(audio, db_level=-6.0):
    peak = np.abs(audio).max()
    if peak == 0:
        return audio
    target = 10.0 ** (db_level / 20.0)
    return audio * (target / peak)


def sox_norm(audio, sr, db_level):
    tfm = sox.Transformer()
    tfm.norm(db_level=db_level)
    return tfm.build_array(input_array=audio, sample_rate_in=sr)


def main():
    # Sine wave at -6 dB
    t = np.linspace(0, 1.0, 16000, dtype=np.float64)
    audio = (0.3 * np.sin(2 * np.pi * 440 * t)).astype(np.float32)
    np.testing.assert_allclose(
        peak_normalize(audio, -6.0),
        sox_norm(audio, 16000, -6.0),
        atol=1e-7,
    )
    print("Sine -6dB: MATCH")

    # Random noise at -6 dB
    rng = np.random.default_rng(42)
    audio = rng.uniform(-0.8, 0.8, size=16000).astype(np.float32)
    np.testing.assert_allclose(
        peak_normalize(audio, -6.0),
        sox_norm(audio, 16000, -6.0),
        atol=1e-7,
    )
    print("Noise -6dB: MATCH")

    # Random noise at -3 dB
    audio = rng.uniform(-0.5, 0.5, size=8000).astype(np.float32)
    np.testing.assert_allclose(
        peak_normalize(audio, -3.0),
        sox_norm(audio, 16000, -3.0),
        atol=1e-7,
    )
    print("Noise -3dB: MATCH")

    print("ALL PASS")


if __name__ == "__main__":
    main()

Test Result

All PASS

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan. Please provide the test scripts & test commands. Please state the reasons if your codes don't require additional test scripts. For test file guidelines, please check the test style doc
  • The test results. Please paste the results comparison before and after, or the e2e results.
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model. Please run mkdocs serve to sync the documentation editions to ./docs.
  • (Optional) Release notes update. If your change is user-facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

NickCao and others added 4 commits April 13, 2026 12:17
Drop-in replacement for sox.Transformer().norm(db_level=...).
Scales audio so peak amplitude reaches a target dB level.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
Replace sox.Transformer().norm(db_level=-6) with peak_normalize,
removing the last runtime usage of pysox from the codebase.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
Update ROCm installation docs and Qwen3-TTS README to no longer
list sox as a required dependency.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
Drop sox>=1.5.0 from requirements/common.txt and remove
sox/libsox-fmt-all from CI, CUDA, and ROCm Dockerfiles.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
@NickCao NickCao requested a review from hsliuustc0106 as a code owner April 13, 2026 16:27
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@hsliuustc0106
Copy link
Copy Markdown
Collaborator

PR #2745 - [Refactor] Remove sox from dependencies

OVERALL: NO BLOCKERS
VERDICT: COMMENT

Correctness: PASS
Reliability: PASS
Breaking: PASS
Tests: PASS
Docs: PASS
Security: PASS

Summary: Refactor to remove sox dependency, replace with native peak_normalize. 9 files, 286 add, 86 del. Tests added, doc updated. Gates pass. No blockers.

@hsliuustc0106
Copy link
Copy Markdown
Collaborator

BLOCKER scan:

  • Correctness: PASS
  • Reliability/Safety: PASS
  • Breaking Changes: PASS (drop-in replacement)
  • Test Coverage: PASS (unit tests added)
  • Documentation: PASS (docs updated)
  • Security: PASS

OVERALL: NO BLOCKERS

VERDICT: COMMENT

Good refactoring. Removing sox dependency simplifies the installation process. The peak_normalize() implementation is correct and the unit tests verify the edge cases (silence, peak normalization).

One note: The db_level parameter defaults to -6.0, which matches the previous sox default. Consider documenting this in the function docstring for future reference.

Copy link
Copy Markdown
Collaborator

@gcanlin gcanlin left a comment

Choose a reason for hiding this comment

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

The code Looks clean to me. Running nightly-test.

@gcanlin gcanlin added the nightly-test label to trigger buildkite nightly test CI label Apr 15, 2026
Copy link
Copy Markdown
Collaborator

@lishunyang12 lishunyang12 left a comment

Choose a reason for hiding this comment

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

Clean removal of the sox / pysox dependency. The changes are correct and complete:

  • peak_normalize implementation in vllm_omni/utils/audio.py is a faithful pure-NumPy replacement for sox.Transformer().norm(db_level=...). The math (target / peak scaling) matches sox's peak normalization behavior, and the PR description includes a one-off verification script confirming numerical equivalence within atol=1e-7.

  • All references removed consistently: Python dependency (requirements/common.txt), system packages (sox, libsox-fmt-all) from all three Dockerfiles (CI, CUDA, ROCm), documentation (ROCm install guide, Qwen3 TTS example and README), and the import sox / sox.Transformer usage in speech_vq.py.

  • Tests cover the key edge cases: silence (all-zero input returns all-zero) and peak-reaches-target (output peak matches the requested dB level within tolerance).

  • No behavioral change: sox_norm() method signature and call sites are preserved; only the internal implementation swaps from sox to the new peak_normalize.

One minor observation: the sox_norm method in SpeechVQ could be replaced by a direct call to peak_normalize at the call site since it's now a trivial wrapper, but that's a follow-up cleanup, not a blocker.

LGTM.

@gcanlin
Copy link
Copy Markdown
Collaborator

gcanlin commented Apr 16, 2026

@NickCao Could you please check whether this failed CI is related to this PR? https://buildkite.com/vllm/vllm-omni/builds/6682/steps/canvas?sid=019d8eb6-2af0-4470-9871-73e31b225185&tab=output

@NickCao
Copy link
Copy Markdown
Contributor Author

NickCao commented Apr 16, 2026

@NickCao Could you please check whether this failed CI is related to this PR? https://buildkite.com/vllm/vllm-omni/builds/6682/steps/canvas?sid=019d8eb6-2af0-4470-9871-73e31b225185&tab=output

The error is:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/workspace/build/buildkite/vllm_omni/entrypoints/cli/main.py", line 63, in <module>
    main()
  File "/workspace/build/buildkite/vllm_omni/entrypoints/cli/main.py", line 57, in main
    args.dispatch_function(args)
  File "/workspace/build/buildkite/vllm_omni/entrypoints/cli/serve.py", line 94, in cmd
    run_headless(args)
  File "/workspace/build/buildkite/vllm_omni/entrypoints/cli/serve.py", line 552, in run_headless
    vllm_config, executor_class = build_vllm_config(
                                  ^^^^^^^^^^^^^^^^^^
  File "/workspace/build/buildkite/vllm_omni/engine/stage_init_utils.py", line 326, in build_vllm_config
    vllm_config = omni_engine_args.create_engine_config(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/vllm/engine/arg_utils.py", line 1549, in create_engine_config
    model_config = self.create_model_config()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/build/buildkite/vllm_omni/engine/arg_utils.py", line 198, in create_model_config
    raise RuntimeError(
RuntimeError: create_model_config() should not be called when stage_configs_path is set. Per-stage model configs are resolved from the stage config YAML.
ERROR

Looks unrelated to me.

@gcanlin gcanlin added ready label to trigger buildkite CI and removed nightly-test label to trigger buildkite nightly test CI labels Apr 17, 2026
@gcanlin
Copy link
Copy Markdown
Collaborator

gcanlin commented Apr 17, 2026

@NickCao Thanks! Looks great. Let's merge it ASAP.

@gcanlin gcanlin enabled auto-merge (squash) April 17, 2026 00:58
@gcanlin gcanlin merged commit 1e3bb36 into vllm-project:main Apr 17, 2026
8 checks passed
lvliang-intel pushed a commit to lvliang-intel/vllm-omni that referenced this pull request Apr 20, 2026
Signed-off-by: Nick Cao <ncao@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
lengrongfu pushed a commit to lengrongfu/vllm-omni that referenced this pull request May 1, 2026
Signed-off-by: Nick Cao <ncao@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
clodaghwalsh17 pushed a commit to clodaghwalsh17/nm-vllm-omni-ent that referenced this pull request May 12, 2026
Signed-off-by: Nick Cao <ncao@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready label to trigger buildkite CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants