#!/usr/bin/env bash # Ling 3.1 Flash lokal ausprobieren – Linux # Automatisch erzeugt von Tokenstrom (tokenstrom.com). # Aufruf: bash try_linux.sh # Ollama (Standard) # MODE=hf bash try_linux.sh # Python/transformers set -e cd "$(dirname "$0")" echo "== Ling 3.1 Flash ==" if command -v nvidia-smi >/dev/null 2>&1; then nvidia-smi --query-gpu=name,memory.total --format=csv,noheader; else echo "No NVIDIA GPU found – running on CPU (slow)"; fi echo "WARNUNG: Groß (572,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 command -v zstd >/dev/null 2>&1 || sudo apt-get install -y zstd 2>/dev/null || sudo dnf install -y zstd 2>/dev/null || true curl -fsSL https://ollama.com/install.sh | sh fi curl -s http://localhost:11434/api/tags >/dev/null 2>&1 || (ollama serve >/dev/null 2>&1 &) sleep 3 MODEL="${MODEL:-}" MODEL="${MODEL:-hf.co/Baekpica/Ling-3.1-flash-VQ-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-ling-3-1-flash source .venv-ling-3-1-flash/bin/activate pip install -q -U pip if command -v nvidia-smi >/dev/null 2>&1; then pip install -q -U torch --index-url https://download.pytorch.org/whl/cu124 pip install -q -U transformers accelerate bitsandbytes else pip install -q -U torch --index-url https://download.pytorch.org/whl/cpu pip install -q -U transformers accelerate fi python3 demo.py