You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+144Lines changed: 144 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,150 @@ Let's say the user wants to build a particular backend for a given platform. For
15
15
- The user may say they want to build AMD or ROCM instead of hipblas, or Intel instead of SYCL or NVIDIA insted of l4t or cublas. Ask for confirmation if there is ambiguity.
16
16
- Sometimes the user may need extra parameters to be added to `docker build` (e.g. `--platform` for cross-platform builds or `--progress` to view the full logs), in which case you can generate the `docker build` command directly.
17
17
18
+
## Adding a New Backend
19
+
20
+
When adding a new backend to LocalAI, you need to update several files to ensure the backend is properly built, tested, and registered. Here's a step-by-step guide based on the pattern used for adding backends like `moonshine`:
21
+
22
+
### 1. Create Backend Directory Structure
23
+
24
+
Create the backend directory under the appropriate location:
### 2. Add Build Configurations to `.github/workflows/backend.yml`
39
+
40
+
Add build matrix entries for each platform/GPU type you want to support. Look at similar backends (e.g., `chatterbox`, `faster-whisper`) for reference.
41
+
42
+
**Placement in file:**
43
+
- CPU builds: Add after other CPU builds (e.g., after `cpu-chatterbox`)
44
+
- CUDA 12 builds: Add after other CUDA 12 builds (e.g., after `gpu-nvidia-cuda-12-chatterbox`)
45
+
- CUDA 13 builds: Add after other CUDA 13 builds (e.g., after `gpu-nvidia-cuda-13-chatterbox`)
46
+
47
+
**Additional build types you may need:**
48
+
- ROCm/HIP: Use `build-type: 'hipblas'` with `base-image: "rocm/dev-ubuntu-24.04:6.4.4"`
49
+
- Intel/SYCL: Use `build-type: 'intel'` or `build-type: 'sycl_f16'`/`sycl_f32` with `base-image: "intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04"`
50
+
- L4T (ARM): Use `build-type: 'l4t'` with `platforms: 'linux/arm64'` and `runs-on: 'ubuntu-24.04-arm'`
51
+
52
+
### 3. Add Backend Metadata to `backend/index.yaml`
53
+
54
+
**Step 3a: Add Meta Definition**
55
+
56
+
Add a YAML anchor definition in the `## metas` section (around line 2-300). Look for similar backends to use as a template such as `diffusers` or `chatterbox`
57
+
58
+
**Step 3b: Add Image Entries**
59
+
60
+
Add image entries at the end of the file, following the pattern of similar backends such as `diffusers` or `chatterbox`. Include both `latest` (production) and `master` (development) tags.
61
+
62
+
### 4. Update the Makefile
63
+
64
+
The Makefile needs to be updated in several places to support building and testing the new backend:
65
+
66
+
**Step 4a: Add to `.NOTPARALLEL`**
67
+
68
+
Add `backends/<backend-name>` to the `.NOTPARALLEL` line (around line 2) to prevent parallel execution conflicts:
0 commit comments