Want to host ChatGPT alternative LocalAI yourself?
Run your own AI models on your own PC step-by-step
The promise of local AI fascinates me: the ability to run powerful AI models directly on my own hardware, without relying on cloud services. For me, this goes beyond just technical freedom; it also touches on the growing debate surrounding the ethical implications of AI, such as privacy, transparency, and the responsible use of these technologies. How can I ensure I maintain control and make ethically sound choices? My search for a concrete solution led me to LocalAI, and I'd like to share my initial experiences with it.
The Leap of Faith with LocalAI: The All-in-One Approach
services:
api:
image: localai/localai:latest-aio-cpu
# For a specific version:
#image: localai/localai:v2.29.0-aio-cpu
# For Nvidia GPUs decomment one of the following (cuda11 or cuda12):
#image: localai/localai:v2.29.0-aio-gpu-nvidia-cuda-11
# image: localai/localai:v2.29.0-aio-gpu-nvidia-cuda-12
#image: localai/localai:latest-aio-gpu-nvidia-cuda-11
#image: localai/localai:latest-aio-gpu-nvidia-cuda-12
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]
interval: 5m
timeout: 20m
retries: 5
ports:
- 8510:8080
environment:
- DEBUG=true
# ...
volumes:
- /mnt/localai/models:/models:cached
# decomment the following piece if running with Nvidia GPUs
#deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"Don't forget to restart the Docker daemon.
Exploring the Local AI Environment
After the initial setup and downloading the base models, the LocalAI web interface opened. This is where the magic happens. I could view all the components clearly and immediately start downloading new models.
Curious about the performance of specific models, I immediately downloaded Google's latest local AI model, Gemma-3 ( gemma-3-1b-it ). This model works surprisingly smoothly when asking a question. The response was fast and accurate, which bodes well for future experiments.