Spaces:
Paused
Paused
Download scripts/entrypoint.sh from CedM/vLLM_VLM_OCR_Nginx: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/spaces/CedM/vLLM_VLM_OCR_Nginx/resolve/main/scripts/entrypoint.sh
- Command line
-
hf download hf://spaces/CedM/vLLM_VLM_OCR_Nginx/scripts/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/CedM/vLLM_VLM_OCR_Nginx/resolve/main/scripts/entrypoint.sh
2.03 kB
| set -eo pipefail | |
| echo "==========================================================" | |
| echo " vLLM dual-model + PP-DocLayoutV3 (CPU) on HF Space (T4) " | |
| echo "==========================================================" | |
| # 1. GPU & CUDA environment validation | |
| echo "[1/4] Validating GPU and CUDA environment..." | |
| if ! python3 /scripts/gpu_detect.py; then | |
| echo "[CRITICAL ERROR] GPU environment validation failed." | |
| echo "Deployment requires >= ${MIN_VRAM_MB:-15000} MB VRAM and CUDA >= ${MIN_CUDA_MAJOR:-11}.${MIN_CUDA_MINOR:-8}." | |
| exit 1 | |
| fi | |
| echo "[OK] GPU environment verified." | |
| # 2. Authentication configuration | |
| echo "[2/4] Configuring Nginx Basic Authentication..." | |
| if [ -z "${NGINX_PASSWORD:-}" ]; then | |
| echo "[CRITICAL ERROR] NGINX_PASSWORD is not defined." | |
| echo "Set NGINX_PASSWORD in Hugging Face Space Secrets." | |
| exit 1 | |
| fi | |
| python3 /scripts/generate_htpasswd.py | |
| echo "[OK] Nginx authentication configured." | |
| # 3. Model cache on LOCAL disk (fast); /data bucket stays mounted for other persistent data | |
| echo "[3/5] Preparing local model cache at ${HF_HOME:-/tmp/hf}..." | |
| mkdir -p "${HF_HOME:-/tmp/hf}" \ | |
| /tmp/nginx/body /tmp/nginx/proxy /tmp/nginx/fastcgi /tmp/nginx/uwsgi /tmp/nginx/scgi \ | |
| /tmp/torch_extensions /tmp/.cache /var/log/nginx | |
| echo "[OK] Cache directory ready." | |
| # 4. Preload models from the HF Hub (hf_xet, fast, parallel) into local disk — avoids | |
| # slow reads through the FUSE-mounted bucket (was ~12 Mo/s, >10 min per model) | |
| echo "[4/5] Preloading models from HF Hub into ${HF_HOME:-/tmp/hf} (hf_xet)..." | |
| if ! /scripts/preload_models.sh; then | |
| echo "[WARNING] preload failed; vLLM will fall back to downloading on the fly" | |
| fi | |
| # 5. Hand over to supervisord: vllm-ocr, layout (CPU), vllm-vlm, warmup, nginx | |
| # supervisord comes from pip (/usr/local/bin, Python 3.12 compatible), NOT from apt | |
| # (the apt package 4.2.1 crashes on Python 3.12: asynchat was removed from the stdlib) | |
| echo "[5/5] Starting supervisord..." | |
| exec supervisord -n -c /etc/supervisord.conf | |