#!/usr/bin/env bash # Kolibri lokal ausprobieren – macOS # Automatisch erzeugt von Tokenstrom (tokenstrom.com). # Aufruf: bash try_mac.sh # Ollama (Standard) # MODE=hf bash try_mac.sh # Python/transformers set -e cd "$(dirname "$0")" echo "== Kolibri ==" echo "WARNUNG: Groß (78,1 B parameters, MoE): running entirely on the GPU takes a lot of VRAM (video memory). With MoE offloading, a regular graphics card plus plenty of RAM is enough (see table). Colab Free isn't enough." if [ "${MODE:-ollama}" = "ollama" ]; then echo "== Ollama ==" if ! command -v ollama >/dev/null 2>&1; then if command -v brew >/dev/null 2>&1; then brew install ollama; else echo "Please install the Ollama app first: https://ollama.com/download/mac"; exit 1; fi fi curl -s http://localhost:11434/api/tags >/dev/null 2>&1 || (ollama serve >/dev/null 2>&1 &) sleep 3 MODEL="${MODEL:-}" # Pick the right variant for your hardware (to choose your own: MODEL= bash try_mac.sh) if [ -z "${MODEL:-}" ]; then MEM_GB=$(( $(sysctl -n hw.memsize) / 1073741824 * 7 / 10 )) # the GPU can use about 70% of memory MODEL=$(printf '%s\n' "32.5 hf.co/Hob-forge/Kolibri-1-GGUF:Q2_K 0 42.5 hf.co/Hob-forge/Kolibri-1-GGUF:Q3_K_M 0 53.5 hf.co/Hob-forge/Kolibri-1-GGUF:Q4_K_M 1 62.5 hf.co/Hob-forge/Kolibri-1-GGUF:Q5_K_M 0 72.0 hf.co/Hob-forge/Kolibri-1-GGUF:Q6_K 0 92.5 hf.co/Hob-forge/Kolibri-1-GGUF:Q8_0 0" | awk -v mem="$MEM_GB" ' { need[NR]=$1+0; ref[NR]=$2; def[NR]=$3+0 } END { mem=mem+0; for (i=1;i<=NR;i++) if (def[i]==1 && need[i]<=mem) { print ref[i]; exit } best=ref[1]; for (i=1;i<=NR;i++) if (need[i]<=mem) best=ref[i]; print best }') echo "Available memory: approx. ${MEM_GB} GB -> selected variant: $MODEL" fi MODEL="${MODEL:-hf.co/Hob-forge/Kolibri-1-GGUF}" echo "Downloading $MODEL (the first time this takes a few minutes, depending on size) ..." ollama pull "$MODEL" echo "" echo "Done! Now type your question and press Enter. Quit with /bye" exec ollama run "$MODEL" fi echo "== Python / Hugging Face ==" python3 -m venv .venv-kolibri source .venv-kolibri/bin/activate pip install -q -U pip pip install -q -U torch transformers accelerate python3 demo.py