Repositories / olmoocr_runner.git

install.sh

Clone (read-only): git clone http://git.guha-anderson.com/git/olmoocr_runner.git

Branch
1893 bytes · ee72a2043b19
#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" GGUF_DIR="$HOME/models/olmOCR-2-7B-1025-Q4_K_M-GGUF" GGUF_FILE="$GGUF_DIR/olmocr-2-7b-1025-fp8-q4_k_m.gguf" GGUF_URL="https://huggingface.co/sing0717/olmOCR-2-7B-1025-FP8-Q4_K_M-GGUF/resolve/main/olmocr-2-7b-1025-fp8-q4_k_m.gguf" MMPROJ_FILE="$GGUF_DIR/mmproj-f16.gguf" MMPROJ_URL="https://huggingface.co/lmstudio-community/Qwen2.5-VL-7B-Instruct-GGUF/resolve/main/mmproj-model-f16.gguf" GGUF_MIN_BYTES=4600000000 MMPROJ_MIN_BYTES=1300000000 file_size() { if [ -f "$1" ]; then stat --printf="%s" "$1" else echo 0 fi } download_if_incomplete() { local file="$1" local url="$2" local min_bytes="$3" local label="$4" local size size="$(file_size "$file")" if [ "$size" -ge "$min_bytes" ]; then echo "==> $label already downloaded at $file" else if [ "$size" -gt 0 ]; then echo "==> Resuming incomplete $label at $file ($size bytes) ..." else echo "==> Downloading $label to $file ..." fi curl --fail --location --continue-at - --output "$file" "$url" size="$(file_size "$file")" if [ "$size" -lt "$min_bytes" ]; then echo "Error: $label is still incomplete at $file ($size bytes)." >&2 exit 1 fi echo "==> $label downloaded." fi } cd "$SCRIPT_DIR" if ! command -v llama-server >/dev/null 2>&1; then echo "Error: llama-server is not on PATH. Install it or set PATH before running OCR." >&2 exit 1 fi echo "==> Found llama-server at $(command -v llama-server)" echo "==> Running uv sync ..." uv sync mkdir -p "$GGUF_DIR" download_if_incomplete "$GGUF_FILE" "$GGUF_URL" "$GGUF_MIN_BYTES" "GGUF model" download_if_incomplete "$MMPROJ_FILE" "$MMPROJ_URL" "$MMPROJ_MIN_BYTES" "mmproj" echo "==> Done."