Wav2vec2 Large Xlsr Luganda
基於facebook/wav2vec2-large-xlsr-53模型微調的盧幹達語語音識別模型,在通用語音數據集上訓練,詞錯誤率29.52%
下載量 17
發布時間 : 3/2/2022
模型概述
這是一個針對盧幹達語優化的自動語音識別(ASR)模型,基於Facebook的XLSR-53架構微調,適用於盧幹達語語音轉文本任務。
模型特點
低資源語言優化
專門針對盧幹達語這一低資源語言進行優化,在通用語音數據集上微調
無需語言模型
可直接使用,不需要額外的語言模型支持
數據增強訓練
通過添加噪聲及調整音高、相位和強度進行數據增強,提升模型魯棒性
模型能力
盧幹達語語音識別
16kHz音頻處理
批量語音轉文本
使用案例
語音轉錄
盧幹達語語音轉錄
將盧幹達語語音內容轉換為文本
詞錯誤率29.52%
語音助手
盧幹達語語音交互
為盧幹達語語音助手提供語音識別能力
🚀 Wav2Vec2-Large-XLSR-53-lg
本模型基於盧幹達語(Luganda)對 facebook/wav2vec2-large-xlsr-53 進行了微調,使用了 Common Voice 數據集,涵蓋訓練集、驗證集及其他數據(不包括測試集中的語音),同時將測試數據用於驗證和測試。使用此模型時,請確保語音輸入的採樣率為 16kHz。
模型信息
屬性 | 詳情 |
---|---|
模型類型 | Wav2Vec2-Large-XLSR-53-lg |
訓練數據 | Common Voice 盧幹達語數據集(訓練集、驗證集及其他數據,排除測試集中的語音) |
評估指標 | 詞錯誤率(WER) |
標籤 | 音頻、自動語音識別、語音、xlsr 微調周 |
許可證 | Apache 2.0 |
模型評估結果
任務名稱 | 數據集 | 評估指標 | 值 |
---|---|---|---|
語音識別 | Common Voice lg | 測試 WER | 29.52 |
🚀 快速開始
✨ 主要特性
- 基於預訓練的 facebook/wav2vec2-large-xlsr-53 模型進行微調,適用於盧幹達語語音識別任務。
- 訓練數據經過增強處理,包括添加噪聲、調整音高、相位和強度,以提高模型的魯棒性。
📦 安裝指南
文檔未提供安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
test_dataset = load_dataset("common_voice", "lg", split="test[:2%]")
processor = Wav2Vec2Processor.from_pretrained("lucio/wav2vec2-large-xlsr-luganda")
model = Wav2Vec2ForCTC.from_pretrained("lucio/wav2vec2-large-xlsr-luganda")
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the audio files as arrays
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler(speech_array).squeeze().numpy()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset[:2]["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
predicted_ids = torch.argmax(logits, dim=-1)
print("Prediction:", processor.batch_decode(predicted_ids))
print("Reference:", test_dataset["sentence"][:2])
高級用法
import torch
import torchaudio
from datasets import load_dataset, load_metric
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import re
import unidecode
test_dataset = load_dataset("common_voice", "lg", split="test")
wer = load_metric("wer")
processor = Wav2Vec2Processor.from_pretrained("lucio/wav2vec2-large-xlsr-luganda")
model = Wav2Vec2ForCTC.from_pretrained("lucio/wav2vec2-large-xlsr-luganda")
model.to("cuda")
chars_to_ignore_regex = '[\[\],?.!;:%"“”(){}‟ˮʺ″«»/…‽�–]'
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the audio files as arrays
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler(speech_array).squeeze().numpy()
return batch
def remove_special_characters(batch):
# word-internal apostrophes are marking contractions
batch["norm_text"] = re.sub(r'[‘’´`]', r"'", batch["sentence"])
# most other punctuation is ignored
batch["norm_text"] = re.sub(chars_to_ignore_regex, "", batch["norm_text"]).lower().strip()
batch["norm_text"] = re.sub(r"(-|' | '| +)", " ", batch["norm_text"])
# remove accents from a few characters (from loanwords, not tones)
batch["norm_text"] = unidecode.unidecode(batch["norm_text"])
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
test_dataset = test_dataset.map(remove_special_characters)
def evaluate(batch):
inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
pred_ids = torch.argmax(logits, dim=-1)
batch["pred_strings"] = processor.batch_decode(pred_ids)
return batch
result = test_dataset.map(evaluate, batched=True, batch_size=8)
print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["norm_text"])))
測試結果:29.52 %
📚 詳細文檔
訓練過程
- 數據使用:使用了 Common Voice 的
train
、validation
和other
數據集進行訓練,排除了同時存在於other
和test
數據集中的語音。 - 數據增強:將數據增強至原始大小的兩倍,添加了噪聲,並對音高、相位和強度進行了調整。
- 訓練配置:在 OVHcloud 提供的 1 個 V100 GPU 上進行了 60 個 epoch 的訓練,使用
test
數據進行驗證。 - 訓練腳本:訓練使用的腳本 點擊此處查看,該腳本改編自 transformers 倉庫提供的示例腳本。
📄 許可證
本模型使用 Apache 2.0 許可證。
Voice Activity Detection
MIT
基於pyannote.audio 2.1版本的語音活動檢測模型,用於識別音頻中的語音活動時間段
語音識別
V
pyannote
7.7M
181
Wav2vec2 Large Xlsr 53 Portuguese
Apache-2.0
這是一個針對葡萄牙語語音識別任務微調的XLSR-53大模型,基於Common Voice 6.1數據集訓練,支持葡萄牙語語音轉文本。
語音識別 其他
W
jonatasgrosman
4.9M
32
Whisper Large V3
Apache-2.0
Whisper是由OpenAI提出的先進自動語音識別(ASR)和語音翻譯模型,在超過500萬小時的標註數據上訓練,具有強大的跨數據集和跨領域泛化能力。
語音識別 支持多種語言
W
openai
4.6M
4,321
Whisper Large V3 Turbo
MIT
Whisper是由OpenAI開發的最先進的自動語音識別(ASR)和語音翻譯模型,經過超過500萬小時標記數據的訓練,在零樣本設置下展現出強大的泛化能力。
語音識別
Transformers 支持多種語言

W
openai
4.0M
2,317
Wav2vec2 Large Xlsr 53 Russian
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的俄語語音識別模型,支持16kHz採樣率的語音輸入
語音識別 其他
W
jonatasgrosman
3.9M
54
Wav2vec2 Large Xlsr 53 Chinese Zh Cn
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的中文語音識別模型,支持16kHz採樣率的語音輸入。
語音識別 中文
W
jonatasgrosman
3.8M
110
Wav2vec2 Large Xlsr 53 Dutch
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53微調的荷蘭語語音識別模型,在Common Voice和CSS10數據集上訓練,支持16kHz音頻輸入。
語音識別 其他
W
jonatasgrosman
3.0M
12
Wav2vec2 Large Xlsr 53 Japanese
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53模型微調的日語語音識別模型,支持16kHz採樣率的語音輸入
語音識別 日語
W
jonatasgrosman
2.9M
33
Mms 300m 1130 Forced Aligner
基於Hugging Face預訓練模型的文本與音頻強制對齊工具,支持多種語言,內存效率高
語音識別
Transformers 支持多種語言

M
MahmoudAshraf
2.5M
50
Wav2vec2 Large Xlsr 53 Arabic
Apache-2.0
基於facebook/wav2vec2-large-xlsr-53微調的阿拉伯語語音識別模型,在Common Voice和阿拉伯語語音語料庫上訓練
語音識別 阿拉伯語
W
jonatasgrosman
2.3M
37
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98