smart_ide/services/chandra/install-local-hf.sh
4NK d6a61e7cbe chandra: document and script local HuggingFace install (hf extra, run-chandra-hf)
- Add install-local-hf.sh (uv sync --extra hf or pip install -e .[hf])
- Add run-chandra-hf.sh defaulting to --method hf
- Expand .env.example for upstream/local.env (MODEL_CHECKPOINT, TORCH_*)
2026-04-03 22:28:20 +02:00

23 lines
726 B
Bash
Executable File

#!/usr/bin/env bash
# Install Chandra with Hugging Face / Transformers backend (local GPU or CPU).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
UP="${ROOT}/upstream"
if [[ ! -d "${UP}/chandra" ]]; then
echo "Missing ${UP}/chandra — run: git submodule update --init services/chandra/upstream" >&2
exit 1
fi
cd "${UP}"
if command -v uv >/dev/null 2>&1; then
uv sync --extra hf
else
if [[ ! -d .venv ]]; then
python3 -m venv .venv
fi
"${UP}/.venv/bin/pip" install -U pip
"${UP}/.venv/bin/pip" install -e ".[hf]"
fi
echo ""
echo "OK. Configure model (optional): cp ${ROOT}/.env.example ${UP}/local.env && edit"
echo "Run OCR (local HF): ${ROOT}/run-chandra-hf.sh <input.pdf|dir> <output_dir>"