fixed formatting

This commit is contained in:
crowetic 2025-05-19 16:49:20 -07:00
parent 7d61556e82
commit 70886e0ce4

View File

@ -44,108 +44,108 @@ if [[ "$1" == "--update" ]]; then
echo "⚠️ JupyterLab is not running, skipping update."
fi
# --- LocalAI custom build and update ---
LOCALAI_REPO=~/git-repos/LocalAI
DOCKERFILE_URL="https://gitea.qortal.link/crowetic/AI-Dev/raw/branch/main/Dockerfile"
# --- LocalAI custom build and update ---
LOCALAI_REPO=~/git-repos/LocalAI
DOCKERFILE_URL="https://gitea.qortal.link/crowetic/AI-Dev/raw/branch/main/Dockerfile"
echo "🔁 Rebuilding LocalAI (custom)..."
echo "🔁 Rebuilding LocalAI (custom)..."
# Backup and remove existing repo
if [ -d "$LOCALAI_REPO" ]; then
echo "📦 Backing up existing LocalAI repo..."
mv "$LOCALAI_REPO" "${LOCALAI_REPO}_backup_$(date +%s)"
fi
# Backup and remove existing repo
if [ -d "$LOCALAI_REPO" ]; then
echo "📦 Backing up existing LocalAI repo..."
mv "$LOCALAI_REPO" "${LOCALAI_REPO}_backup_$(date +%s)"
fi
# Clone latest LocalAI
git clone https://github.com/mudler/LocalAI.git "$LOCALAI_REPO"
# Clone latest LocalAI
git clone https://github.com/mudler/LocalAI.git "$LOCALAI_REPO"
# Remove default Docker-related files
cd "$LOCALAI_REPO"
rm -f Dockerfile Dockerfile.aio docker-compose.yaml
# Remove default Docker-related files
cd "$LOCALAI_REPO"
rm -f Dockerfile Dockerfile.aio docker-compose.yaml
# Prepare and build LocalAI binary
# NOTE - This portion required quite a few custom additions in order to build correctly... if you are running this from a machine that hasn't built it already, just better probably to await the implementation of the Docker-Compose methods
# Docker-compose methods will be coming soon.
echo "🔧 Running make prepare..."
make prepare
# Prepare and build LocalAI binary
# NOTE - This portion required quite a few custom additions in order to build correctly... if you are running this from a machine that hasn't built it already, just better probably to await the implementation of the Docker-Compose methods
# Docker-compose methods will be coming soon.
echo "🔧 Running make prepare..."
make prepare
echo "🧠 Building LocalAI binary with GPU, localrecall, and localagi..."
make build \
TAGS="localrecall,localagi,gpu" \
BACKENDS="llama-cuda whispercpp stablediffusion ollama" \
GPU_SUPPORT="cuda"
echo "🧠 Building LocalAI binary with GPU, localrecall, and localagi..."
make build \
TAGS="localrecall,localagi,gpu" \
BACKENDS="llama-cuda whispercpp stablediffusion ollama" \
GPU_SUPPORT="cuda"
# Download your custom Dockerfile
echo "📥 Downloading custom Dockerfile..."
curl -fsSL "$DOCKERFILE_URL" -o Dockerfile
# Download your custom Dockerfile
echo "📥 Downloading custom Dockerfile..."
curl -fsSL "$DOCKERFILE_URL" -o Dockerfile
# Build the container
echo "🔨 Building custom LocalAI Docker image..."
docker build -t localai:custom .
# Build the container
echo "🔨 Building custom LocalAI Docker image..."
docker build -t localai:custom .
# Remove existing container
docker stop localai 2>/dev/null || true
docker rm localai 2>/dev/null || true
# Remove existing container
docker stop localai 2>/dev/null || true
docker rm localai 2>/dev/null || true
# Create model and config directories if needed
mkdir -p ~/ai-stack/localai/models
mkdir -p ~/ai-stack/localai/config
# Create model and config directories if needed
mkdir -p ~/ai-stack/localai/models
mkdir -p ~/ai-stack/localai/config
# Run new container
docker run -d \
--name localai \
--gpus all \
-p 8080:8080 \
-v ~/ai-stack/localai/models:/models \
-v ~/ai-stack/localai/config:/config \
-e ENABLE_BACKENDS=llama-cuda,ollama \
-e INCLUDE_DEFAULT_MODELS=true \
-e AUTOLOAD_MODELS=true \
-e MODEL_PATH=/models \
--restart unless-stopped \
localai:custom
# Run new container
docker run -d \
--name localai \
--gpus all \
-p 8080:8080 \
-v ~/ai-stack/localai/models:/models \
-v ~/ai-stack/localai/config:/config \
-e ENABLE_BACKENDS=llama-cuda,ollama \
-e INCLUDE_DEFAULT_MODELS=true \
-e AUTOLOAD_MODELS=true \
-e MODEL_PATH=/models \
--restart unless-stopped \
localai:custom
echo "✅ LocalAI (custom) is now running at http://localhost:8080"
echo "✅ LocalAI (custom) is now running at http://localhost:8080"
# # 🔁 Updating LocalAI (GPU build)
# if check_container_running "localai"; then
# echo "🧠 Updating LocalAI..."
# docker stop localai
# docker rm localai
# else
# echo " Installing LocalAI..."
# fi
# # 🔁 Updating LocalAI (GPU build)
# if check_container_running "localai"; then
# echo "🧠 Updating LocalAI..."
# docker stop localai
# docker rm localai
# else
# echo " Installing LocalAI..."
# fi
# docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12
# docker pull localai/localai:latest-aio-gpu-nvidia-cuda-12
# # Ensure default models.yaml exists
# MODELS_YAML=~/ai-stack/localai/config/models.yaml
# if [ ! -f "$MODELS_YAML" ]; then
# echo "📄 Creating default models.yaml..."
# cat > "$MODELS_YAML" <<EOF
# - name: phi
# backend: llama-cuda
# parameters:
# model: /models/phi-2.gguf
# EOF
# fi
# # Ensure default models.yaml exists
# MODELS_YAML=~/ai-stack/localai/config/models.yaml
# if [ ! -f "$MODELS_YAML" ]; then
# echo "📄 Creating default models.yaml..."
# cat > "$MODELS_YAML" <<EOF
# - name: phi
# backend: llama-cuda
# parameters:
# model: /models/phi-2.gguf
# EOF
# fi
# docker run -d \
# --name localai \
# --gpus all \
# -p 8080:8080 \
# -v ~/ai-stack/localai/models:/models \
# -v ~/ai-stack/localai/config:/config \
# -e ENABLE_BACKENDS=llama-cuda,ollama \
# -e INCLUDE_DEFAULT_MODELS=true \
# -e AUTOLOAD_MODELS=true \
# -e MODEL_PATH=/models \
# --restart unless-stopped \
# localai/localai:latest-aio-gpu-nvidia-cuda-12
# docker run -d \
# --name localai \
# --gpus all \
# -p 8080:8080 \
# -v ~/ai-stack/localai/models:/models \
# -v ~/ai-stack/localai/config:/config \
# -e ENABLE_BACKENDS=llama-cuda,ollama \
# -e INCLUDE_DEFAULT_MODELS=true \
# -e AUTOLOAD_MODELS=true \
# -e MODEL_PATH=/models \
# --restart unless-stopped \
# localai/localai:latest-aio-gpu-nvidia-cuda-12
# echo "✅ LocalAI running at http://localhost:8080"
# echo "✅ LocalAI running at http://localhost:8080"