Skip to content

Commit 111bbde

Browse files
committed
feat: implement Unsloth fine-tuning backend phases 2-7
- Add Python unsloth backend with QLoRA/LoRA/full fine-tuning support - Implement Go service layer for job management - Add HTTP API endpoints for fine-tuning jobs - Integrate GGUF export functionality - Update CI/build configuration Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
1 parent e0fcc5a commit 111bbde

21 files changed

Lines changed: 1364 additions & 16 deletions

.github/workflows/backend.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ jobs:
7979
dockerfile: "./backend/Dockerfile.python"
8080
context: "./"
8181
ubuntu-version: '2404'
82+
- build-type: ''
83+
cuda-major-version: ""
84+
cuda-minor-version: ""
85+
platforms: 'linux/amd64'
86+
tag-latest: 'auto'
87+
tag-suffix: '-cpu-unsloth'
88+
runs-on: 'ubuntu-latest'
89+
base-image: "ubuntu:24.04"
90+
skip-drivers: 'true'
91+
backend: "unsloth"
92+
dockerfile: "./backend/Dockerfile.python"
93+
context: "./"
94+
ubuntu-version: '2404'
8295
- build-type: ''
8396
cuda-major-version: ""
8497
cuda-minor-version: ""
@@ -444,6 +457,19 @@ jobs:
444457
dockerfile: "./backend/Dockerfile.python"
445458
context: "./"
446459
ubuntu-version: '2404'
460+
- build-type: 'cublas'
461+
cuda-major-version: "12"
462+
cuda-minor-version: "8"
463+
platforms: 'linux/amd64'
464+
tag-latest: 'auto'
465+
tag-suffix: '-gpu-nvidia-cuda-12-unsloth'
466+
runs-on: 'ubuntu-latest'
467+
base-image: "ubuntu:24.04"
468+
skip-drivers: 'false'
469+
backend: "unsloth"
470+
dockerfile: "./backend/Dockerfile.python"
471+
context: "./"
472+
ubuntu-version: '2404'
447473
- build-type: 'cublas'
448474
cuda-major-version: "12"
449475
cuda-minor-version: "8"
@@ -965,6 +991,19 @@ jobs:
965991
dockerfile: "./backend/Dockerfile.python"
966992
context: "./"
967993
ubuntu-version: '2404'
994+
- build-type: 'cublas'
995+
cuda-major-version: "13"
996+
cuda-minor-version: "0"
997+
platforms: 'linux/amd64'
998+
tag-latest: 'auto'
999+
tag-suffix: '-gpu-nvidia-cuda-13-unsloth'
1000+
runs-on: 'ubuntu-latest'
1001+
base-image: "ubuntu:24.04"
1002+
skip-drivers: 'false'
1003+
backend: "unsloth"
1004+
dockerfile: "./backend/Dockerfile.python"
1005+
context: "./"
1006+
ubuntu-version: '2404'
9681007
- build-type: 'cublas'
9691008
cuda-major-version: "13"
9701009
cuda-minor-version: "0"

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Disable parallel execution for backend builds
2-
.NOTPARALLEL: backends/diffusers backends/llama-cpp backends/outetts backends/piper backends/stablediffusion-ggml backends/whisper backends/faster-whisper backends/silero-vad backends/local-store backends/huggingface backends/rfdetr backends/kitten-tts backends/kokoro backends/chatterbox backends/llama-cpp-darwin backends/neutts build-darwin-python-backend build-darwin-go-backend backends/mlx backends/diffuser-darwin backends/mlx-vlm backends/mlx-audio backends/mlx-distributed backends/stablediffusion-ggml-darwin backends/vllm backends/vllm-omni backends/moonshine backends/pocket-tts backends/qwen-tts backends/faster-qwen3-tts backends/qwen-asr backends/nemo backends/voxcpm backends/whisperx backends/ace-step backends/acestep-cpp backends/fish-speech backends/voxtral backends/opus
2+
.NOTPARALLEL: backends/diffusers backends/llama-cpp backends/outetts backends/piper backends/stablediffusion-ggml backends/whisper backends/faster-whisper backends/silero-vad backends/local-store backends/huggingface backends/rfdetr backends/kitten-tts backends/kokoro backends/chatterbox backends/llama-cpp-darwin backends/neutts build-darwin-python-backend build-darwin-go-backend backends/mlx backends/diffuser-darwin backends/mlx-vlm backends/mlx-audio backends/mlx-distributed backends/stablediffusion-ggml-darwin backends/vllm backends/vllm-omni backends/moonshine backends/pocket-tts backends/qwen-tts backends/faster-qwen3-tts backends/qwen-asr backends/nemo backends/voxcpm backends/whisperx backends/ace-step backends/acestep-cpp backends/fish-speech backends/voxtral backends/opus backends/unsloth
33

44
GOCMD=go
55
GOTEST=$(GOCMD) test
@@ -421,6 +421,7 @@ prepare-test-extra: protogen-python
421421
$(MAKE) -C backend/python/voxcpm
422422
$(MAKE) -C backend/python/whisperx
423423
$(MAKE) -C backend/python/ace-step
424+
$(MAKE) -C backend/python/unsloth
424425

425426
test-extra: prepare-test-extra
426427
$(MAKE) -C backend/python/transformers test
@@ -440,6 +441,7 @@ test-extra: prepare-test-extra
440441
$(MAKE) -C backend/python/voxcpm test
441442
$(MAKE) -C backend/python/whisperx test
442443
$(MAKE) -C backend/python/ace-step test
444+
$(MAKE) -C backend/python/unsloth test
443445

444446
DOCKER_IMAGE?=local-ai
445447
IMAGE_TYPE?=core
@@ -571,6 +573,7 @@ BACKEND_NEMO = nemo|python|.|false|true
571573
BACKEND_VOXCPM = voxcpm|python|.|false|true
572574
BACKEND_WHISPERX = whisperx|python|.|false|true
573575
BACKEND_ACE_STEP = ace-step|python|.|false|true
576+
BACKEND_UNSLOTH = unsloth|python|.|false|true
574577
BACKEND_MLX_DISTRIBUTED = mlx-distributed|python|./|false|true
575578

576579
# Helper function to build docker image for a backend
@@ -627,14 +630,15 @@ $(eval $(call generate-docker-build-target,$(BACKEND_NEMO)))
627630
$(eval $(call generate-docker-build-target,$(BACKEND_VOXCPM)))
628631
$(eval $(call generate-docker-build-target,$(BACKEND_WHISPERX)))
629632
$(eval $(call generate-docker-build-target,$(BACKEND_ACE_STEP)))
633+
$(eval $(call generate-docker-build-target,$(BACKEND_UNSLOTH)))
630634
$(eval $(call generate-docker-build-target,$(BACKEND_ACESTEP_CPP)))
631635
$(eval $(call generate-docker-build-target,$(BACKEND_MLX_DISTRIBUTED)))
632636

633637
# Pattern rule for docker-save targets
634638
docker-save-%: backend-images
635639
docker save local-ai-backend:$* -o backend-images/$*.tar
636640

637-
docker-build-backends: docker-build-llama-cpp docker-build-rerankers docker-build-vllm docker-build-vllm-omni docker-build-transformers docker-build-outetts docker-build-diffusers docker-build-kokoro docker-build-faster-whisper docker-build-coqui docker-build-chatterbox docker-build-vibevoice docker-build-moonshine docker-build-pocket-tts docker-build-qwen-tts docker-build-fish-speech docker-build-faster-qwen3-tts docker-build-qwen-asr docker-build-nemo docker-build-voxcpm docker-build-whisperx docker-build-ace-step docker-build-acestep-cpp docker-build-voxtral docker-build-mlx-distributed
641+
docker-build-backends: docker-build-llama-cpp docker-build-rerankers docker-build-vllm docker-build-vllm-omni docker-build-transformers docker-build-outetts docker-build-diffusers docker-build-kokoro docker-build-faster-whisper docker-build-coqui docker-build-chatterbox docker-build-vibevoice docker-build-moonshine docker-build-pocket-tts docker-build-qwen-tts docker-build-fish-speech docker-build-faster-qwen3-tts docker-build-qwen-asr docker-build-nemo docker-build-voxcpm docker-build-whisperx docker-build-ace-step docker-build-acestep-cpp docker-build-voxtral docker-build-mlx-distributed docker-build-unsloth
638642

639643
########################################################
640644
### Mock Backend for E2E Tests

backend/index.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,25 @@
530530
nvidia-cuda-12: "cuda12-chatterbox"
531531
nvidia-l4t-cuda-12: "nvidia-l4t-arm64-chatterbox"
532532
nvidia-l4t-cuda-13: "cuda13-nvidia-l4t-arm64-chatterbox"
533+
- &unsloth
534+
urls:
535+
- https://github.com/unslothai/unsloth
536+
description: |
537+
Fine-tuning backend powered by Unsloth. Supports QLoRA, LoRA, and full fine-tuning
538+
of LLMs with 2x faster training and 70% less memory. Includes GGUF export support.
539+
tags:
540+
- fine-tuning
541+
- training
542+
- lora
543+
- qlora
544+
license: apache-2.0
545+
name: "unsloth"
546+
alias: "unsloth"
547+
capabilities:
548+
nvidia: "cuda12-unsloth"
549+
default: "cpu-unsloth"
550+
nvidia-cuda-13: "cuda13-unsloth"
551+
nvidia-cuda-12: "cuda12-unsloth"
533552
- &vibevoice
534553
urls:
535554
- https://github.com/microsoft/VibeVoice
@@ -3029,3 +3048,41 @@
30293048
uri: "quay.io/go-skynet/local-ai-backends:master-metal-darwin-arm64-voxtral"
30303049
mirrors:
30313050
- localai/localai-backends:master-metal-darwin-arm64-voxtral
3051+
## unsloth
3052+
- !!merge <<: *unsloth
3053+
name: "unsloth-development"
3054+
capabilities:
3055+
nvidia: "cuda12-unsloth-development"
3056+
default: "cpu-unsloth-development"
3057+
nvidia-cuda-13: "cuda13-unsloth-development"
3058+
nvidia-cuda-12: "cuda12-unsloth-development"
3059+
- !!merge <<: *unsloth
3060+
name: "cpu-unsloth"
3061+
uri: "quay.io/go-skynet/local-ai-backends:latest-cpu-unsloth"
3062+
mirrors:
3063+
- localai/localai-backends:latest-cpu-unsloth
3064+
- !!merge <<: *unsloth
3065+
name: "cpu-unsloth-development"
3066+
uri: "quay.io/go-skynet/local-ai-backends:master-cpu-unsloth"
3067+
mirrors:
3068+
- localai/localai-backends:master-cpu-unsloth
3069+
- !!merge <<: *unsloth
3070+
name: "cuda12-unsloth"
3071+
uri: "quay.io/go-skynet/local-ai-backends:latest-gpu-nvidia-cuda-12-unsloth"
3072+
mirrors:
3073+
- localai/localai-backends:latest-gpu-nvidia-cuda-12-unsloth
3074+
- !!merge <<: *unsloth
3075+
name: "cuda12-unsloth-development"
3076+
uri: "quay.io/go-skynet/local-ai-backends:master-gpu-nvidia-cuda-12-unsloth"
3077+
mirrors:
3078+
- localai/localai-backends:master-gpu-nvidia-cuda-12-unsloth
3079+
- !!merge <<: *unsloth
3080+
name: "cuda13-unsloth"
3081+
uri: "quay.io/go-skynet/local-ai-backends:latest-gpu-nvidia-cuda-13-unsloth"
3082+
mirrors:
3083+
- localai/localai-backends:latest-gpu-nvidia-cuda-13-unsloth
3084+
- !!merge <<: *unsloth
3085+
name: "cuda13-unsloth-development"
3086+
uri: "quay.io/go-skynet/local-ai-backends:master-gpu-nvidia-cuda-13-unsloth"
3087+
mirrors:
3088+
- localai/localai-backends:master-gpu-nvidia-cuda-13-unsloth

backend/python/unsloth/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: unsloth
2+
unsloth:
3+
bash install.sh
4+
5+
.PHONY: run
6+
run: unsloth
7+
@echo "Running unsloth..."
8+
bash run.sh
9+
@echo "unsloth run."
10+
11+
.PHONY: test
12+
test: unsloth
13+
@echo "Testing unsloth..."
14+
bash test.sh
15+
@echo "unsloth tested."
16+
17+
.PHONY: protogen-clean
18+
protogen-clean:
19+
$(RM) backend_pb2_grpc.py backend_pb2.py
20+
21+
.PHONY: clean
22+
clean: protogen-clean
23+
rm -rf venv __pycache__

0 commit comments

Comments
 (0)