Add HF model auto-download with configurable AI env, and share link visibility toggles
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
MODEL_NAME="${AI_MODEL:-qwen2.5-1.5b-instruct-q4_k_m.gguf}"
|
||||
MODEL_REPO="${AI_MODEL_REPO:-Qwen/Qwen2.5-1.5B-Instruct-GGUF}"
|
||||
MODEL_PATH="/models/${MODEL_NAME}"
|
||||
MODEL_URL="https://huggingface.co/${MODEL_REPO}/resolve/main/${MODEL_NAME}"
|
||||
|
||||
if [ ! -s "${MODEL_PATH}" ]; then
|
||||
echo "[text-corrector] Model ${MODEL_PATH} not found, downloading from ${MODEL_URL}"
|
||||
set -- -L --fail --retry 3 --retry-delay 5 --progress-bar -o "${MODEL_PATH}.part"
|
||||
if [ -n "${HUGGINGFACE_TOKEN}" ]; then
|
||||
echo "[text-corrector] Using Hugging Face token"
|
||||
set -- "$@" -H "Authorization: Bearer ${HUGGINGFACE_TOKEN}"
|
||||
fi
|
||||
curl "$@" "${MODEL_URL}"
|
||||
mv "${MODEL_PATH}.part" "${MODEL_PATH}"
|
||||
echo "[text-corrector] Download complete"
|
||||
fi
|
||||
|
||||
echo "[text-corrector] Starting llama-server with ${MODEL_PATH}"
|
||||
exec /app/llama-server -m "${MODEL_PATH}" --host 0.0.0.0 --port 8080 -c 4096 -n 256 -t 8 --temp 0.1
|
||||
Reference in New Issue
Block a user