🚀 S2T2-Wav2Vec2-CoVoST2-EN-AR-ST
s2t-wav2vec2-large-en-ar
は、エンドツーエンドの音声翻訳(ST)用に学習された音声からテキストへのTransformerモデルです。
S2T2モデルは Large-Scale Self- and Semi-Supervised Learning for Speech Translation で提案され、
Fairseq で公式にリリースされました。
🚀 クイックスタート
このモデルは、英語の音声をアラビア語のテキストにエンドツーエンドで翻訳するために使用できます。他のS2T2チェックポイントを探すには、モデルハブ を参照してください。
✨ 主な機能
モデルの説明
S2T2は、エンドツーエンドの自動音声認識(ASR)と音声翻訳(ST)用に設計されたTransformerベースのseq2seq(音声エンコーダー - デコーダー)モデルです。エンコーダーとして事前学習された Wav2Vec2 を使用し、Transformerベースのデコーダーを備えています。このモデルは、標準的な自己回帰的な交差エントロピー損失で学習され、自己回帰的に翻訳を生成します。
想定される用途と制限
このモデルは、英語の音声をアラビア語のテキストにエンドツーエンドで翻訳するために使用できます。他のS2T2チェックポイントを探すには、モデルハブ を参照してください。
💻 使用例
基本的な使用法
これは標準的なシーケンス-to-シーケンスTransformerモデルなので、generate
メソッドを使用して音声特徴をモデルに渡すことで、トランスクリプトを生成できます。
from datasets import load_dataset
from transformers import pipeline
librispeech_en = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
asr = pipeline("automatic-speech-recognition", model="facebook/s2t-wav2vec2-large-en-ar", feature_extractor="facebook/s2t-wav2vec2-large-en-ar")
translation = asr(librispeech_en[0]["file"])
高度な使用法
以下のようにステップバイステップで使用することもできます。
import torch
from transformers import Speech2Text2Processor, SpeechEncoderDecoder
from datasets import load_dataset
import soundfile as sf
model = SpeechEncoderDecoder.from_pretrained("facebook/s2t-wav2vec2-large-en-ar")
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-ar")
def map_to_array(batch):
speech, _ = sf.read(batch["file"])
batch["speech"] = speech
return batch
ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
ds = ds.map(map_to_array)
inputs = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt")
generated_ids = model.generate(input_ids=inputs["input_features"], attention_mask=inputs["attention_mask"])
transcription = processor.batch_decode(generated_ids)
🔧 技術詳細
評価結果
CoVoST-V2の英語からアラビア語へのテスト結果(BLEUスコア):20.2
詳細については、公式論文 、特に表2の10行目を参照してください。
BibTeXエントリと引用情報
@article{DBLP:journals/corr/abs-2104-06678,
author = {Changhan Wang and
Anne Wu and
Juan Miguel Pino and
Alexei Baevski and
Michael Auli and
Alexis Conneau},
title = {Large-Scale Self- and Semi-Supervised Learning for Speech Translation},
journal = {CoRR},
volume = {abs/2104.06678},
year = {2021},
url = {https://arxiv.org/abs/2104.06678},
archivePrefix = {arXiv},
eprint = {2104.06678},
timestamp = {Thu, 12 Aug 2021 15:37:06 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2104.06678.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
📄 ライセンス
このモデルはMITライセンスの下で提供されています。