Files

58 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# install_local_llm.sh
# Installs Ollama and a translation-capable model on Linux (Bazzite/Fedora/Debian compatible)
set -e
echo "================================================="
echo " Local LLM Setup for AI Transcriber (Ollama)"
echo "================================================="
# 1. Check if Ollama is already installed
if command -v ollama &> /dev/null; then
echo "✅ Ollama is already installed."
else
echo "⬇️ Installing Ollama..."
# Standard Ollama install script (Works on Bazzite/Silverblue as /usr/local is writable)
curl -fsSL https://ollama.com/install.sh | sh
fi
# 2. Check GPU availability for Ollama
echo "-------------------------------------------------"
if command -v nvidia-smi &> /dev/null; then
echo "✅ Nvidia GPU detected. Ollama should run efficiently."
else
echo "⚠️ Nvidia GPU not found (or drivers missing)."
echo " Ollama will run on CPU, which might be slow for translation."
fi
echo "-------------------------------------------------"
# 3. Start Ollama Server (Background)
# In some dev containers, systemd isn't available, so we try to start it manually if not running.
if ! pgrep -x "ollama" > /dev/null; then
echo "🚀 Starting Ollama server in the background..."
nohup ollama serve > ollama.log 2>&1 &
PID=$!
echo " (PID: $PID) - Waiting 5 seconds for initialization..."
sleep 5
else
echo "✅ Ollama server is already running."
fi
# 4. Pull a Model
# 'llama3' (8B) is a great balance of speed and quality for translation.
# 'gemma:7b' is also good.
MODEL="llama3"
echo "⬇️ Pulling model: $MODEL (This may take a few minutes)..."
ollama pull $MODEL
echo "-------------------------------------------------"
echo "✅ Installation Complete!"
echo ""
echo "You can test it manually with: ollama run $MODEL 'Translate this to Spanish: Hello World'"
echo ""
echo "The AI Transcriber scripts will now detect and use this as a fallback."
echo "================================================="