🚀 S2T2-Wav2Vec2-CoVoST2-EN-DE-ST
s2t-wav2vec2-large-en-de
是一個用於端到端語音翻譯(ST)的語音轉文本Transformer模型。S2T2模型在論文 Large-Scale Self- and Semi-Supervised Learning for Speech Translation 中被提出,並在 Fairseq 中正式發佈。
✨ 主要特性
- 多語言支持:支持英語和德語,適用於英語語音到德語文本的翻譯任務。
- 端到端處理:能夠直接將語音轉換為文本,無需額外的中間步驟。
- 基於Transformer架構:利用Transformer的強大能力,實現高效的語音處理和翻譯。
📦 安裝指南
文檔中未提及具體安裝步驟,可參考相關依賴庫(如 transformers
、datasets
等)的官方文檔進行安裝。
💻 使用示例
基礎用法
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-de", feature_extractor="facebook/s2t-wav2vec2-large-en-de")
translation_de = 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-de")
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
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)
📚 詳細文檔
模型描述
S2T2是一個基於Transformer的序列到序列(語音編碼器 - 解碼器)模型,專為端到端自動語音識別(ASR)和語音翻譯(ST)而設計。它使用預訓練的 Wav2Vec2 作為編碼器,並採用基於Transformer的解碼器。該模型使用標準的自迴歸交叉熵損失進行訓練,並以自迴歸方式生成翻譯結果。
預期用途和限制
此模型可用於端到端的英語語音到德語文本的翻譯。你可以在 模型中心 查找其他S2T2檢查點。
評估結果
CoVoST-V2 英語到德語的測試結果(BLEU分數):26.5。
更多信息請參考 官方論文 - 特別是表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許可證。
相關信息表格
屬性 |
詳情 |
支持語言 |
英語、德語 |
數據集 |
covost2、librispeech_asr |
標籤 |
音頻、語音翻譯、自動語音識別、speech2text2 |
許可證 |
MIT |
管道標籤 |
自動語音識別 |