Skip to content
SumGuy's Ramblings
Go back

Unleash the Power of LLMs with LocalAI

LocalAI is a remarkable open-source project that unlocks the potential of large language models (LLMs) and brings them directly to your own hardware. Think of it as a locally-hosted, self-contained alternative to cloud-based AI solutions like OpenAI’s GPT-3. With LocalAI, you gain:

What Can You Do with LocalAI?

LocalAI’s capabilities closely mirror those of cloud-based AI APIs, including:

Why Choose LocalAI?

Streamlined Installation with Docker

While installing LocalAI’s dependencies directly is possible, Docker significantly simplifies the process:

Exploring LocalAI

LocalAI provides both a web interface and a REST API. Start experimenting with different models and discover the incredible capabilities of LLMs on your own machine. The LocalAI documentation offers in-depth guidance.

Docker compose

This docker compose

services:
  localai:
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    image: quay.io/go-skynet/local-ai:master-cublas-cuda12-ffmpeg
    container_name: localai
    tty: true # enable colorized logs
    restart: unless-stopped
    ports:
      - 8080:8080
    env_file:
      - .env
    volumes:
      - ./models:/models:cached
      - ./images/:/tmp/generated/images/
    environment:
      - 'PRELOAD_MODELS=[{"url": "github:go-skynet/model-gallery/gpt4all-j.yaml", "name": "gpt-3.5-turbo"},{"url": "github:go-skynet/model-gallery/mixtral-Q3.yaml", "name": "mixtral-Q3"},{"url": "github:go-skynet/model-gallery/stablediffusion.yamll", "name": "stablediffusion"},{"url": "github:go-skynet/model-gallery/whisper-base.yaml", "name": "whisper"}]'
      - MODELS_PATH=/models
    command: ["/usr/bin/local-ai" ]
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]
      interval: 1m
      timeout: 20m
      retries: 20

Docker compose explanation

services:

deploy:

image: quay.io/go-skynet/local-ai:master-cublas-cuda12-ffmpeg

container_name: localai

tty: true

restart: unless-stopped

ports:

env_file:

volumes:

environment:

command: [“/usr/bin/local-ai”]

healthcheck:

LocalAI provides a variety of Docker images to accommodate different hardware setups and model preferences. You can select the most suitable image by adjusting the image tag in your docker-compose.yml file. Here’s a breakdown of some common options:

Latest Development Versions:

quay.io/go-skynet/local-ai:master-cublas-cuda12 or quay.io/go-skynet/local-ai:master-cublas-cuda11: These images offer the latest features and models from the development branch. Choose the CUDA version (11 or 12) that matches your NVIDIA GPU. quay.io/go-skynet/local-ai:master: This image is for CPU-only systems without a compatible NVIDIA GPU. Stable Releases:

quay.io/go-skynet/local-ai:latest-cublas-cuda12 or quay.io/go-skynet/local-ai:latest-cublas-cuda11: These images provide tested and stable functionality, along with GPU support (choose the matching CUDA version). quay.io/go-skynet/local-ai:latest: Use this image if you don’t have a GPU. Important Notes:

GPU Acceleration: CUDA-enabled images are specifically designed for systems with a compatible NVIDIA GPU. Development vs. Stable: Choose development images if you want the absolute latest features but are willing to accept a potentially less stable experience. For the most reliable setup, use the stable releases.

Conclusion

LocalAI empowers developers, enthusiasts, and businesses to harness the power of AI in a private, flexible, and cost-effective manner. Its easy integration with Docker further enhances its usability. If you’re seeking to leverage large language models in your projects or research, LocalAI is an invaluable tool to explore.


Share this post on:

Previous Post
Ollama: Powerful Language Models on Your Own Machine
Next Post
Understanding PostgreSQL Connection URIs