ced gguf
简介
核心亮点
- GGUF 格式支持,极低内存占用,端侧部署友好
- 专注于音频分类,实现快速的声音类别识别
- Apache-2.0 协议,支持商业化自由集成
- 无需高性能 GPU,在普通 CPU 上即可流畅运行
使用方法
# 安装 Hugging Face transformers
pip install transformers torch
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("mudler/ced-gguf")
tokenizer = AutoTokenizer.from_pretrained("mudler/ced-gguf")
Hugging Face 下载
我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 huggingface_hub:
pip install -U huggingface_hub
命令行下载
下载完整模型库
huggingface-cli download mudler/ced-gguf
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download mudler/ced-gguf config.json --local-dir ./dir
SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('mudler/ced-gguf')
Git 下载
请确保 lfs 已经被正确安装
git lfs install
git clone https://huggingface.co/mudler/ced-gguf
如果您希望跳过 lfs 大文件下载,可以使用如下命令
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/mudler/ced-gguf
模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。
PyTorch / Transformers 使用
安装 Transformers
pip install -U transformers torch
模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('mudler/ced-gguf')
tokenizer = AutoTokenizer.from_pretrained('mudler/ced-gguf')
模型下载
我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 ModelScope:
pip install modelscope
命令行下载
下载完整模型库
modelscope download --model mudler/ced-gguf
下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model mudler/ced-gguf README.md --local_dir ./dir
SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('mudler/ced-gguf')
Git 下载
请确保 lfs 已经被正确安装
git lfs install
git clone https://www.modelscope.cn/mudler/ced-gguf.git
如果您希望跳过 lfs 大文件下载,可以使用如下命令
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/mudler/ced-gguf.git
ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。
Notebook 快速开发
下载并安装 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', 'mudler/ced-gguf')
完整文档
---
license: apache-2.0
library_name: ced.cpp
pipeline_tag: audio-classification
tags:
- audio-classification
- sound-event-detection
- audio-tagging
- audioset
- ggml
- gguf
- ced
base_model:
- mispeech/ced-tiny
- mispeech/ced-mini
- mispeech/ced-small
- mispeech/ced-base
---
CED (GGUF) for ced.cpp / LocalAI
GGUF quantizations of the CED family (Consistent Ensemble Distillation,
Xiaomi) - SOTA-tier audio-tagging models that classify everyday sounds (baby
cry, footsteps, glass breaking, alarms, dog bark, ...) into the 527-class
AudioSet ontology.
These files run with ced.cpp, a
standalone C++/ggml port (no Python, no
PyTorch at inference), and with LocalAI
via the ced backend. Converted from the mispeech/ced-* checkpoints
(Apache-2.0). CED is a plain AST/DeiT Vision Transformer over a log-mel
spectrogram; the port is numerically equal to the PyTorch reference.
Files
One self-contained GGUF per size + quant (config, 527 labels, and the mel
filterbank/window are all embedded). Pick by your accuracy/size budget:
| size | params | f16 | q8_0 | f32 |
|------|--------|-----|------|-----|
| tiny | 5.5M | ced-tiny-f16.gguf (11 MB) | ced-tiny-q8_0.gguf (6 MB) | - |
| mini | 9.6M | ced-mini-f16.gguf (19 MB) | ced-mini-q8_0.gguf (11 MB) | - |
| small | 22M | ced-small-f16.gguf (42 MB) | ced-small-q8_0.gguf (23 MB)| - |
| base | 86M | ced-base-f16.gguf (165 MB) | ced-base-q8_0.gguf (88 MB) | ced-base-f32.gguf (328 MB) |
tiny/q8_0 (6 MB) is ideal for Raspberry-Pi-class CPUs; base/f16 is the
accuracy default.
Parity vs PyTorch (ced-base, end-to-end probs)
| quant | max abs diff | top-5 tags |
|-------|--------------|------------|
| f32 | 1.7e-7 | identical |
| f16 | 6.4e-5 | identical |
| q8_0 | 6.0e-3 | identical |
Performance (CPU, ced-base, 10s clip, Ryzen 9 9950X3D, 4 threads)
| | latency | realtime factor | peak RSS |
|---|---|---|---|
| PyTorch (transformers, f32) | 155.7 ms | 65x | 717 MB |
| ced.cpp f16 | 100.6 ms | 100x | 189 MB |
| ced.cpp q8_0 | 117.2 ms | 86x | 111 MB |
ced.cpp f16 is ~1.55x faster than the PyTorch reference; q8_0 uses ~6.5x less
memory.
Usage
ced-cli classify ced-base-f16.gguf clip.wav --top-k 5
0.87 Baby cry, infant cry
0.12 Crying, sobbing
In LocalAI: install the ced backend, configure a model with one of these
GGUFs, then call POST /v1/audio/classification (or stream over the realtime
websocket API for live recognition).
License
Model weights: Apache-2.0 (© Xiaomi Corporation; from the mispeech/ced-*
checkpoints). AudioSet labels are CC-BY-4.0. The ced.cpp inference code is MIT.