Skip to content
ModelListedExternal
Download

Ced Small

CED are simple ViT-Transformer-based models for audio tagging, achieving sota performance on Audioset.

KindOtherVersionRevision 06bb40cBgrade

Model source

Kind
Other
File size
21.7–82.5 MB
Version
vRevision 06bb40c
Updated
Sep 22, 2026
Downloads
4K
Source
Hugging Face

Source description

CED-Small Model

CED are simple ViT-Transformer-based models for audio tagging, achieving sota performance on Audioset.

ModelParameters (M)AS-20K (mAP)AS-2M (mAP)
CED-Tiny5.536.548.1
CED-Mini9.638.549.0
CED-Small2241.649.6
CED-Base8644.050.0

Notable differences from other available models include:

  1. Simplification for finetuning: Batchnormalization of Mel-Spectrograms. During finetuning one does not need to first compute mean/variance over the dataset, which is common for AST.
  2. Support for variable length inputs. Most other models use a static time-frequency position embedding, which hinders the model's generalization to segments shorter than 10s. Many previous transformers simply pad their input to 10s in order to avoid the performance impact, which in turn slows down training/inference drastically.
  3. Training/Inference speedup: 64-dimensional mel-filterbanks and 16x16 patches without overlap, leading to 248 patches from a 10s spectrogram. In comparison, AST uses 128 mel-filterbanks with 16x16 (10x10 overlap) convolution, leading to 1212 patches during training/inference. CED-Tiny runs on a common CPU as fast as a comparable MobileNetV3.
  4. Performance: CED with 10M parameters outperforms the majority of previous approaches (~80M).

Model Sources

Inference

>>> from transformers import AutoModelForAudioClassification, AutoFeatureExtractor

>>> model_name = "mispeech/ced-small"
>>> feature_extractor = AutoFeatureExtractor.from_pretrained(model_name, trust_remote_code=True)
>>> model = AutoModelForAudioClassification.from_pretrained(model_name, trust_remote_code=True)

>>> import torchaudio
>>> audio, sampling_rate = torchaudio.load("/path-to/JeD5V5aaaoI_931_932.wav")
>>> assert sampling_rate == 16000
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")

>>> import torch
>>> with torch.no_grad():
...     logits = model(**inputs).logits

>>> predicted_class_id = torch.argmax(logits, dim=-1).item()
>>> model.config.id2label[predicted_class_id]
'Finger snapping'

Inference (Onnx)

>>> from optimum.onnxruntime import ORTModelForAudioClassification

>>> model_name = "mispeech/ced-small"
>>> model = ORTModelForAudioClassification.from_pretrained(model_name, trust_remote_code=True)

>>> import torchaudio
>>> audio, sampling_rate = torchaudio.load("/path-to/JeD5V5aaaoI_931_932.wav")
>>> assert sampling_rate == 16000
>>> input_name = model.session.get_inputs()[0].name
>>> output = model(**{input_name: torch.randn(1, 16000)})
>>> logits = output.logits.squeeze()
>>> for idx in logits.argsort()[-2:][::-1]:
>>>   print(f"{model.config.id2label[idx]}: {logits[idx]:.4f}")
'Finger snapping: 0.9155'
'Slap: 0.0567'

Fine-tuning

example_finetune_esc50.ipynb demonstrates how to train a linear head on the ESC-50 dataset with the CED encoder frozen.

Sources

1 source
Hugging FacePrimaryVersion 06bb40c5ec089e96867ebc5246be02441f4a71e4
huggingface.co/mispeech/ced-small/tree/06bb40c5ec089e96867ebc5246be02441f4a71e4

Verified Sep 6

Model artifacts

2 artifacts

model.onnx

onnx · 21.7 MB · SHA-256 18fa4fa30c18…ff75 · Hugging Face

Download

model.safetensors

safetensors · 82.5 MB · SHA-256 a495e319a620…0c71 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: apache-2.0 datasets: - AudioSet metrics: - mAP pipeline_tag: audio-classification --- # CED-Small Model CED are simple ViT-Transformer-based models for audio tagging, achieving **sota** performance on Audioset. | Model | Parameters (M) | AS-20K (mAP) | AS-2M (mAP) | |------|-------|-------|-------| | CED-Tiny | 5.5 | 36.5 | 48.1 | | CED-Mini | 9.6 | 38.5 | 49.0 | | CED-Small| 22 | 41.6 | 49.6 | | CED-Base | 86 | 44.0 | 50.0 | Notable differences from other available models include: 1. Simplification for finetuning: Batchnormalization of Mel-Spectrograms. During finetuning one does not need to first compute mean/variance over the dataset, which is common for AST. 1. Support for variable length inputs. Most other models use a static time-frequency position embedding, which hinders the model's generalization to segments shorter than 10s. Many previous transformers simply pad their input to 10s in order to avoid the performance impact, which in turn slows down training/inference drastically. 1. Training/Inference speedup: 64-dimensional mel-filterbanks and 16x16 patches without overlap, leading to 248 patches from a 10s spectrogram. In comparison, AST uses 128 mel-filterbanks with 16x16 (10x10 overlap) convolution, leading to 1212 patches during training/inference. CED-Tiny runs on a common CPU as fast as a comparable MobileNetV3. 1. Performance: CED with 10M parameters outperforms the majority of previous approaches (~80M). ### Model Sources - **Repository:** https://github.com/RicherMans/CED - **Paper:** [CED: Consistent ensemble distillation for audio tagging](https://arxiv.org/abs/2308.11957) - **Demo:** https://huggingface.co/spaces/mispeech/ced-base ## Inference ```python >>> from transformers import AutoModelForAudioClassification, AutoFeatureExtractor >>> model_name = "mispeech/ced-small" >>> feature_extractor = AutoFeatureExtractor.from_pretrained(model_name, trust_remote_code=True) >>> model = AutoModelForAudioClassification.from_pretrained(model_name, trust_remote_code=True) >>> import torchaudio >>> audio, sampling_rate = torchaudio.load("/path-to/JeD5V5aaaoI_931_932.wav") >>> assert sampling_rate == 16000 >>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt") >>> import torch >>> with torch.no_grad(): ... logits = model(**inputs).logits >>> predicted_class_id = torch.argmax(logits, dim=-1).i...

Source context: 3974 downloads · 0 likes · Pipeline audio-classification · Library transformers · Repo mispeech/ced-small