模型概述
模型特點
模型能力
使用案例
🚀 wav2vec2-xls-r-300m-en-atc-atcosim
本模型是 facebook/wav2vec2-xls-r-300m 在 ATCOSIM 語料庫 上微調後的版本。它為空中交通管制(ATC)通信領域的自動語音識別(ASR)任務提供了更精準的解決方案,能有效降低該領域語音識別的錯誤率。
(A better ASR model for ATC data is available here: https://huggingface.co/Jzuluaga/wav2vec2-xls-r-300m-en-atc-uwb-atcc-and-atcosim)
🚀 快速開始
該模型在評估集上取得了以下結果:
- 損失值:0.0988
- 詞錯誤率(Wer):0.0736
作者:Juan Zuluaga - Gomez、Amrutha Prasad、Iuliia Nigmatulina、Saeed Sarfjoo、Petr Motlicek、Matthias Kleinert、Hartmut Helmke、Oliver Ohneiser、Qingran Zhan
摘要:近期關於自監督預訓練的研究主要集中在利用大規模無標籤語音數據構建穩健的端到端(E2E)聲學模型(AM),這些模型隨後可在下游任務(如自動語音識別(ASR))上進行微調。然而,很少有研究探討在預訓練和微調階段數據屬性存在顯著差異(即領域偏移)時對性能的影響。我們針對這一情況,分析了 Wav2Vec 2.0 和 XLS - R 模型在完全未見領域(空中交通管制(ATC)通信)的下游 ASR 任務中的魯棒性。我們在幾個開源且具有挑戰性的 ATC 數據庫上對這兩個模型進行了基準測試,這些數據庫的信噪比在 5 到 20 dB 之間。通過僅使用較小比例的標記數據微調 E2E 聲學模型,與基於混合的 ASR 基線相比,相對詞錯誤率(WER)降低了 20% 到 40%。我們還分析了低資源場景下的 WER 以及一個 ATC 數據集所攜帶的性別偏差。
代碼 — GitHub 倉庫:https://github.com/idiap/w2v2-air-traffic
✨ 主要特性
- 基於大規模無標籤語音數據進行自監督預訓練,構建端到端聲學模型。
- 針對空中交通管制通信領域的領域偏移問題進行了優化,在該領域具有較好的魯棒性。
- 與基於混合的 ASR 基線相比,在 ATC 數據庫上可顯著降低詞錯誤率。
📦 安裝指南
如果你使用語言模型,需要安裝 KenLM 綁定:
conda activate your_environment
pip install https://github.com/kpu/kenlm/archive/master.zip
💻 使用示例
基礎用法
from datasets import load_dataset, load_metric, Audio
import torch
from transformers import AutoModelForCTC, Wav2Vec2Processor, Wav2Vec2ProcessorWithLM
import torchaudio.functional as F
USE_LM = False
DATASET_ID = "Jzuluaga/atcosim_corpus"
MODEL_ID = "Jzuluaga/wav2vec2-xls-r-300m-en-atc-atcosim"
# 1. Load the dataset
# we only load the 'test' partition, however, if you want to load the 'train' partition, you can change it accordingly
atcosim_corpus_test = load_dataset(DATASET_ID, "test", split="test")
# 2. Load the model
model = AutoModelForCTC.from_pretrained(MODEL_ID)
# 3. Load the processors, we offer support with LM, which should yield better resutls
if USE_LM:
processor = Wav2Vec2ProcessorWithLM.from_pretrained(MODEL_ID)
else:
processor = Wav2Vec2Processor.from_pretrained(MODEL_ID)
# 4. Format the test sample
sample = next(iter(atcosim_corpus_test))
file_sampling_rate = sample['audio']['sampling_rate']
# resample if neccessary
if file_sampling_rate != 16000:
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), file_sampling_rate, 16000).numpy()
else:
resampled_audio = torch.tensor(sample["audio"]["array"]).numpy()
input_values = processor(resampled_audio, return_tensors="pt").input_values
# 5. Run the forward pass in the model
with torch.no_grad():
logits = model(input_values).logits
# get the transcription with processor
if USE_LM:
transcription = processor.batch_decode(logits.numpy()).text
else:
pred_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(pred_ids)
# print the output
print(transcription)
📚 詳細文檔
預期用途與侷限性
該模型是在空中交通管制數據上進行微調的。我們預計它在其他一些數據集(如 LibriSpeech 或 CommonVoice)上可能無法保持相同的性能。
訓練和評估數據
詳情請參考我們論文中的表 1(第 3 頁):How Does Pre-trained Wav2Vec 2.0 Perform on Domain Shifted ASR? An Extensive Benchmark on Air Traffic Control Communications。我們在論文中描述瞭如何使用該模型的分區情況。
- 我們使用 ATCOSIM 數據集對該模型進行微調。你可以在此處下載原始數據:https://www.spsc.tugraz.at/databases-and-tools/atcosim-air-traffic-control-simulation-speech-corpus.html
- 不過,不用擔心,我們已經將數據庫整理成了
Datasets 格式
。點擊這裡查看:ATCOSIM CORPUS on HuggingFace。你可以滾動查看訓練/測試分區,甚至可以聽取一些音頻。 - 如果你想將數據庫整理成 HuggingFace 格式,可以參考以下數據加載腳本:data_loader_atc.py。
🔧 技術細節
訓練過程
訓練超參數
訓練過程中使用了以下超參數:
- 學習率(learning_rate):0.0005
- 訓練批次大小(train_batch_size):24
- 評估批次大小(eval_batch_size):24
- 隨機種子(seed):42
- 梯度累積步數(gradient_accumulation_steps):4
- 總訓練批次大小(total_train_batch_size):96
- 優化器(optimizer):Adam(β1 = 0.9,β2 = 0.999,ε = 1e - 08)
- 學習率調度器類型(lr_scheduler_type):線性
- 學習率調度器熱身步數(lr_scheduler_warmup_steps):500
- 訓練步數(training_steps):20000
- 混合精度訓練(mixed_precision_training):Native AMP
訓練結果
訓練損失 | 輪數 | 步數 | 驗證損失 | 詞錯誤率(Wer) |
---|---|---|---|---|
1.9105 | 6.41 | 500 | 0.1622 | 0.1531 |
0.1119 | 12.82 | 1000 | 0.0971 | 0.0936 |
0.0614 | 19.23 | 1500 | 0.1002 | 0.0983 |
0.044 | 25.64 | 2000 | 0.1011 | 0.0929 |
0.0366 | 32.05 | 2500 | 0.0932 | 0.0828 |
0.0315 | 38.46 | 3000 | 0.0926 | 0.0880 |
0.0297 | 44.87 | 3500 | 0.0972 | 0.0882 |
0.0216 | 51.28 | 4000 | 0.0911 | 0.0774 |
0.0211 | 57.69 | 4500 | 0.0982 | 0.0891 |
0.0187 | 64.1 | 5000 | 0.1009 | 0.0863 |
0.02 | 70.51 | 5500 | 0.0953 | 0.0852 |
0.0163 | 76.92 | 6000 | 0.1028 | 0.0804 |
0.0128 | 83.33 | 6500 | 0.0930 | 0.0856 |
0.0127 | 89.74 | 7000 | 0.0892 | 0.0676 |
0.0116 | 96.15 | 7500 | 0.0857 | 0.0753 |
0.0139 | 102.56 | 8000 | 0.1078 | 0.0481 |
0.0107 | 108.97 | 8500 | 0.0955 | 0.0683 |
0.0096 | 115.38 | 9000 | 0.0846 | 0.0697 |
0.0089 | 121.79 | 9500 | 0.0854 | 0.0675 |
0.0084 | 128.21 | 10000 | 0.0875 | 0.0779 |
0.0074 | 134.62 | 10500 | 0.0840 | 0.0770 |
0.0061 | 141.03 | 11000 | 0.0903 | 0.0754 |
0.0076 | 147.44 | 11500 | 0.0872 | 0.0769 |
0.0069 | 153.85 | 12000 | 0.0891 | 0.0772 |
0.0061 | 160.26 | 12500 | 0.0971 | 0.0774 |
0.0049 | 166.67 | 13000 | 0.0984 | 0.0726 |
0.0045 | 173.08 | 13500 | 0.0952 | 0.0765 |
0.0039 | 179.49 | 14000 | 0.1015 | 0.0762 |
0.0031 | 185.9 | 14500 | 0.0937 | 0.0712 |
0.0032 | 192.31 | 15000 | 0.0982 | 0.0635 |
0.0028 | 198.72 | 15500 | 0.0981 | 0.0743 |
0.0024 | 205.13 | 16000 | 0.1019 | 0.0712 |
0.0024 | 211.54 | 16500 | 0.0957 | 0.0732 |
0.002 | 217.95 | 17000 | 0.0941 | 0.0732 |
0.0015 | 224.36 | 17500 | 0.1009 | 0.0717 |
0.0017 | 230.77 | 18000 | 0.0955 | 0.0730 |
0.0013 | 237.18 | 18500 | 0.0989 | 0.0732 |
0.0013 | 243.59 | 19000 | 0.0967 | 0.0738 |
0.0011 | 250.0 | 19500 | 0.0980 | 0.0734 |
0.0008 | 256.41 | 20000 | 0.0988 | 0.0736 |
框架版本
- Transformers:4.24.0
- Pytorch:1.13.0 + cu117
- Datasets:2.6.1
- Tokenizers:0.13.2
📄 許可證
本項目採用 Apache - 2.0 許可證。
引用說明
如果你在研究中使用了此代碼,請引用我們的論文:
@article{zuluaga2022how,
title={How Does Pre-trained Wav2Vec2. 0 Perform on Domain Shifted ASR? An Extensive Benchmark on Air Traffic Control Communications},
author={Zuluaga-Gomez, Juan and Prasad, Amrutha and Nigmatulina, Iuliia and Sarfjoo, Saeed and others},
journal={IEEE Spoken Language Technology Workshop (SLT), Doha, Qatar},
year={2022}
}
以及
@article{zuluaga2022bertraffic,
title={BERTraffic: BERT-based Joint Speaker Role and Speaker Change Detection for Air Traffic Control Communications},
author={Zuluaga-Gomez, Juan and Sarfjoo, Seyyed Saeed and Prasad, Amrutha and others},
journal={IEEE Spoken Language Technology Workshop (SLT), Doha, Qatar},
year={2022}
}
以及
@article{zuluaga2022atco2,
title={ATCO2 corpus: A Large-Scale Dataset for Research on Automatic Speech Recognition and Natural Language Understanding of Air Traffic Control Communications},
author={Zuluaga-Gomez, Juan and Vesel{\`y}, Karel and Sz{\"o}ke, Igor and Motlicek, Petr and others},
journal={arXiv preprint arXiv:2211.04054},
year={2022}
}



