Running LLMs on a Raspberry Pi 5
Find a file
2026-01-10 17:27:35 -05:00
assets Pushing up new updates 2026-01-10 17:27:35 -05:00
device-stuff Pushing up new updates 2026-01-10 17:27:35 -05:00
scripts Pushing up new updates 2026-01-10 17:27:35 -05:00
src/local_chat Pushing up new updates 2026-01-10 17:27:35 -05:00
systemd Pushing up new updates 2026-01-10 17:27:35 -05:00
.gitignore Moved some files and added a missing dependency 2026-01-04 19:46:36 -05:00
LICENSE Initial commit 2025-12-30 18:19:55 -05:00
pyproject.toml Pushing up new updates 2026-01-10 17:27:35 -05:00
README.md Pushing up new updates 2026-01-10 17:27:35 -05:00
temp_audio_source.mp3 Pushing up new updates 2026-01-10 17:27:35 -05:00

Local LLM Chat Bot

A local voice-enabled chat bot running on DietPi (Raspberry Pi).

Prerequisites

  • OS: DietPi is recommended. See device-stuff for configuration files (diet-pi_config.txt, rpi_config.txt).

Installation

  1. Run Setup Script This script installs system dependencies (apt), Ollama, Piper TTS, and downloads necessary models.

    ./scripts/setup.sh
    
  2. Create Python Environment It is recommended to use --system-site-packages to allow access to system-level libraries installed via apt (like python3-lgpio).

    python3 -m venv --system-site-packages .venv
    source .venv/bin/activate
    pip install -r requirements.txt  # If you have one, or install dependencies manually
    # Dependencies: ollama, fast-whisper, sounddevice, soundfile, numpy, gpiozero, piper-tts, fastapi, uvicorn, python-multipart
    # Note: local_chat.py dependencies are currently managed manually or via setup.sh hints.
    

    Note

    : If you run into issues with lgpio or audio, ensuring --system-site-packages is used is often the fix.

Running the Bot

To run the chat bot manually:

source .venv/bin/activate
python3 src/local_chat/local_chat.py

Systemd Services (Autostart)

To configure the bot to start automatically on boot:

  1. Install Service Files Run the startup setup script to copy systemd files to /etc/systemd/system/.

    sudo ./scripts/setup_startup.sh
    
  2. Enable and Start Services

    # Reload systemd
    sudo systemctl daemon-reload
    
    # Enable Ollama (Dependecy)
    sudo systemctl enable --now ollama
    
    # Enable Chat Bot
    sudo systemctl enable --now local-chat-bot
    
  3. Optional: Faster Whisper Server If you are using the separate Whisper server:

    sudo systemctl enable --now faster-whisper-server
    

Project Structure

  • src/local_chat/: Python source code (local_chat.py, assistant.py, etc.)
  • scripts/: Shell scripts for setup and maintenance.
  • device-stuff/: Hardware/OS configuration files.
  • assets/: Models and sounds.