🚀 大声(Dasheng):大规模通用音频编码器
大声(Dasheng,即Deep Audio-Signal Holistic Embeddings),或者“大声”(中文意为“great sound”),是一个在大规模自监督学习任务上训练的通用音频编码器。大声旨在捕捉包括语音、音乐和环境声音等各个领域的丰富音频信息。该模型在272,356小时的多样化音频数据上进行训练,拥有12亿个参数,并在HEAR基准测试中展现出显著的性能提升。在CREMA - D、LibriCount、语音指令、VoxLingua等任务中,大声超越了以往的工作成果,并且在音乐和环境声音分类任务中也表现出色。
原始仓库:https://github.com/RicherMans/Dasheng

🚀 快速开始
✨ 主要特性
- 通用音频编码:能够捕捉语音、音乐和环境声音等多领域的丰富音频信息。
- 大规模训练:在272,356小时的多样化音频数据上训练,拥有12亿个参数。
- 性能优越:在HEAR基准测试中表现出色,在多个音频分类任务中超越以往工作。
📦 安装指南
pip install git+https://github.com/jimbozhang/hf_transformers_custom_model_dasheng.git
💻 使用示例
基础用法
>>> model_name = "mispeech/dasheng-base"
>>> from dasheng_model.feature_extraction_dasheng import DashengFeatureExtractor
>>> from dasheng_model.modeling_dasheng import DashengModel
>>> feature_extractor = DashengFeatureExtractor.from_pretrained(model_name)
>>> model = DashengModel.from_pretrained(model_name, outputdim=None)
>>> import torchaudio
>>> audio, sampling_rate = torchaudio.load("resources/JeD5V5aaaoI_931_932.wav")
>>> assert sampling_rate == 16000
>>> audio.shape
torch.Size([1, 16000])
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")
>>> inputs.input_values.shape
torch.Size([1, 64, 101])
>>> import torch
>>> with torch.no_grad():
... outputs = model(**inputs)
>>> outputs.hidden_states.shape
torch.Size([1, 25, 768])
>>> outputs.logits.shape
torch.Size([1, 768])
高级用法
点击下面的链接在Colab中打开微调示例:

example_finetune_esc50.ipynb
展示了如何在ESC - 50数据集上冻结大声编码器并训练一个线性头部。
📄 许可证
本项目采用Apache - 2.0许可证。
📚 详细文档
如果您在研究中发现大声模型很有用,请考虑引用以下论文:
@inproceedings{dinkel2023scaling,
title={Scaling up masked audio encoder learning for general audio classification},
author={Dinkel, Heinrich and Yan, Zhiyong and Wang, Yongqing and Zhang, Junbo and Wang, Yujun and Wang, Bin},
booktitle={Interspeech 2024},
year={2024}
}