Forced Alignment Evaluation Metrics: PCMI and WACS
This repository contains the implementation of two reference-free forced alignment evaluation metrics:
- PCMI (Phoneme-Cluster Mutual Information)
- WACS (Word Acoustic Consistency Score)
Public API
The package is intended to be used by importing the public interfaces from forced_aligner_metrics.
Configuration
Use ForcedAlignEvalConfig to define evaluation behavior. Default config:
from forced_aligner_metrics import ForcedAlignEvalConfig
config = ForcedAlignEvalConfig(
model="facebook/mms-300m",
device="cuda",
layer_range=(15, 16),
batch_size=2,
samples_phon_eval=50,
max_frames=10_000,
n_clusters=50,
samples_word_eval=200,
max_words=200,
min_occ=3,
max_pairs=10,
)
Main evaluator
Use ForcedAlignEval with:
audios: an iterator of audio arrays, each item is a numpyarraysampled at 16kHz:
array([0. , 0. , 0. , ..., 0.00074703, 0.00074613, 0.00078106])
intervals_iter: an iterator of interval dictionaries, where each item is shaped like:
{
"phones": [
{"text": "", "start": 0.0, "end": 0.2},
{"text": "h", "start": 0.2, "end": 0.5},
{"text": "aI", "start": 0.5, "end": 1.0},
],
"words": [
{"text": "", "start": 0.0, "end": 0.2},
{"text": "Hi", "start": 0.2, "end": 1.0},
],
}
from forced_aligner_metrics import ForcedAlignEval, ForcedAlignEvalConfig
config = ForcedAlignEvalConfig()
evaluator = ForcedAlignEval(config)
metrics = evaluator.compute_metrics(audios=audios, intervals_iter=intervals_iter)
The returned metrics dictionary contains the available scores for the evaluated sample. When a phones tier is present, the output includes the PCMI score under pcmi_score; when word-level embeddings are available, it includes the WACS score under wacs_score.
Installation for development
Install the project in editable mode for development:
python -m pip install -e '.[test]'
Tests
Run the regression tests with:
python -m pytest
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forced_aligner_metrics-0.1.0.tar.gz.
File metadata
- Download URL: forced_aligner_metrics-0.1.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f57e72db5cd86dee739b0429d759f7642b75601749b140e7d9f10c8e2adf0151
|
|
| MD5 |
e710171aeae3a99a241566fdb8f2d0fa
|
|
| BLAKE2b-256 |
7b82b3ec364a84bd058a2104e430643de714bc53e8d8389ec2ec56283e6ac12a
|
File details
Details for the file forced_aligner_metrics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: forced_aligner_metrics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d406ddf151fc0b12889efd29bc8de339576e23daf13287d4c4099956bed88027
|
|
| MD5 |
271fa575a5876315212a1a3a9fef39e6
|
|
| BLAKE2b-256 |
2baae74cd96d12ff8ddad523e9af288bdf5d349d52b4b23a3afcd33fc3d1b051
|