Files
2026-07-17 12:57:18 +03:00

41 lines
1.1 KiB
Bash

#!/bin/sh
# Скачивает Qwen2.5-1.5B-Instruct GGUF в WESP_ASSISTANT_DIR/models/
# Требуется: pip install -U huggingface_hub
#
# export WESP_ASSISTANT_DIR=/app/assistant
# sh install/assistant/download_model.sh
#
# Переопределить файл:
# export WESP_LLM_GGUF_FILE=qwen2.5-1.5b-instruct-q4_k_m.gguf
set -e
ROOT="${WESP_ASSISTANT_DIR:-/app/assistant}"
FILE="${WESP_LLM_GGUF_FILE:-qwen2.5-1.5b-instruct-q5_k_m.gguf}"
REPO="Qwen/Qwen2.5-1.5B-Instruct-GGUF"
export ROOT FILE REPO
mkdir -p "$ROOT/models"
PYBIN="${PYTHON:-python3}"
command -v "$PYBIN" >/dev/null 2>&1 || PYBIN=python
"$PYBIN" <<'PY'
import os
from pathlib import Path
root = Path(os.environ["ROOT"])
file = os.environ["FILE"]
repo = os.environ["REPO"]
dest = root / "models"
dest.mkdir(parents=True, exist_ok=True)
try:
from huggingface_hub import hf_hub_download
except ImportError:
raise SystemExit(
"Установите: pip install -U huggingface_hub\n"
"Или скачайте файл вручную с https://huggingface.co/%s" % repo
)
path = hf_hub_download(repo_id=repo, filename=file, local_dir=str(dest))
print("OK:", path)
PY