audiobox aesthetics

提供商facebook
分类audio-classification
许可证cc-by-4.0
下载量379
星标0

简介

Audiobox Aesthetics 是由 Meta (Facebook) 开发的一款专注于音频质量评估的分类模型。与传统的语音识别或生成模型不同,它更像是一个“音频品鉴师”,能够量化分析音频的听感质量、自然度及美学特征。对于需要自动化筛选高质量素材、评估合成语音效果或优化音频后处理流程的开发者来说,这是一个非常实用的工具,可以有效替代部分主观的人工试听环节,降低音频质量把控的成本。

核心亮点

  • 量化音频听感,实现音频质量的自动化评估
  • 适用于合成语音 (TTS) 的自然度筛选与优化
  • 辅助音频工程师快速剔除低质素材,提升效率
  • 基于 CC-BY-4.0 协议,对开发者非常友好

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("facebook/audiobox-aesthetics")
tokenizer = AutoTokenizer.from_pretrained("facebook/audiobox-aesthetics")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download facebook/audiobox-aesthetics

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download facebook/audiobox-aesthetics config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('facebook/audiobox-aesthetics')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/facebook/audiobox-aesthetics

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/facebook/audiobox-aesthetics

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('facebook/audiobox-aesthetics')
tokenizer = AutoTokenizer.from_pretrained('facebook/audiobox-aesthetics')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model facebook/audiobox-aesthetics

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model facebook/audiobox-aesthetics README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('facebook/audiobox-aesthetics')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/facebook/audiobox-aesthetics.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/facebook/audiobox-aesthetics.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'facebook/audiobox-aesthetics')

完整文档

来源: HuggingFace

---
license: cc-by-4.0
pipeline_tag: audio-classification
tags:

  • model_hub_mixin

  • pytorch_model_hub_mixin

---

This model has been pushed to the Hub using the PytorchModelHubMixin integration:

  • Code: https://github.com/facebookresearch/audiobox-aesthetics

  • Paper: https://huggingface.co/papers/2502.05139

--- README below copied from https://github.com/facebookresearch/audiobox-aesthetics

audiobox-aesthetics

![PyPI - Version](https://pypi.org/project/audiobox-aesthetics/) ![Hugging Face Model](https://huggingface.co/facebook/audiobox-aesthetics)

Unified automatic quality assessment for speech, music, and sound.

<img src="assets/aes_model.png" alt="Model" height="400px">

Installation

1. Install via pip

code
pip install audiobox_aesthetics

2. Install directly from source

This repository requires Python 3.9 and Pytorch 2.2 or greater. To install, you can clone this repo and run:

code
pip install -e .

Pre-trained Models

Model | S3 | HuggingFace
|---|---|---|
All axes | checkpoint.pt | HF Repo

Usage

How to run prediction using CLI:

1. Create a jsonl files with the following format

code
{"path":"/path/to/a.wav"}
{"path":"/path/to/b.flac"}
...
{"path":"/path/to/z.wav"}

or if you only want to predict aesthetic scores from certain timestamp
code
{"path":"/path/to/a.wav", "start_time":0, "end_time": 5}
{"path":"/path/to/b.flac", "start_time":3, "end_time": 10}

and save it as input.jsonl

2. Run following command

code
audio-aes input.jsonl --batch-size 100 > output.jsonl

If you haven't downloade the checkpoint, the script will try to download it automatically. Otherwise, you can provide the path by --ckpt /path/to/checkpoint.pt

If you have SLURM, run the following command

code
audio-aes input.jsonl --batch-size 100 --remote --array 5 --job-dir $HOME/slurm_logs/ --chunk 1000 > output.jsonl

Please adjust CPU & GPU settings using --slurm-gpu, --slurm-cpu depending on your nodes.

3. Output file will contain the same number of rows as input.jsonl. Each row contains 4 axes of prediction with a JSON-formatted dictionary. Check the following table for more info:

Axes name | Full name
|---|---|
CE | Content Enjoyment
CU | Content Usefulness
PC | Production Complexity
PQ | Production Quality

Output line example:

code
{"CE": 5.146, "CU": 5.779, "PC": 2.148, "PQ": 7.220}

4. (Extra) If you want to extract only one axis (i.e. CE), post-process the output file with the following command using jq utility:

``jq '.CE' output.jsonl > output-aes_ce.txt

code
### How to run prediction from Python script or interpreter

1. Infer from file path


from audiobox_aesthetics.infer import initialize_predictor
predictor = initialize_predictor()
predictor.forward([{"path":"/path/to/a.wav"}, {"path":"/path/to/b.flac"}])
code
2. Infer from torch tensor

from audiobox_aesthetics.infer import initialize_predictor
predictor = initialize_predictor()
wav, sr = torchaudio.load("/path/to/a.wav")
predictor.forward([{"path":wav, "sample_rate": sr}])
code
## Evaluation dataset
We released our evaluation dataset consisting of 4 axes of aesthetic annotation scores.

Here, we show an example of how to read and re-map each annotation to the actual audio file.


{
"data_path": "/your_path/LibriTTS/train-clean-100/1363/139304/1363_139304_000011_000000.wav",
"Production_Quality": [8.0, 8.0, 8.0, 8.0, 8.0, 9.0, 8.0, 5.0, 8.0, 8.0],
"Production_Complexity": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
"Content_Enjoyment": [8.0, 6.0, 8.0, 5.0, 8.0, 8.0, 8.0, 6.0, 8.0, 6.0],
"Content_Usefulness": [8.0, 6.0, 8.0, 7.0, 8.0, 9.0, 8.0, 6.0, 10.0, 7.0]
}
code
1. Recognize the dataset name from data_path. In the example, it is LibriTTS.
2. Replace "/your_path/" into your downloaded LibriTTS directory.
3. Each axis contains 10 scores annotated by 10 different human annotators.

data_path | URL
|---|---|
LibriTTS | https://openslr.org/60/
cv-corpus-13.0-2023-03-09 | https://commonvoice.mozilla.org/en/datasets
EARS | https://sp-uhh.github.io/ears_dataset/
MUSDB18 | https://sigsep.github.io/datasets/musdb.html
musiccaps | https://www.kaggle.com/datasets/googleai/musiccaps
(audioset) unbalanced_train_segments | https://research.google.com/audioset/dataset/index.html
PAM | https://zenodo.org/records/10737388

License

The majority of audiobox-aesthetics is licensed under CC-BY 4.0, as found in the LICENSE file. However, portions of the project are available under separate license terms: https://github.com/microsoft/unilm is licensed under MIT license.

Citation

If you found this repository useful, please cite the following BibTeX entry.
@article{tjandra2025aes, title={Meta Audiobox Aesthetics: Unified Automatic Quality Assessment for Speech, Music, and Sound}, author={Andros Tjandra and Yi-Chiao Wu and Baishan Guo and John Hoffman and Brian Ellis and Apoorv Vyas and Bowen Shi and Sanyuan Chen and Matt Le and Nick Zacharov and Carleigh Wood and Ann Lee and Wei-Ning Hsu}, year={2025}, url={https://arxiv.org/abs/2502.05139} }
``

Acknowledgements

Part of the model code is copied from https://github.com/microsoft/unilm/tree/master/wavlm.