CWAM introduces the first alignment framework where monotonic alignment is guaranteed by construction. By extracting an absolute CTC path and converting it into a narrow monotonic "wedge", the model performs InfoNCE and MAS only inside this corridor—completely eliminating alignment collapse. This conceptually simple design makes CWAM both extremely lightweight and mathematically robust.
- CTC Wedge Masking: Extracts an absolute path via CTC probabilities and expands it into a "wedge" mask. This dramatically bounds the search space for the InfoNCE contrastive learning, preventing degenerate alignments without requiring pre-aligned datasets.
- Text Encoder Agnostic: You may use any phoneme embedding model. A lightweight BERT-style encoder or even a simple embedding layer is sufficient.
Data Preparation: Ensure you have pre-extracted HuBERT features saved as PyTorch tensors (.pt). The shape of each tensor should be [1024, T_audio] or [T_audio, 1024].
# Install requirements
pip install torch numpy numba tqdm matplotlib tensorboard
# Run the training script
python train.py --filelist filelists/align_train.txt --batch_size 64 --epochs 50This repository contains the original implementation of CWAM (CTC-Wedge Aligned MAS), the first formulation of wedge-restricted InfoNCE–MAS alignment.
This project is licensed under the MIT License - see the LICENSE file for details.
CWAMは、構造的にモノトニック・アライメントが保証される初のアライメント・フレームワークです。CTCから絶対的な経路を抽出し、それを狭いモノトニックな「楔(Wedge)」に変換することで、モデルはその回廊の内部でのみInfoNCEとMASを実行し、アライメントの崩壊を完全に排除します。この概念的にシンプルな設計により、CWAMは非常に軽量かつ数学的に堅牢なものとなっています。
- CTC Wedge Masking: CTC確率から絶対的なパスを抽出し、それを「楔」のように太らせたマスクとして展開。これによりInfoNCE対照学習の探索空間を劇的に制限し、事前アライメントデータなしでアライメントの崩壊を防ぎます。
- Text Encoder Agnostic: 任意の音素エンベディングモデルを使用できます。軽量なBERTスタイルのエンコーダや、シンプルなEmbedding層でも十分に機能します。
データの準備: 事前に抽出したHuBERT特徴量(.pt 形式のPyTorchテンソル)が必要です。各テンソルのShapeは [1024, T_audio] または [T_audio, 1024] である必要があります。
# 依存ライブラリのインストール
pip install torch numpy numba tqdm matplotlib tensorboard
# 学習スクリプトの実行
python train.py --filelist filelists/align_train.txt --batch_size 64 --epochs 50本リポジトリには、Wedge制約付きInfoNCE-MASアライメントの初の定式化であるCWAM(CTC-Wedge Aligned MAS)のオリジナル実装が含まれています。
本プロジェクトは MIT ライセンスのもとで公開されています。
CWAM 引入了首个在结构上保证单调对齐的对齐框架。通过提取绝对的 CTC 路径并将其转换为狭窄的单调“楔形 (wedge)”,模型仅在该走廊内部执行 InfoNCE 和 MAS——彻底消除了对齐崩溃。这种概念上简单的设计使得 CWAM 既极其轻量又在数学上高度稳健。
- CTC Wedge Masking: 通过从 CTC 概率中提取绝对路径并将其扩展为“楔形”掩码,极大地缩小了 InfoNCE 对比学习的搜索空间,在无需预对齐数据集的情况下有效防止了对齐退化。
- Text Encoder Agnostic: 您可以使用任何音素嵌入模型。轻量级的类 BERT 编码器甚至简单的 Embedding 层就足够了。
数据准备: 请确保您拥有预先提取的 HuBERT 特征(保存为 PyTorch 张量 .pt)。每个张量的形状应为 [1024, T_audio] 或 [T_audio, 1024]。
# 安装依赖
pip install torch numpy numba tqdm matplotlib tensorboard
# 运行训练脚本
python train.py --filelist filelists/align_train.txt --batch_size 64 --epochs 50本仓库包含 CWAM (CTC-Wedge Aligned MAS) 的原始实现,这是楔形约束 InfoNCE-MAS 对齐的首次公式化提出。
本项目采用 MIT 协议开源。