Wav2vec2 Large Xlsr Estonian
これはfacebook/wav2vec2-large-xlsr-53モデルをファインチューニングしたエストニア語自動音声認識(ASR)モデルで、Common Voiceデータセットを使用してトレーニングされました。
ダウンロード数 26
リリース時間 : 3/2/2022
モデル概要
このモデルはエストニア語の音声認識タスク専用に設計されており、エストニア語の音声をテキストに変換できます。
モデル特徴
高精度音声認識
Common Voiceエストニア語テストセットで33.93%のWER(単語誤り率)を達成
XLSR事前学習モデルベース
facebook/wav2vec2-large-xlsr-53をベースモデルとしてファインチューニング
16kHz音声サポート
16kHzサンプリングレートの音声入力を処理
モデル能力
エストニア語音声からテキストへの変換
自動音声認識
使用事例
音声文字起こし
音声テキスト化サービス
エストニア語の音声コンテンツを編集可能なテキストに変換
単語誤り率33.93%
音声アシスタント
エストニア語音声コマンド認識
エストニア語対応の音声アシスタントシステム構築に使用
🚀 Wav2Vec2-Large-XLSR-53-Estonian
このモデルは、Common Voiceを使用してエストニア語で微調整されたfacebook/wav2vec2-large-xlsr-53です。このモデルを使用する際には、音声入力が16kHzでサンプリングされていることを確認してください。
🚀 クイックスタート
このモデルは、言語モデルを使用せずに直接使用できます。以下に使用方法を示します。
💻 使用例
基本的な使用法
# 必要なパッケージ
!pip install git+https://github.com/huggingface/datasets.git
!pip install git+https://github.com/huggingface/transformers.git
!pip install torchaudio
!pip install librosa
!pip install jiwer
import librosa
import torch
import torchaudio
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
from datasets import load_dataset
import numpy as np
import re
import string
import IPython.display as ipd
chars_to_ignore = [
",", "?", ".", "!", "-", ";", ":", '""', "%", "'", '"', "�",
"#", "!", "?", "«", "»", "(", ")", "؛", ",", "?", ".", "!", "-", ";", ":", '"',
"“", "%", "‘", "�", "–", "…", "_", "”", '“', '„'
]
chars_to_mapping = {
"\u200c": " ", "\u200d": " ", "\u200e": " ", "\u200f": " ", "\ufeff": " ",
}
def multiple_replace(text, chars_to_mapping):
pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
return re.sub(pattern, lambda m: chars_to_mapping[m.group()], str(text))
def remove_special_characters(text, chars_to_ignore_regex):
text = re.sub(chars_to_ignore_regex, '', text).lower() + " "
return text
def normalizer(batch, chars_to_ignore, chars_to_mapping):
chars_to_ignore_regex = f"""[{"".join(chars_to_ignore)}]"""
text = batch["sentence"].lower().strip()
text = text.replace("\u0307", " ").strip()
text = multiple_replace(text, chars_to_mapping)
text = remove_special_characters(text, chars_to_ignore_regex)
batch["sentence"] = text
return batch
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
speech_array = speech_array.squeeze().numpy()
speech_array = librosa.resample(np.asarray(speech_array), sampling_rate, 16_000)
batch["speech"] = speech_array
return batch
def predict(batch):
features = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
input_values = features.input_values.to(device)
attention_mask = features.attention_mask.to(device)
with torch.no_grad():
logits = model(input_values, attention_mask=attention_mask).logits
pred_ids = torch.argmax(logits, dim=-1)
batch["predicted"] = processor.batch_decode(pred_ids)[0]
return batch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
processor = Wav2Vec2Processor.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-estonian")
model = Wav2Vec2ForCTC.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-estonian").to(device)
dataset = load_dataset("common_voice", "et", split="test[:1%]")
dataset = dataset.map(
normalizer,
fn_kwargs={"chars_to_ignore": chars_to_ignore, "chars_to_mapping": chars_to_mapping},
remove_columns=list(set(dataset.column_names) - set(['sentence', 'path']))
)
dataset = dataset.map(speech_file_to_array_fn)
result = dataset.map(predict)
max_items = np.random.randint(0, len(result), 10).tolist()
for i in max_items:
reference, predicted = result["sentence"][i], result["predicted"][i]
print("reference:", reference)
print("predicted:", predicted)
print('---')
出力例
reference: õhulossid lagunevad ning ees ootab maapind
predicted: õhulassid lagunevad ning ees ootab maapind
---
reference: milliseks kiievisse pääsemise nimel võistlev muusik soome muusikamaastiku hetkeseisu hindab ning kas ta ka ennast sellel tulevikus tegutsemas näeb kuuled videost
predicted: milliseks gievisse pääsemise nimel võitlev muusiks soome muusikama aastiku hetke seisu hindab ning kas ta ennast selle tulevikus tegutsemast näeb kuulad videost
---
reference: näiteks kui pool seina on tehtud tekib tunne et tahaks tegelikult natuke teistsugust ja hakkame otsast peale
predicted: näiteks kui pool seine on tehtud tekib tunnetahaks tegelikult matuka teistsugust jahappanna otsast peane
---
reference: neuroesteetilised katsed näitavad et just nägude vaatlemine aktiveerib inimese aju esteetilist keskust
predicted: neuroaisteetiliselt katsed näitaval et just nägude vaatlemine aptiveerid inimese aju est eedilist keskust
---
reference: paljud inimesed kindlasti kadestavad teid kuid ei julge samamoodi vabalt võtta
predicted: paljud inimesed kindlasti kadestavadteid kuid ei julge sama moodi vabalt võtta
---
reference: parem on otsida pileteid inkognito veebi kaudu
predicted: parem on otsida pileteid ning kognitu veebikaudu
---
reference: ja vot siin ma jäin vaikseks
predicted: ja vat siisma ja invaikseks
---
reference: mida sa iseendale juubeli puhul soovid
predicted: mida saise endale jubeli puhul soovid
---
reference: kuumuse ja kõrge temperatuuri tõttu kuivas tühjadel karjamaadel rohi mis muutus kergesti süttivaks
predicted: kuumuse ja kõrge temperatuuri tõttu kuivast ühjadal karjamaadel rohi mis muutus kergesti süttivaks
---
reference: ilmselt on inimesi kelle jaoks on see hea lahendus
predicted: ilmselt on inimesi kelle jaoks on see hea lahendus
---
🔧 評価
このモデルは、Common Voiceのエストニア語のテストデータで以下のように評価できます。
import librosa
import torch
import torchaudio
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
from datasets import load_dataset, load_metric
import numpy as np
import re
import string
chars_to_ignore = [
",", "?", ".", "!", "-", ";", ":", '""', "%", "'", '"', "�",
"#", "!", "?", "«", "»", "(", ")", "؛", ",", "?", ".", "!", "-", ";", ":", '"',
"“", "%", "‘", "�", "–", "…", "_", "”", '“', '„'
]
chars_to_mapping = {
"\u200c": " ", "\u200d": " ", "\u200e": " ", "\u200f": " ", "\ufeff": " ",
}
def multiple_replace(text, chars_to_mapping):
pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
return re.sub(pattern, lambda m: chars_to_mapping[m.group()], str(text))
def remove_special_characters(text, chars_to_ignore_regex):
text = re.sub(chars_to_ignore_regex, '', text).lower() + " "
return text
def normalizer(batch, chars_to_ignore, chars_to_mapping):
chars_to_ignore_regex = f"""[{"".join(chars_to_ignore)}]"""
text = batch["sentence"].lower().strip()
text = text.replace("\u0307", " ").strip()
text = multiple_replace(text, chars_to_mapping)
text = remove_special_characters(text, chars_to_ignore_regex)
batch["sentence"] = text
return batch
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
speech_array = speech_array.squeeze().numpy()
speech_array = librosa.resample(np.asarray(speech_array), sampling_rate, 16_000)
batch["speech"] = speech_array
return batch
def predict(batch):
features = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
input_values = features.input_values.to(device)
attention_mask = features.attention_mask.to(device)
with torch.no_grad():
logits = model(input_values, attention_mask=attention_mask).logits
pred_ids = torch.argmax(logits, dim=-1)
batch["predicted"] = processor.batch_decode(pred_ids)[0]
return batch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
processor = Wav2Vec2Processor.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-estonian")
model = Wav2Vec2ForCTC.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-estonian").to(device)
dataset = load_dataset("common_voice", "et", split="test")
dataset = dataset.map(
normalizer,
fn_kwargs={"chars_to_ignore": chars_to_ignore, "chars_to_mapping": chars_to_mapping},
remove_columns=list(set(dataset.column_names) - set(['sentence', 'path']))
)
dataset = dataset.map(speech_file_to_array_fn)
result = dataset.map(predict)
wer = load_metric("wer")
print("WER: {:.2f}".format(100 * wer.compute(predictions=result["predicted"], references=result["sentence"])))
テスト結果
- WER: 33.93%
🔧 学習とレポート
学習には、Common Voiceのtrain
とvalidation
データセットが使用されました。
学習状況はこちらで確認できます。
学習に使用されたスクリプトはこちらで見つけることができます。
📄 ライセンス
このモデルは、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アーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98