torch-stoi
Computes Short Term Objective Intelligibility in PyTorch
What it is and what it does
torch_stoi is a PyTorch implementation of the Short Term Objective Intelligibility (STOI) metric, designed specifically for use as a differentiable loss function in neural network training. It wraps the classical and extended STOI measures—metrics originally developed to predict speech intelligibility in noisy conditions—into a form that PyTorch can backpropagate through. The package depends on numpy, torch, pystoi, and torchaudio to compute the metric.
The implementation is intentionally approximate rather than exact: it trades perfect fidelity to the original STOI algorithm for computational efficiency and differentiability in a training loop. The documentation explicitly warns that it is intended only as a loss function, not as a replacement for the original metric when exact reproducibility matters. This makes it suitable for training speech enhancement or denoising models where STOI-like objectives guide the network, but not for rigorous evaluation benchmarking.
Use it for:
- Train a speech denoising network using NegSTOILoss as the primary loss function to optimize for intelligibility rather than raw signal fidelity.
- Combine NegSTOILoss with other losses in a multi-objective speech enhancement model to balance intelligibility and artifact reduction.
- Validate speech enhancement models on STOI-like criteria during training without switching to a separate evaluation pipeline.
- Experiment with speech quality metrics in PyTorch workflows where torchaudio and torch are already in use.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes Short Term Objective Intelligibility (STOI) as a PyTorch loss function for training speech enhancement models, wrapping the classical and extended STOI metrics in differentiable form.
Yes, if you are training a PyTorch speech enhancement model and want STOI as a loss function. Install friction is low and the license is permissive. However, the dormant maintenance status (no releases for 683 days) and the documented approximation—not exact replication—of the original metric mean you should verify that the implementation's behavior matches your training requirements before committing to it in production. No known security vulnerabilities.
Install
torch-stoi on PyPI
pip
pip install torch-stoiuv
uv add torch-stoipoetry
poetry add torch-stoiInstalling torch-stoi
Before you install
Low friction—pure Python wheel with four runtime dependencies (numpy, torch, pystoi, torchaudio). Dormant maintenance status (last commit 2024-09-30, no releases for 683 days) means no active bug fixes or feature work, but the narrow scope and stable API reduce risk.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install torch_stoi
import torch
from torch_stoi import NegSTOILoss
sample_rate = 16000
loss_func = NegSTOILoss(sample_rate=sample_rate)
noisy_speech = torch.randn(2, 16000)
clean_speech = torch.randn(2, 16000)
loss = loss_func(noisy_speech, clean_speech)
Verify before relying
- Whether the PyTorch implementation's approximation error relative to the original STOI metric is acceptable for your specific training task (documentation notes results 'should be close enough' but exact quantitative bounds are not provided).
- Minimum Python version and PyTorch version compatibility (requires_python is unspecified in the fact sheet).
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — numpy, torch, pystoi, torchaudio |
| Maintenance | dormant — 683 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 427,554/month — #6,749 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torch_stoi-0.2.3-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
pystoiComputes Short Term Objective Intelligibility…
permissive · top 5,000 on PyPI
torchlibrosaProvides PyTorch implementations of librosa…
permissive · top 15,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI
geomlossComputes geometric loss functions for comparing…
permissive · top 15,000 on PyPI
pytorch-metric-learningProvides metric learning loss functions,…
permissive · top 5,000 on PyPI
torchfcpeTorchFCPE estimates fundamental frequency…
permissive · top 15,000 on PyPI
speechbrainSpeechBrain is a PyTorch-based toolkit for…
permissive · top 5,000 on PyPI
juliusJulius provides differentiable, GPU-accelerated…
permissive · top 5,000 on PyPI
aic-sdkPython bindings for ai-coustics audio…
permissive · top 15,000 on PyPI
pytorch-msssimComputes fast, differentiable SSIM and MS-SSIM…
permissive · top 15,000 on PyPI