Skip to content

Commit 680b7a4

Browse files
authored
Merge branch 'master' into feat/detokenize-endpoint
2 parents a3985e7 + 7226bb9 commit 680b7a4

94 files changed

Lines changed: 4382 additions & 318 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/adding-backends.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,27 @@ docker-build-backends: ... docker-build-<backend-name>
198198
- If the backend is in `backend/python/<backend-name>/` but uses `.` as context in the workflow file, use `.` context
199199
- Check similar backends to determine the correct context
200200

201+
## Documenting the backend (README + docs)
202+
203+
A backend is not "added" until it is discoverable. Update the user-facing docs:
204+
205+
- **`docs/content/features/backends.md`** - add the backend to the right
206+
category in the "LocalAI supports various types of backends" list (and add a
207+
new category if it introduces a new modality, e.g. sound classification).
208+
- If the backend introduces a **new API surface** (a new endpoint or a realtime
209+
capability), document it under `docs/content/` where its area lives (audio,
210+
vision, etc.) and follow the api-endpoints checklist in
211+
[api-endpoints-and-auth.md](api-endpoints-and-auth.md).
212+
213+
**If the backend is a native C/C++/GGML engine created and maintained by the
214+
LocalAI team** (a from-scratch port like `parakeet.cpp`, `ced.cpp`,
215+
`vibevoice.cpp`, `rf-detr.cpp`, not a wrapper around a third-party runtime), it
216+
ALSO belongs in the top-level **`README.md`** table under "native C/C++/GGML
217+
engines ... developed and maintained by the LocalAI project itself". Add a row
218+
linking the upstream engine repo with a one-line description. This is the
219+
project's showcase of its own engines; a new in-house backend that is missing
220+
from it is a documentation bug.
221+
201222
## 5. Verification Checklist
202223

203224
After adding a new backend, verify:
@@ -211,6 +232,8 @@ After adding a new backend, verify:
211232
- [ ] No YAML syntax errors (check with linter)
212233
- [ ] No Makefile syntax errors (check with linter)
213234
- [ ] Follows the same pattern as similar backends (e.g., if it's a transcription backend, follow `faster-whisper` pattern)
235+
- [ ] Documented: added to the category list in `docs/content/features/backends.md` (and any new endpoint/realtime capability documented under `docs/content/`)
236+
- [ ] If it is an in-house native C/C++/GGML engine, added to the maintained-engines table in the top-level `README.md`
214237

215238
## Bundling runtime shared libraries (`package.sh`)
216239

.github/backend-matrix.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,154 @@ include:
35753575
dockerfile: "./backend/Dockerfile.golang"
35763576
context: "./"
35773577
ubuntu-version: '2404'
3578+
# ced
3579+
- build-type: 'cublas'
3580+
cuda-major-version: "12"
3581+
cuda-minor-version: "8"
3582+
platforms: 'linux/amd64'
3583+
tag-latest: 'auto'
3584+
tag-suffix: '-gpu-nvidia-cuda-12-ced'
3585+
runs-on: 'ubuntu-latest'
3586+
base-image: "ubuntu:24.04"
3587+
skip-drivers: 'false'
3588+
backend: "ced"
3589+
dockerfile: "./backend/Dockerfile.golang"
3590+
context: "./"
3591+
ubuntu-version: '2404'
3592+
- build-type: 'cublas'
3593+
cuda-major-version: "13"
3594+
cuda-minor-version: "0"
3595+
platforms: 'linux/amd64'
3596+
tag-latest: 'auto'
3597+
tag-suffix: '-gpu-nvidia-cuda-13-ced'
3598+
runs-on: 'ubuntu-latest'
3599+
base-image: "ubuntu:24.04"
3600+
skip-drivers: 'false'
3601+
backend: "ced"
3602+
dockerfile: "./backend/Dockerfile.golang"
3603+
context: "./"
3604+
ubuntu-version: '2404'
3605+
- build-type: 'cublas'
3606+
cuda-major-version: "13"
3607+
cuda-minor-version: "0"
3608+
platforms: 'linux/arm64'
3609+
skip-drivers: 'false'
3610+
tag-latest: 'auto'
3611+
tag-suffix: '-nvidia-l4t-cuda-13-arm64-ced'
3612+
base-image: "ubuntu:24.04"
3613+
ubuntu-version: '2404'
3614+
runs-on: 'ubuntu-24.04-arm'
3615+
backend: "ced"
3616+
dockerfile: "./backend/Dockerfile.golang"
3617+
context: "./"
3618+
- build-type: ''
3619+
cuda-major-version: ""
3620+
cuda-minor-version: ""
3621+
platforms: 'linux/amd64'
3622+
platform-tag: 'amd64'
3623+
tag-latest: 'auto'
3624+
tag-suffix: '-cpu-ced'
3625+
runs-on: 'ubuntu-latest'
3626+
base-image: "ubuntu:24.04"
3627+
skip-drivers: 'false'
3628+
backend: "ced"
3629+
dockerfile: "./backend/Dockerfile.golang"
3630+
context: "./"
3631+
ubuntu-version: '2404'
3632+
- build-type: ''
3633+
cuda-major-version: ""
3634+
cuda-minor-version: ""
3635+
platforms: 'linux/arm64'
3636+
platform-tag: 'arm64'
3637+
tag-latest: 'auto'
3638+
tag-suffix: '-cpu-ced'
3639+
runs-on: 'ubuntu-24.04-arm'
3640+
base-image: "ubuntu:24.04"
3641+
skip-drivers: 'false'
3642+
backend: "ced"
3643+
dockerfile: "./backend/Dockerfile.golang"
3644+
context: "./"
3645+
ubuntu-version: '2404'
3646+
- build-type: 'sycl_f32'
3647+
cuda-major-version: ""
3648+
cuda-minor-version: ""
3649+
platforms: 'linux/amd64'
3650+
tag-latest: 'auto'
3651+
tag-suffix: '-gpu-intel-sycl-f32-ced'
3652+
runs-on: 'ubuntu-latest'
3653+
base-image: "intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04"
3654+
skip-drivers: 'false'
3655+
backend: "ced"
3656+
dockerfile: "./backend/Dockerfile.golang"
3657+
context: "./"
3658+
ubuntu-version: '2404'
3659+
- build-type: 'sycl_f16'
3660+
cuda-major-version: ""
3661+
cuda-minor-version: ""
3662+
platforms: 'linux/amd64'
3663+
tag-latest: 'auto'
3664+
tag-suffix: '-gpu-intel-sycl-f16-ced'
3665+
runs-on: 'ubuntu-latest'
3666+
base-image: "intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04"
3667+
skip-drivers: 'false'
3668+
backend: "ced"
3669+
dockerfile: "./backend/Dockerfile.golang"
3670+
context: "./"
3671+
ubuntu-version: '2404'
3672+
- build-type: 'vulkan'
3673+
cuda-major-version: ""
3674+
cuda-minor-version: ""
3675+
platforms: 'linux/amd64'
3676+
platform-tag: 'amd64'
3677+
tag-latest: 'auto'
3678+
tag-suffix: '-gpu-vulkan-ced'
3679+
runs-on: 'ubuntu-latest'
3680+
base-image: "ubuntu:24.04"
3681+
skip-drivers: 'false'
3682+
backend: "ced"
3683+
dockerfile: "./backend/Dockerfile.golang"
3684+
context: "./"
3685+
ubuntu-version: '2404'
3686+
- build-type: 'vulkan'
3687+
cuda-major-version: ""
3688+
cuda-minor-version: ""
3689+
platforms: 'linux/arm64'
3690+
platform-tag: 'arm64'
3691+
tag-latest: 'auto'
3692+
tag-suffix: '-gpu-vulkan-ced'
3693+
runs-on: 'ubuntu-24.04-arm'
3694+
base-image: "ubuntu:24.04"
3695+
skip-drivers: 'false'
3696+
backend: "ced"
3697+
dockerfile: "./backend/Dockerfile.golang"
3698+
context: "./"
3699+
ubuntu-version: '2404'
3700+
- build-type: 'cublas'
3701+
cuda-major-version: "12"
3702+
cuda-minor-version: "0"
3703+
platforms: 'linux/arm64'
3704+
skip-drivers: 'false'
3705+
tag-latest: 'auto'
3706+
tag-suffix: '-nvidia-l4t-arm64-ced'
3707+
base-image: "nvcr.io/nvidia/l4t-jetpack:r36.4.0"
3708+
runs-on: 'ubuntu-24.04-arm'
3709+
backend: "ced"
3710+
dockerfile: "./backend/Dockerfile.golang"
3711+
context: "./"
3712+
ubuntu-version: '2204'
3713+
- build-type: 'hipblas'
3714+
cuda-major-version: ""
3715+
cuda-minor-version: ""
3716+
platforms: 'linux/amd64'
3717+
tag-latest: 'auto'
3718+
tag-suffix: '-gpu-rocm-hipblas-ced'
3719+
base-image: "rocm/dev-ubuntu-24.04:7.2.1"
3720+
runs-on: 'ubuntu-latest'
3721+
skip-drivers: 'false'
3722+
backend: "ced"
3723+
dockerfile: "./backend/Dockerfile.golang"
3724+
context: "./"
3725+
ubuntu-version: '2404'
35783726
# acestep-cpp
35793727
- build-type: ''
35803728
cuda-major-version: ""
@@ -4754,6 +4902,10 @@ includeDarwin:
47544902
tag-suffix: "-metal-darwin-arm64-parakeet-cpp"
47554903
build-type: "metal"
47564904
lang: "go"
4905+
- backend: "ced"
4906+
tag-suffix: "-metal-darwin-arm64-ced"
4907+
build-type: "metal"
4908+
lang: "go"
47574909
- backend: "acestep-cpp"
47584910
tag-suffix: "-metal-darwin-arm64-acestep-cpp"
47594911
build-type: "metal"

.github/workflows/bump_deps.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
variable: "PARAKEET_VERSION"
4343
branch: "master"
4444
file: "backend/go/parakeet-cpp/Makefile"
45+
- repository: "mudler/ced.cpp"
46+
variable: "CED_VERSION"
47+
branch: "master"
48+
file: "backend/go/ced/Makefile"
4549
- repository: "mudler/depth-anything.cpp"
4650
variable: "DEPTHANYTHING_VERSION"
4751
branch: "master"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ Most backends wrap a best-in-class upstream engine. A handful of them are native
231231
| Backend | What it does |
232232
|---------|-------------|
233233
| [parakeet.cpp](https://github.com/mudler/parakeet.cpp) | C++/GGML port of NVIDIA NeMo Parakeet ASR (tdt/ctc/rnnt/hybrid), with cache-aware streaming transcription |
234+
| [ced.cpp](https://github.com/mudler/ced.cpp) | C++/GGML port of the CED audio-tagging models: sound-event classification (527-class AudioSet) over REST and the realtime API for live recognition |
234235
| [voxtral.c](https://github.com/mudler/voxtral.c) | Voxtral Realtime 4B speech-to-text in pure C |
235236
| [vibevoice.cpp](https://github.com/mudler/vibevoice.cpp) | Native port of Microsoft VibeVoice for TTS (voice cloning) and long-form ASR with speaker diarization |
236237
| [rf-detr.cpp](https://github.com/mudler/rf-detr.cpp) | Native RF-DETR object detection and instance segmentation |

backend/backend.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ service Backend {
2525
rpc Detokenize(DetokenizeRequest) returns (DetokenizeResponse) {}
2626
rpc Status(HealthMessage) returns (StatusResponse) {}
2727
rpc Detect(DetectOptions) returns (DetectResponse) {}
28+
// SoundDetection runs an audio-tagging / sound-event-classification model
29+
// (e.g. CED over the AudioSet ontology) on a clip and returns scored labels.
30+
rpc SoundDetection(SoundDetectionRequest) returns (SoundDetectionResponse) {}
2831
rpc Depth(DepthRequest) returns (DepthResponse) {}
2932
rpc FaceVerify(FaceVerifyRequest) returns (FaceVerifyResponse) {}
3033
rpc FaceAnalyze(FaceAnalyzeRequest) returns (FaceAnalyzeResponse) {}
@@ -680,6 +683,24 @@ message DetectResponse {
680683
repeated Detection Detections = 1;
681684
}
682685

686+
// --- Sound-event classification / audio tagging messages (CED) ---
687+
688+
message SoundDetectionRequest {
689+
string src = 1; // audio file path (LocalAI writes the upload to disk)
690+
int32 top_k = 2; // number of top tags to return (0 = all classes)
691+
float threshold = 3; // optional: drop tags scoring below this
692+
}
693+
694+
message SoundClass {
695+
string label = 1; // AudioSet class name, e.g. "Baby cry, infant cry"
696+
float score = 2; // per-class probability (multi-label, independent)
697+
int32 index = 3; // class index in the model ontology
698+
}
699+
700+
message SoundDetectionResponse {
701+
repeated SoundClass detections = 1; // score-descending
702+
}
703+
683704
// --- Depth estimation messages (Depth Anything 3) ---
684705

685706
message DepthRequest {

backend/cpp/ik-llama-cpp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
IK_LLAMA_VERSION?=d47f484d299cafad2e606afc0d31677a91b242d0
2+
IK_LLAMA_VERSION?=6c00e87ac84404af588ad2e65935bd6f079c696f
33
LLAMA_REPO?=https://github.com/ikawrakow/ik_llama.cpp
44

55
CMAKE_ARGS?=

backend/cpp/llama-cpp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
LLAMA_VERSION?=e475fa2b5f9fb50c3d6fc3e7c6fdf1e004465b62
2+
LLAMA_VERSION?=7c082bc417bbe53210a83df4ba5b49e18ce6193c
33
LLAMA_REPO?=https://github.com/ggerganov/llama.cpp
44

55
CMAKE_ARGS?=

backend/go/ced/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.cache/
2+
sources/
3+
build/
4+
package/
5+
ced-grpc
6+
# build artifacts staged in-tree by the Makefile (cp from sources/) or
7+
# symlinked for local dev; the real sources live in ced.cpp upstream.
8+
*.so
9+
*.so.*
10+
ced_capi.h
11+
compile_commands.json

backend/go/ced/Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# ced sound-classification backend Makefile.
2+
#
3+
# Upstream pin lives below as CED_VERSION?=<sha> so .github/bump_deps.sh can find
4+
# and update it (matches the parakeet-cpp / whisper.cpp convention).
5+
#
6+
# Local dev shortcut: symlink an out-of-tree ced.cpp shared build + header and
7+
# skip the clone/cmake steps entirely:
8+
# ln -sf /path/to/ced.cpp/build-shared/libced.so .
9+
# ln -sf /path/to/ced.cpp/include/ced_capi.h .
10+
# go build -o ced-grpc .
11+
12+
CED_VERSION?=c04ac14b7992d00584d9e812c9bb6268598a6ce7
13+
CED_REPO?=https://github.com/mudler/ced.cpp
14+
15+
GOCMD?=go
16+
GO_TAGS?=
17+
JOBS?=$(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
18+
19+
BUILD_TYPE?=
20+
NATIVE?=false
21+
22+
# Static-link ggml into libced.so (PIC) so the shared lib is self-contained:
23+
# dlopen needs no libggml*.so alongside it, only system libs the runtime image
24+
# already provides.
25+
CMAKE_ARGS?=-DCMAKE_BUILD_TYPE=Release -DCED_SHARED=ON -DCED_BUILD_CLI=OFF -DCED_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
26+
27+
ifeq ($(NATIVE),false)
28+
CMAKE_ARGS+=-DGGML_NATIVE=OFF
29+
endif
30+
31+
# ced.cpp gates its ggml backends behind CED_GGML_* options (set(... CACHE BOOL
32+
# "" FORCE)), so forward those instead of a bare -DGGML_CUDA=ON.
33+
ifeq ($(BUILD_TYPE),cublas)
34+
CMAKE_ARGS+=-DCED_GGML_CUDA=ON -DGGML_CUDA_GRAPHS=ON
35+
else ifeq ($(BUILD_TYPE),openblas)
36+
CMAKE_ARGS+=-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
37+
else ifeq ($(BUILD_TYPE),hipblas)
38+
CMAKE_ARGS+=-DCED_GGML_HIP=ON
39+
else ifeq ($(BUILD_TYPE),vulkan)
40+
CMAKE_ARGS+=-DCED_GGML_VULKAN=ON
41+
endif
42+
43+
.PHONY: ced-grpc package build clean purge test all
44+
45+
all: ced-grpc
46+
47+
sources/ced.cpp:
48+
mkdir -p sources/ced.cpp
49+
cd sources/ced.cpp && \
50+
git init -q && \
51+
git remote add origin $(CED_REPO) && \
52+
git fetch --depth 1 origin $(CED_VERSION) && \
53+
git checkout FETCH_HEAD && \
54+
git submodule update --init --recursive --depth 1 --single-branch
55+
56+
libced.so: sources/ced.cpp
57+
cmake -B sources/ced.cpp/build-shared -S sources/ced.cpp $(CMAKE_ARGS)
58+
cmake --build sources/ced.cpp/build-shared --config Release -j$(JOBS)
59+
cp -fv sources/ced.cpp/build-shared/libced.so* ./ 2>/dev/null || true
60+
cp -fv sources/ced.cpp/include/ced_capi.h ./
61+
62+
ced-grpc: libced.so main.go goced.go
63+
CGO_ENABLED=0 $(GOCMD) build -tags "$(GO_TAGS)" -o ced-grpc .
64+
65+
package: ced-grpc
66+
bash package.sh
67+
68+
build: package
69+
70+
test:
71+
LD_LIBRARY_PATH=$(CURDIR):$$LD_LIBRARY_PATH $(GOCMD) test ./... -count=1
72+
73+
clean: purge
74+
rm -rf libced.so* ced_capi.h package ced-grpc
75+
76+
purge:
77+
rm -rf sources/ced.cpp

0 commit comments

Comments
 (0)