RepositoryPythonFRFrance
Labbeti

Labbeti/aac-datasets

Audio Captioning datasets for PyTorch.

130stars
9forks
0issues
0views

Audio Captioning datasets for PyTorch

Python PyTorch Code style: black Build Documentation Status

Audio Captioning unofficial datasets source code for AudioCaps [1], Clotho [2], MACS [3], and WavCaps [4], designed for PyTorch.

Installation

pip install aac-datasets

If you want to check if the package has been installed and the version, you can use this command:

aac-datasets-info

Examples

Create Clotho dataset

from aac_datasets import Clotho

dataset = Clotho(root=".", download=True)
item = dataset[0]
audio, captions = item["audio"], item["captions"]
# audio: Tensor of shape (n_channels=1, audio_max_size)
# captions: list of str

Build PyTorch dataloader with Clotho

from torch.utils.data.dataloader import DataLoader
from aac_datasets import Clotho
from aac_datasets.utils.collate import BasicCollate

dataset = Clotho(root=".", download=True)
dataloader = DataLoader(dataset, batch_size=4, collate_fn=BasicCollate())

for batch in dataloader:
    # batch["audio"]: list of 4 tensors of shape (n_channels, audio_size)
    # batch["captions"]: list of 4 lists of str
    ...

Download datasets

To download a dataset, you can use download argument in dataset construction :

dataset = Clotho(root=".", subset="dev", download=True)

However, if you want to download datasets from a script, you can also use the following command :

aac-datasets-download --root "." clotho --subsets "dev"

Datasets information

aac-datasets package contains 4 different datasets :

DatasetSampling
rate (kHz)
Estimated
size (GB)
SourceSubsets
AudioCaps3243AudioSettrain
val
test
train_fixed
Clotho44.153Freesounddev
val
eval
dcase_aac_test
dcase_aac_analysis
dcase_t2a_audio
dcase_t2a_captions
MACS4813TAU Urban Acoustic Scenes 2019full
WavCaps32941AudioSet
BBC Sound Effects
Freesound
SoundBible
audioset
audioset_no_audiocaps_v1
bbc
freesound
freesound_no_clotho_v2
soundbible

For Clotho, the dev subset should be used for training, val for validation and eval for testing.

Here is additional statistics of the train subsets from AudioCaps (v1), Clotho (v2.1), MACS and WavCaps:

AudioCaps/trainClotho/devMACS/fullWavCaps/full
Nb audios49,8383,8403,930403,050
Total audio duration (h)136.6124.010.97563.3
Audio duration range (s)0.5-1015-30101-67,109
Nb captions per audio152-51
Nb captions49,83819,19517,275403,050
Total nb words2402,482217,362160,0063,161,823
Sentence size22-528-205-402-38
Vocabulary247244369272124,600
Annotated byHumanHumanHumanMachine
Corrected byHumanHumanNoneNone

1 This duration is estimated on the total duration of 46230/49838 files of 126.7h.

2 The sentences are cleaned (lowercase+remove punctuation) and tokenized using the spacy tokenizer to count the words.

Requirements

This package has been developped for Ubuntu 20.04, and it is expected to work on most Linux-based distributions. It has been tested with Python versions 3.7 and 3.13.

Python packages

Python requirements are automatically installed when using pip on this repository.

torch >= 1.10.1
torchaudio >= 0.10.1
py7zr >= 0.17.2
pyyaml >= 6.0
tqdm >= 4.64.0
huggingface-hub >= 0.15.1
numpy >= 1.21.2

External requirements (AudioCaps only)

The external requirements needed to download AudioCaps are ffmpeg and yt-dlp. ffmpeg can be installed on Ubuntu using sudo apt install ffmpeg and yt-dlp from the official repo.

You can also override their paths for AudioCaps:

from aac_datasets import AudioCaps
dataset = AudioCaps(
    download=True,
    ffmpeg_path="/my/path/to/ffmpeg",
    ytdl_path="/my/path/to/ytdlp",
)

Since YouTube prevents bots to download videos, you might want to use ytdlp_opts argument to use cookies to overcome failed downloads, e.g. AudioCaps(ytdlp_opts=["--cookies-from-browser", "firefox"]). See more information on the documentation of yt-dlp.

Additional information

Compatibility with audiocaps-download

If you want to use audiocaps-download 1.0 package to download AudioCaps (v1 only), you will have to respect the AudioCaps folder tree:

from audiocaps_download import Downloader
root = "your/path/to/root"
downloader = Downloader(root_path=f"{root}/AUDIOCAPS/audio_32000Hz/", n_jobs=16)
downloader.download(format="wav")

Then disable audio download and set the correct audio format before init AudioCaps :

from aac_datasets import AudioCaps
dataset = AudioCaps(
    root=root,
    subset="train",
    download=True,
    audio_format="wav",
    download_audio=False,  # this will only download labels and metadata files
)

References

AudioCaps

[1] C. D. Kim, B. Kim, H. Lee, and G. Kim, “Audiocaps: Generating captions for audios in the wild,” in NAACL-HLT, 2019. Available: https://aclanthology.org/N19-1011/

Clotho

[2] K. Drossos, S. Lipping, and T. Virtanen, “Clotho: An Audio Captioning Dataset,” arXiv:1910.09387 [cs, eess], Oct. 2019, Available: http://arxiv.org/abs/1910.09387

MACS

[3] F. Font, A. Mesaros, D. P. W. Ellis, E. Fonseca, M. Fuentes, and B. Elizalde, Proceedings of the 6th Workshop on Detection and Classication of Acoustic Scenes and Events (DCASE 2021). Barcelona, Spain: Music Technology Group - Universitat Pompeu Fabra, Nov. 2021. Available: https://doi.org/10.5281/zenodo.5770113

WavCaps

[4] X. Mei et al., “WavCaps: A ChatGPT-Assisted Weakly-Labelled Audio Captioning Dataset for Audio-Language Multimodal Research,” arXiv preprint arXiv:2303.17395, 2023, [Online]. Available: https://arxiv.org/pdf/2303.17395.pdf

Cite the aac-datasets package

If you use this software, please consider cite it as "Labbe, E. (2025). aac-datasets: Audio Captioning datasets for PyTorch.", or use the following BibTeX citation:

@software{
    Labbe_aac_datasets_2025,
    author = {Labbé, Étienne},
    license = {MIT},
    month = {07},
    title = {{aac-datasets}},
    url = {https://github.com/Labbeti/aac-datasets/},
    version = {0.7.0},
    year = {2025}
}

See also

Contact

Maintainer:

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
keras-team/keras

Deep Learning for humans

64.5k
Dec 1, 2026
RepositoryPython
CorentinJ/Real-Time-Voice-Cloning

Clone a voice in 5 seconds to generate arbitrary speech in real-time

60.3k
Mar 9, 2026
RepositoryPython
coqui-ai/TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production

46.3k
Aug 16, 2024
RepositoryPython
OpenBMB/VoxCPM

VoxCPM2: Tokenizer-Free TTS for Multilingual Speech Generation, Creative Voice Design, and True-to-Life Cloning

43.1k
Nov 9, 2026
RepositoryPython
babysor/MockingBird

🚀Clone a voice in 5 seconds to generate arbitrary speech in real-time

36.9k
Mar 3, 2026
RepositoryJupyter Notebook
rasbt/LLMs-from-scratch

Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

109.4k
Nov 26, 2026
Modelautomatic-speech-recognition
openai/whisper-large-v3

Whisper Whisper is a state-of-the-art model for automatic speech recognition (ASR) and speech translation, proposed in the paper Robust Speech Recognition via Large-Scale Weak Supervision(https://huggingface.co/papers/2212.04356) by Alec Radford et...

♥0
3.0M
Aug 12, 2024
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
RepositoryPython
labmlai/annotated_deep_learning_paper_implementations

🧑‍🏫 60+ Implementations/tutorials of deep learning papers with side-by-side notes 📝; including transformers (original, xl, switch, feedback, vit, ...), optimizers (adam, adabelief, sophia, ...), gans(cyclegan, stylegan2, ...), 🎮 reinforcement learning (ppo, dqn), capsnet, distillation, ... 🧠

67.8k
Nov 2, 2026