许可证: cc-by-nc-4.0
语言:
- 南非荷兰语
- 阿姆哈拉语
- 阿拉伯语
- 阿萨姆语
- 阿塞拜疆语
- 白俄罗斯语
- 孟加拉语
- 波斯尼亚语
- 保加利亚语
- 加泰罗尼亚语
- 捷克语
- 中文
- 威尔士语
- 丹麦语
- 德语
- 希腊语
- 英语
- 爱沙尼亚语
- 芬兰语
- 法语
- 奥里亚语
- 奥罗莫语
- 爱尔兰语
- 加利西亚语
- 古吉拉特语
- 豪萨语
- 希伯来语
- 印地语
- 克罗地亚语
- 匈牙利语
- 亚美尼亚语
- 伊博语
- 印尼语
- 冰岛语
- 意大利语
- 爪哇语
- 日语
- 卡纳达语
- 格鲁吉亚语
- 哈萨克语
- 蒙古语
- 高棉语
- 吉尔吉斯语
- 韩语
- 老挝语
- 林加拉语
- 立陶宛语
- 卢森堡语
- 卢干达语
- 拉脱维亚语
- 马拉雅拉姆语
- 马拉地语
- 马其顿语
- 马耳他语
- 毛利语
- 缅甸语
- 荷兰语
- 挪威书面语
- 尼泊尔语
- 齐切瓦语
- 奥克语
- 旁遮普语
- 普什图语
- 波斯语
- 波兰语
- 葡萄牙语
- 罗马尼亚语
- 俄语
- 斯洛伐克语
- 斯洛文尼亚语
- 绍纳语
- 信德语
- 索马里语
- 西班牙语
- 塞尔维亚语
- 瑞典语
- 斯瓦希里语
- 泰米尔语
- 泰卢固语
- 塔吉克语
- 他加禄语
- 泰语
- 土耳其语
- 乌克兰语
- 乌尔都语
- 乌兹别克语
- 越南语
- 沃洛夫语
- 科萨语
- 约鲁巴语
- 马来语
- 祖鲁语
- 摩洛哥阿拉伯语
- 埃及阿拉伯语
- 粤语
- 佛得角克里奥尔语
标签:
多语言支持:
任务类别:
库名称: transformers
显示名称: SeamlessM4Tv2-Large语音编码器
SeamlessM4Tv2-Large语音编码器
本仓库从SeamlessM4Tv2-Large中提取了语音编码器模块,该模块在跨语言和多语言的序列级音频分类任务中表现优异(参见SIB-Fleurs数据集上的结果)。
所有荣誉归属于原SeamlessM4Tv2-Large团队。
使用示例
您可以使用AutoModel
和AutoModelForAudioClassification
(或AutoModelForSequenceClassification
,如果更偏好)加载本仓库模型:
from datasets import load_dataset
from transformers import (
AutoModel,
AutoModelForAudioClassification,
AutoFeatureExtractor,
)
import torch
import torchaudio
device = "cuda:0"
feature_extractor = AutoFeatureExtractor.from_pretrained(
"WueNLP/seamless-m4t-v2-large-speech-encoder", trust_remote_code=True
)
model = AutoModel.from_pretrained(
"WueNLP/seamless-m4t-v2-large-speech-encoder",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
).to(device)
audio, orig_freq = torchaudio.load(
"https://www2.cs.uic.edu/~i101/SoundFiles/preamble10.wav"
)
audio = torchaudio.functional.resample(
audio, orig_freq=orig_freq, new_freq=16_000
)
audio_inputs = feature_extractor(audio, return_attention_mask=True, return_tensors="pt", device=device)
audio_inputs = audio_inputs.to(device)
with torch.autocast(dtype=torch.bfloat16, device_type="cuda"):
audio_hidden_states = model(**audio_inputs)[0].detach().cpu().numpy().squeeze()
model = AutoModelForAudioClassification.from_pretrained(
"WueNLP/seamless-m4t-v2-large-speech-encoder",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
num_labels=7,
).to(device)
eng_Latn = load_dataset("wuenlp/sib-fleurs", "eng_Latn", split="train")
examples = [eng_Latn[i] for i in range(5)]
labels = torch.LongTensor([example["category"] for example in examples]).to(device)
batch = feature_extractor(
[example["audio"][0]["array"] for example in examples],
sampling_rate=16000,
device=device,
return_attention_mask=True,
return_tensors="pt",
).to(device)
batch["labels"] = labels
with torch.autocast(dtype=torch.bfloat16, device_type="cuda"):
outputs = model(**batch)
引用
若使用本模型,请引用原始SeamlessM4Tv2论文。
@misc{communication2023seamlessmultilingualexpressivestreaming,
title={Seamless: Multilingual Expressive and Streaming Speech Translation},
author={Seamless Communication and Loïc Barrault and Yu-An Chung and Mariano Coria Meglioli and David Dale and Ning Dong and Mark Duppenthaler and Paul-Ambroise Duquenne and Brian Ellis and Hady Elsahar and Justin Haaheim and John Hoffman and Min-Jae Hwang and Hirofumi Inaguma and Christopher Klaiber and Ilia Kulikov and Pengwei Li and Daniel Licht and Jean Maillard and Ruslan Mavlyutov and Alice Rakotoarison and Kaushik Ram Sadagopan and Abinesh Ramakrishnan and Tuan Tran and Guillaume Wenzek and Yilin Yang and Ethan Ye and Ivan Evtimov and Pierre Fernandez and Cynthia Gao and Prangthip Hansanti and Elahe Kalbassi and Amanda Kallet and Artyom Kozhevnikov and Gabriel Mejia Gonzalez and Robin San Roman and Christophe Touret and Corinne Wong and Carleigh Wood and Bokai Yu and Pierre Andrews and Can Balioglu and Peng-Jen Chen and Marta R. Costa-jussà and Maha Elbayad and Hongyu Gong and Francisco Guzmán and Kevin Heffernan and Somya Jain and Justine Kao and Ann Lee and Xutai Ma and Alex Mourachko and Benjamin Peloquin and Juan Pino and Sravya Popuri and Christophe Ropers and Safiyyah Saleem and Holger Schwenk and Anna Sun and Paden Tomasello and Changhan Wang and Jeff Wang and Skyler Wang and Mary Williamson},
year={2023},
eprint={2312.05187},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2312.05187},
}