Skip to content

Support NumPy 2 compatible installs - #168

Open
deepeshaiml wants to merge 4 commits into
modelscope:mainfrom
deepeshaiml:chore/relax-clearvoice-dependencies
Open

Support NumPy 2 compatible installs#168
deepeshaiml wants to merge 4 commits into
modelscope:mainfrom
deepeshaiml:chore/relax-clearvoice-dependencies

Conversation

@deepeshaiml

Copy link
Copy Markdown

Summary

This PR updates ClearVoice dependency constraints and a NumPy compatibility issue so the package can work in environments using NumPy 2.x while still allowing NumPy 1.24.3+.

Changes:

  • Remove the NumPy <2.0 upper bound
  • Relax exact dependency pins to compatible minimum versions
  • Replace deprecated np.int usage with built-in int
  • Update test_fft() to compare ConvSTFT against a reference with matching framing semantics

Why

The current package metadata blocks NumPy 2 installs via numpy>=1.24.3,<2.0. NumPy 2 also removes deprecated aliases such as np.int, which causes runtime failures in ConvSTFT.

Keeping numpy>=1.24.3 allows existing NumPy 1.x users to continue installing ClearVoice while also allowing newer NumPy 2.x environments.

The test_fft() helper previously compared against librosa.stft, which uses n_fft-based framing for these parameters. ConvSTFT uses win_len-based framing, so the helper could fail with a shape mismatch. The updated reference uses the same framing convention as ConvSTFT.

Validation

Tested locally with NumPy 2.4.6:

  • python -m pip check
  • python -m compileall -q clearvoice speechscore train
  • Imported all discoverable clearvoice modules: 51 modules, 0 failures
  • Ran ConvSTFT / ConviSTFT smoke test
  • Ran test_fft(); MSE was approximately 1.14e-11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request relaxes dependency constraints in pyproject.toml (including removing the upper bound on NumPy) and resolves NumPy 2.0 compatibility issues by replacing deprecated np.int with int. It also replaces the Librosa dependency in test_fft with a custom NumPy-based STFT reference. The review feedback suggests using bitwise operations to calculate the next power of two more robustly, points out other files in the repository that still contain np.int, and recommends using np.lib.stride_tricks.sliding_window_view in the test to avoid unnecessary memory copies.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread clearvoice/clearvoice/models/frcrn_se/conv_stft.py Outdated
Comment thread clearvoice/clearvoice/models/frcrn_se/conv_stft.py Outdated
Comment thread clearvoice/clearvoice/models/frcrn_se/conv_stft.py Outdated
deepeshaiml and others added 3 commits June 29, 2026 16:49
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

1 participant