Registry / ai-ml / warpq
library1.5.2pypypiunverified

WARP-Q is a Python library designed for predicting the quality of generative neural speech codecs. It offers a robust framework to assess speech quality, providing access to pretrained models for immediate use and the flexibility to load custom models. The current version is 1.5.2, and the library maintains an active development status with notable API updates, including a significant overhaul at v1.0.0.

pip install warpq
INSTALL
IMPORT
SIG · WARPQ
W
warpq
ai-mlpythonv1.5.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WARPQ
from warpq import WARPQ

This quickstart demonstrates how to initialize the WARP-Q model and predict the quality score between a reference and a degraded speech audio file. It uses a default pretrained model and includes logic to create dummy audio files if they don't exist, making it runnable out-of-the-box. Ensure your actual audio files are in a compatible format (e.g., WAV) and have the same sampling rate.

import warpq import os # NOTE: Replace 'ref_audio.wav' and 'deg_audio.wav' with actual paths to your audio files. # Ensure these files exist in the current directory or provide full paths. # For example, you might create dummy files for testing: # import soundfile as sf # import numpy as np # sf.write('ref_audio.wav', np.random.rand(16000), 16000) # sf.write('deg_audio.wav', np.random.rand(16000), 16000) ref_audio_path = os.path.join(os.getcwd(), 'ref_audio.wav') # Example path deg_audio_path = os.path.join(os.getcwd(), 'deg_audio.wav') # Example path # Create dummy audio files for demonstration if they don't exist if not os.path.exists(ref_audio_path) or not os.path.exists(deg_audio_path): import soundfile as sf import numpy as np sample_rate = 16000 duration = 1 # second data = np.random.rand(int(sample_rate * duration)).astype(np.float32) * 0.5 sf.write(ref_audio_path, data, sample_rate) sf.write(deg_audio_path, data * 0.9, sample_rate) print(f"Created dummy audio files: {ref_audio_path}, {deg_audio_path}") try: # Initialize WARP-Q model. model_path=None uses a default pretrained model. model = warpq.WARPQ(model_path=None) # Predict the WARP-Q score score = model.predict(ref_audio_path, deg_audio_path) print(f"WARP-Q score for {os.path.basename(deg_audio_path)} (vs {os.path.basename(ref_audio_path)}): {score:.4f}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your audio files exist and are valid (e.g., .wav format, same sample rate).") print("Also verify PyTorch and torchaudio are correctly installed.") finally: # Clean up dummy files if os.path.exists(ref_audio_path): os.remove(ref_audio_path) if os.path.exists(deg_audio_path): os.remove(deg_audio_path)
Debug
Known issues
breakingThe `warpq` API underwent a significant breaking change with the release of v1.0.0. Code written for versions prior to 1.0.0 will not be compatible with the current API due to changes in class structures, module organization, and method signatures.
fix
Refactor your code to use the `WARPQ` class, typically imported as `from warpq import WARPQ`, and its `predict` method. Consult the latest GitHub README for updated usage patterns.
affects: <1.0.0
gotcha`warpq` relies heavily on PyTorch and torchaudio. Users often encounter complex installation issues (e.g., CUDA compatibility, specific hardware drivers) when setting up PyTorch, which can prevent `warpq` from functioning correctly.
fix
Ensure PyTorch and torchaudio are correctly installed for your specific environment (CPU/GPU) *before* installing `warpq` if you anticipate issues. Refer to the official PyTorch installation guide for best practices tailored to your system.
affects: All
gotchaWhen predicting scores, the library expects the reference and degraded audio files to have the same sampling rate. Providing files with mismatched sampling rates will result in a runtime error.
fix
Resample your audio files to a common sampling rate using libraries like `torchaudio.transforms.Resample`, `librosa`, or `scipy.signal.resample` before passing them to the `warpq.WARPQ().predict()` method.
affects: All
Upgrade
Version history
1.5.2latest on PyPI · released Oct 14, 2024
Audit
Dependencies
torchrequiredCore deep learning framework for models.
torchaudiorequiredAudio I/O and transformations, dependent on PyTorch.
numpyrequiredNumerical operations and array handling.
scipyrequiredScientific computing utilities, often for audio processing.
tqdmrequiredProgress bars for iterative tasks.
soundfilerequiredReading and writing sound files.
pesqoptionalOptional dependency for Perceptual Evaluation of Speech Quality (PESQ) metric comparison.
pystoioptionalOptional dependency for Short-Term Objective Intelligibility (STOI) metric comparison.
Agent activity
39 hits · last 30 days
node
34
OpenAI (training)
1
Resources
warpq — pip install warpq · libregistry