Wav2vec2 Large Xlsr 53 Greek
基於facebook/wav2vec2-large-xlsr-53模型微調的希臘語語音識別模型,支持16kHz採樣率的語音輸入。
下載量 25
發布時間 : 3/2/2022
模型概述
該模型是針對希臘語優化的自動語音識別(ASR)模型,基於Wav2Vec2架構,使用通用語音和CSS10希臘語單說話人數據集進行微調。
模型特點
多數據集微調
結合通用語音和CSS10希臘語單說話人數據集進行訓練,提高模型識別準確性
文本標準化處理
對希臘語特殊字符進行標準化處理,如將ς轉換為σ,提升識別效果
無需語言模型
可直接使用進行語音識別,無需額外語言模型支持
模型能力
希臘語語音識別
16kHz音頻處理
即時語音轉文字
使用案例
語音轉寫
希臘語會議記錄
將希臘語會議錄音自動轉寫為文字
詞錯誤率18.99%,字符錯誤率5.78%
語音助手
用於希臘語語音助手應用的語音識別模塊
教育
語言學習應用
幫助學習者練習希臘語發音和聽力
🚀 Wav2Vec2-Large-XLSR-53-希臘語
本項目基於 Common Voice 和 CSS10 希臘語:單說話人語音數據集,對 facebook/wav2vec2-large-xlsr-53 模型進行了希臘語微調。使用該模型時,請確保語音輸入採樣率為 16kHz。
🚀 快速開始
在使用此模型前,請確保你的語音輸入採樣率為 16kHz。
✨ 主要特性
- 多數據集微調:基於 Common Voice 和 CSS10 希臘語單說話人語音數據集進行微調。
- 特定語言優化:專門針對希臘語進行優化,提升語音識別效果。
📦 安裝指南
文檔未提及安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
該模型可以直接使用(無需語言模型),示例代碼如下:
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
test_dataset = load_dataset("common_voice", "el", split="test[:2%]") #TODO: replace {lang_id} in your language code here. Make sure the code is one of the *ISO codes* of [this](https://huggingface.co/languages) site.
processor = Wav2Vec2Processor.from_pretrained("vasilis/wav2vec2-large-xlsr-53-greek") #TODO: replace {model_id} with your model id. The model id consists of {your_username}/{your_modelname}, *e.g.* `elgeish/wav2vec2-large-xlsr-53-arabic`
model = Wav2Vec2ForCTC.from_pretrained("vasilis/wav2vec2-large-xlsr-53-greek") #TODO: replace {model_id} with your model id. The model id consists of {your_username}/{your_modelname}, *e.g.* `elgeish/wav2vec2-large-xlsr-53-arabic`
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the aduio 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["speech"][:2], 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])
📚 詳細文檔
評估
可以使用以下代碼在 Common Voice 的希臘語測試數據上對模型進行評估:
import torch
import torchaudio
from datasets import load_dataset, load_metric
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import re
test_dataset = load_dataset("common_voice", "el", split="test") #TODO: replace {lang_id} in your language code here. Make sure the code is one of the *ISO codes* of [this](https://huggingface.co/languages) site.
wer = load_metric("wer")
processor = Wav2Vec2Processor.from_pretrained("vasilis/wav2vec2-large-xlsr-53-greek") #TODO: replace {model_id} with your model id. The model id consists of {your_username}/{your_modelname}, *e.g.* `elgeish/wav2vec2-large-xlsr-53-arabic`
model = Wav2Vec2ForCTC.from_pretrained("vasilis/wav2vec2-large-xlsr-53-greek") #TODO: replace {model_id} with your model id. The model id consists of {your_username}/{your_modelname}, *e.g.* `elgeish/wav2vec2-large-xlsr-53-arabic`
model.to("cuda")
chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“]' # TODO: adapt this list to include all special characters you removed from the data
normalize_greek_letters = {"ς": "σ"}
# normalize_greek_letters = {"ά": "α", "έ": "ε", "ί": "ι", 'ϊ': "ι", "ύ": "υ", "ς": "σ", "ΐ": "ι", 'ϋ': "υ", "ή": "η", "ώ": "ω", 'ό': "ο"}
remove_chars_greek = {"a": "", "h": "", "n": "", "g": "", "o": "", "v": "", "e": "", "r": "", "t": "", "«": "", "»": "", "m": "", '́': '', "·": "", "’": "", '´': ""}
replacements = {**normalize_greek_letters, **remove_chars_greek}
resampler = {
48_000: torchaudio.transforms.Resample(48_000, 16_000),
44100: torchaudio.transforms.Resample(44100, 16_000),
32000: torchaudio.transforms.Resample(32000, 16_000)
}
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
for key, value in replacements.items():
batch["sentence"] = batch["sentence"].replace(key, value)
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler[sampling_rate](speech_array).squeeze().numpy()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
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["sentence"])))
print("CER: {:2f}".format(100 * wer.compute(predictions=[" ".join(list(entry)) for entry in result["pred_strings"]], references=[" ".join(list(entry)) for entry in result["sentence"]])))
測試結果:18.996669 %
訓練
訓練使用了 Common Voice 訓練數據集,同時使用了 CSS10 希臘語
的所有歸一化轉錄數據。在文本預處理過程中,字母 ς
被歸一化為 σ
,原因是這兩個字母發音相同,且 ς
僅用作單詞的結尾字符,因此這種更改可以輕鬆映射到正確的聽寫。嘗試去除字母上的所有重音符號也顯著提高了 WER
。該模型在未收斂的情況下,WER
輕鬆達到了 17%。然而,後續修復轉錄所需的文本預處理會更加複雜。不過,語言模型應該可以輕鬆解決這些問題。另一個可以嘗試的方法是將所有 ι
、η
等字母更改為單個字符,因為它們發音相同,對於 o
和 ω
也是如此,這將顯著有助於聲學模型部分,因為所有這些字符都映射到相同的聲音,但需要進一步的文本歸一化。
🔧 技術細節
模型信息
屬性 | 詳情 |
---|---|
模型類型 | 基於 XLSR 微調的 Wav2Vec2 大模型 |
訓練數據 | Common Voice 訓練數據集、CSS10 希臘語數據集(使用歸一化轉錄) |
評估指標 | 詞錯誤率(WER)、字符錯誤率(CER) |
模型結果
任務 | 數據集 | 測試 WER | 測試 CER |
---|---|---|---|
語音識別 | Common Voice el | 18.996669 | 5.781874 |
📄 許可證
本項目使用 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