Skip to main content

CTC Forced Alignment on Apple Silicon using MLX - torch-free word/character-level timestamps

Project description

mlx-forced-aligner

CTC Forced Alignment on Apple Silicon using MLX.

PyTorch不要で、wav2vec2を使った文字・単語レベルのタイムスタンプ生成を行います。

Requirements

  • macOS with Apple Silicon (M1/M2/M3/M4)
  • Python 3.10+

Installation

pip install mlx-forced-aligner

Usage

Python API

from mlx_forced_aligner import ForcedAligner

aligner = ForcedAligner()  # デフォルト: 日本語モデル (Coidemo/wav2vec2-japanese-mlx)
result = aligner.align("audio.wav", "こんにちは世界")

for word in result.words:
    print(f"{word.word}: {word.start_time:.3f} - {word.end_time:.3f}")

セグメント付きアライメント

segments = [
    {"start": 0.0, "end": 5.0, "text": "こんにちは"},
    {"start": 5.0, "end": 10.0, "text": "世界"},
]
result = aligner.align("audio.wav", "", segments=segments)

CLI

# テキストをアライメント
mlx-align align audio.wav "こんにちは世界"

# セグメントファイルを使用
mlx-align align audio.wav --segments segments.json

# HuggingFaceモデルをMLX形式に変換
mlx-align convert --model jonatasgrosman/wav2vec2-large-xlsr-53-japanese

License

MIT

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

mlx_forced_aligner-0.1.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

mlx_forced_aligner-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlx_forced_aligner-0.1.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mlx_forced_aligner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b110c16ec44655c50463da00a71e701d3112941cec5baa95ba5af47bb082abab
MD5 6a5c21f023ba6f7371c2971c6fc0feb0
BLAKE2b-256 e129e9febd96c9428ca5feab339bf300bbb24afd3d78b66a24a83106b6ae8a4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mlx_forced_aligner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d28138c74d63680fac180f9e9990af30a2689e5d47f62be1112cb4cd7a4fcac
MD5 1bb2883b31f2eb83b9d5c803bd2552b5
BLAKE2b-256 e44fb579b6f556b84c55070bb52b0db2510350a2a0bf2bdb35445376905afbc8

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