Skip to main content

Forced alignment pipeline designed for efficiency and ease of use.

Project description

Easier forced alignment with easyaligner

easyaligner is a fast and memory efficient forced alignment pipeline for aligning speech and text. It is designed with ease of use in mind, supporting alignment both from ground-truth transcripts, as well as from ASR-generated transcripts. easyaligner acts as the backend that powers alignment in easywhisper. Some notable features of easyaligner include:

  • Uses Pytorch's forced alignment API with support for efficient GPU accelerated forced alignment. Enables aligning long audio segments fast and memory-efficiently (Pratap et al., 2024).
  • Supports custom regex-based text normalization functionality to preprocess transcripts before alignment, in order to improve alignment quality. Maintains a mapping from original to normalized text, meaning the normalizations and transformations are non-destructive and reversible after alignment.
  • Separates VAD, emission extraction (emissions are written to disk), and alignment into modular pipeline stages. Allows users to run everything end-to-end, or to run the separate stages individually (better flexibility for parallelization).

Installation

With GPU support (recommended)

pip install easyaligner --extra-index-url https://download.pytorch.org/whl/cu128

[!TIP]
Remove --extra-index-url if you want CPU-only installation.

Using uv

When installing with uv, it will select the appropriate PyTorch version automatically (CPU for macOS, CUDA for Linux/Windows/ARM):

uv pip install easyaligner

For development

git clone https://github.com/kb-labb/easyaligner.git
cd easyaligner

pip install -e . --extra-index-url https://download.pytorch.org/whl/cu128

Logging and Error Handling

Enabling Logging

To see progress and error messages one can add the following logging configuration at the start of a script:

import logging

logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s | %(name)s | %(levelname)s | %(message)s'
    # handlers=[
    #     logging.FileHandler('easyalign.log'), # Log to a file
    #     logging.StreamHandler()  # Also print to console
    # ]
)

Error Handling

easyaligner pipelines use PyTorch DataLoaders for efficient parallel processing and prefetching of data. During processing, the library silently skips files that fail to load (corrupted audio, missing file, etc.). The errors are logged with full traceback, the pipeline however continues processing the remaining files.

easyaligner leaves it up the user to decide how to handle failed files (retry, validate inputs, etc.).

[!TIP]
Track which files failed after processing completes by comparing output:

from pathlib import Path

# After pipeline completes, check which files produced output
output_files = list(Path("output/vad").rglob("*.json"))
output_stems = {f.stem for f in output_files}

# Find files that failed (no output produced)
failed = [p for p in audio_paths if Path(p).stem not in output_stems]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyaligner-0.1.0.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyaligner-0.1.0-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file easyaligner-0.1.0.tar.gz.

File metadata

  • Download URL: easyaligner-0.1.0.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for easyaligner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8da92f11071ef24b8bd62ba1bb5b598f2ced80f03b25fa0c67f28ab3c6d7a6bc
MD5 ad649c0fa6270c4509e35e15bf080db7
BLAKE2b-256 9632e37c4ec10b410b458b7d845f588cde54ad37c2dd79603b5014b410e11f11

See more details on using hashes here.

File details

Details for the file easyaligner-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: easyaligner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for easyaligner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5e4b1a46ecd8c654b3f5b830b186fcb317ab0839c77af0a5b6cd9a08258ecc9
MD5 1db81703dcae603a9473656ff8af2250
BLAKE2b-256 b1a1ccc36ea75998ec69541bc1d1e951a877611d511e40216f78129aee90050b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page