模型库 / laion/clap-htsat-fused

clap-htsat-fused

laion audio-classification transformers en
laion/clap-htsat-fused
20,041,593
下载量
284
收藏数
33
浏览量
apache-2.0
许可

简介

Model card for CLAP: Contrastive Language-Audio Pretraining

模型卡片

许可协议 apache-2.0
语言
en
任务 audio-classification
zero-shot audio classification zero-shot audio retrieval

模型配置

模型类型 clap
架构 ClapModel

模型详情

已翻译

CLAP 模型卡片

CLAP 模型卡片:对比语言-音频预训练(Contrastive Language-Audio Pretraining)

数据集

LAION-CLAP 在 LAION-audio-630k 上进行了训练

目录

  1. 摘要
  2. 模型详情
  3. 使用方法
  4. 应用场景
  5. 引用

摘要

论文摘要指出:

对比学习在多模态表示学习领域取得了显著成功。本文提出了一种对比语言-音频预训练流程,通过将音频数据与自然语言描述相结合来开发音频表示。为实现这一目标,我们首先发布了 LAION-Audio-630K,这是一个包含来自不同数据源的 633,526 个音频-文本对的大型数据集。其次,我们通过考虑不同的音频编码器和文本编码器构建了对比语言-音频预训练模型。我们在模型设计中融入了特征融合机制和关键词到描述增强,以进一步使模型能够处理可变长度的音频输入并提升性能。第三,我们进行了全面的实验,在三个任务上评估模型:文本到音频检索、零样本音频分类和监督音频分类。结果表明,我们的模型在文本到音频检索任务中取得了优越性能。在音频分类任务中,该模型在零样本设置下达到了最先进的性能,并且能够获得与非零样本设置下模型结果相当的性能。LAION-Audio-630K 和所提出的模型均已向公众开放。

使用方法

您可以使用此模型进行零样本音频分类,或提取音频和/或文本特征。

应用场景

执行零样本音频分类

使用 pipeline

from datasets import load_dataset
from transformers import pipeline

dataset = load_dataset("ashraq/esc50")
audio = dataset["train"]["audio"][-1]["array"]

audio_classifier = pipeline(task="zero-shot-audio-classification", model="laion/clap-htsat-fused")
output = audio_classifier(audio, candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"])
print(output)
>>> [{"score": 0.999, "label": "Sound of a dog"}, {"score": 0.001, "label": "Sound of vaccum cleaner"}]

运行模型:

您还可以使用 ClapModel 获取音频和文本嵌入

在 CPU 上运行模型:

from datasets import load_dataset
from transformers import ClapModel, ClapProcessor

librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
audio_sample = librispeech_dummy[0]

model = ClapModel.from_pretrained("laion/clap-htsat-fused")
processor = ClapProcessor.from_pretrained("laion/clap-htsat-fused")

inputs = processor(audios=audio_sample["audio"]["array"], return_tensors="pt")
audio_embed = model.get_audio_features(**inputs)

在 GPU 上运行模型:

from datasets import load_dataset
from transformers import ClapModel, ClapProcessor

librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
audio_sample = librispeech_dummy[0]

model = ClapModel.from_pretrained("laion/clap-htsat-fused").to(0)
processor = ClapProcessor.from_pretrained("laion/clap-htsat-fused")

inputs = processor(audios=audio_sample["audio"]["array"], return_tensors="pt").to(0)
audio_embed = model.get_audio_features(**inputs)

引用

如果您在工作中使用此模型,请考虑引用原始论文:

@misc{https://doi.org/10.48550/arxiv.2211.06687,
  doi = {10.48550/ARXIV.2211.06687},

  url = {https://arxiv.org/abs/2211.06687},

  author = {Wu, Yusong and Chen, Ke and Zhang, Tianyu and Hui, Yuchen and Nezhurina, Marianna and Berg-Kirkpatrick, Taylor and Dubnov, Shlomo},

  keywords = {Sound (cs.SD), Audio and Speech Processing (eess.AS), FOS: Computer and information sciences, FOS: Computer and information sciences, FOS: Electrical engineering, electronic engineering, information engineering, FOS: Electrical engineering, electronic engineering, information engineering},

  title = {Large-scale Contrastive Language-Audio Pretraining with Feature Fusion and Keyword-to-Caption Augmentation},

  publisher = {arXiv},

  year = {2022},

  copyright = {Creative Commons Attribution 4.0 International}
}

标签

clap feature-extraction zero-shot audio classification zero-shot audio retrieval en arxiv:2211.06687 license:apache-2.0 endpoints_compatible

操作


详细信息

厂商
laion
任务
audio-classification
框架
transformers
模型类型
clap
许可(HF)
apache-2.0
语言
en