From 8de8bdd3c93010a763ff8e8508b9b3765aa42ebd Mon Sep 17 00:00:00 2001 From: mattshax Date: Sun, 8 Feb 2026 18:40:22 +0000 Subject: [PATCH 1/2] Use sparse checkout and targeted LFS fetch for HuggingFace model cloning Replace bare `git lfs pull` (which downloads all LFS files including duplicate .bin weights) with sparse checkout + targeted LFS fetch. This prevents hanging on large models by excluding .bin/.gguf/.onnx files, adding progress output, retry logic, and concurrent transfer configuration. Falls back to .bin if no safetensors are found. --- workflow.yaml | 44 +++++++++++++++++++++++++++++++++++++++++--- yamls/hsp.yaml | 44 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/workflow.yaml b/workflow.yaml index f1b6a2f..688a738 100644 --- a/workflow.yaml +++ b/workflow.yaml @@ -468,10 +468,48 @@ jobs: REPO_URL="https://huggingface.co/$MODEL_ID" [[ -n "$HF_TOKEN" ]] && REPO_URL="https://user:${HF_TOKEN}@huggingface.co/$MODEL_ID" - # Clone with LFS and pull large files - GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 "$REPO_URL" "$TARGET_DIR" + # Clone without LFS or checkout, then sparse-checkout only safetensors + GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 --no-checkout "$REPO_URL" "$TARGET_DIR" cd "$TARGET_DIR" - git lfs pull + + # Sparse checkout: exclude bin/gguf/onnx/pth to only get safetensors weights + git sparse-checkout init --no-cone + git sparse-checkout set '/*' '!*.bin' '!*.gguf' '!*.onnx' '!consolidated*.pth' + git checkout + + # Configure LFS for reliability with large models + git lfs install --local + git config lfs.concurrenttransfers 4 + git config lfs.transfer.maxretries 10 + git config lfs.transfer.maxretrydelay 30 + + # Fetch only safetensors LFS objects with progress and retry logic + attempt=1 + max_attempts=3 + while true; do + echo "LFS fetch attempt ${attempt}/${max_attempts}..." + if git lfs fetch --progress --include="*.safetensors"; then + break + fi + if [[ $attempt -ge $max_attempts ]]; then + echo "ERROR: LFS fetch failed after ${max_attempts} attempts" + exit 1 + fi + sleep $((attempt * 5)) + ((attempt++)) + done + echo "Checking out LFS files..." + git lfs checkout --include="*.safetensors" + + # Fallback: if model only ships bin weights, re-include and fetch those + if ! ls *.safetensors 1>/dev/null 2>&1; then + echo "No safetensors files found, falling back to bin weights..." + git sparse-checkout set '/*' + git checkout + git lfs fetch --progress --include="*.bin" + git lfs checkout --include="*.bin" + fi + cd .. # Verify model weights exist (not just LFS pointers) diff --git a/yamls/hsp.yaml b/yamls/hsp.yaml index e5180ef..8285aa3 100644 --- a/yamls/hsp.yaml +++ b/yamls/hsp.yaml @@ -468,10 +468,48 @@ jobs: REPO_URL="https://huggingface.co/$MODEL_ID" [[ -n "$HF_TOKEN" ]] && REPO_URL="https://user:${HF_TOKEN}@huggingface.co/$MODEL_ID" - # Clone with LFS and pull large files - GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 "$REPO_URL" "$TARGET_DIR" + # Clone without LFS or checkout, then sparse-checkout only safetensors + GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 --no-checkout "$REPO_URL" "$TARGET_DIR" cd "$TARGET_DIR" - git lfs pull + + # Sparse checkout: exclude bin/gguf/onnx/pth to only get safetensors weights + git sparse-checkout init --no-cone + git sparse-checkout set '/*' '!*.bin' '!*.gguf' '!*.onnx' '!consolidated*.pth' + git checkout + + # Configure LFS for reliability with large models + git lfs install --local + git config lfs.concurrenttransfers 4 + git config lfs.transfer.maxretries 10 + git config lfs.transfer.maxretrydelay 30 + + # Fetch only safetensors LFS objects with progress and retry logic + attempt=1 + max_attempts=3 + while true; do + echo "LFS fetch attempt ${attempt}/${max_attempts}..." + if git lfs fetch --progress --include="*.safetensors"; then + break + fi + if [[ $attempt -ge $max_attempts ]]; then + echo "ERROR: LFS fetch failed after ${max_attempts} attempts" + exit 1 + fi + sleep $((attempt * 5)) + ((attempt++)) + done + echo "Checking out LFS files..." + git lfs checkout --include="*.safetensors" + + # Fallback: if model only ships bin weights, re-include and fetch those + if ! ls *.safetensors 1>/dev/null 2>&1; then + echo "No safetensors files found, falling back to bin weights..." + git sparse-checkout set '/*' + git checkout + git lfs fetch --progress --include="*.bin" + git lfs checkout --include="*.bin" + fi + cd .. # Verify model weights exist (not just LFS pointers) From d79e62d868178e904941bbfabdac715d41ea3425 Mon Sep 17 00:00:00 2001 From: mattshax Date: Mon, 9 Feb 2026 13:09:56 +0000 Subject: [PATCH 2/2] Fix FIPS selftest crash by pinning opencv-python-headless to 4.12.0.88 opencv-python-headless >=4.13 bundles a FIPS-enabled OpenSSL 1.1.1k from CentOS/RHEL. On FIPS-enabled HPC hosts (where Singularity exposes /proc/sys/crypto/fips_enabled=1), this bundled library triggers a fatal FIPS selftest failure at import time, crashing vllm serve. Pin to 4.12.0.88 which does not bundle OpenSSL. Also remove ineffective FIPS workarounds from both containers: - OPENSSL_CONF=/dev/null (targeted system OpenSSL 3.0.2, not the culprit) - OPENSSL_FORCE_FIPS_MODE=0 (not a real OpenSSL variable) - apt-get reinstall libssl-dev openssl (wrong library) - pip rebuild cryptography from source (unnecessary) Refs: https://github.com/opencv/opencv-python/issues/1184 Refs: https://github.com/opencv/opencv-python/issues/1191 --- singularity/Singularity.rag | 2 ++ singularity/Singularity.vllm | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/singularity/Singularity.rag b/singularity/Singularity.rag index 40ad3d4..7457869 100644 --- a/singularity/Singularity.rag +++ b/singularity/Singularity.rag @@ -15,11 +15,13 @@ mkdir -p /app cd /app apt-get update && apt-get install -y --no-install-recommends git wget curl build-essential ca-certificates && rm -rf /var/lib/apt/lists/* pip3 install --no-cache-dir chromadb "fastapi>=0.110,<0.112" "uvicorn[standard]>=0.29,<0.31" "transformers>=4.41,<4.45" "sentence-transformers>=2.6,<3" "chromadb==0.5.4" "watchdog>=3,<5" "pypdf>=4,<5" requests httpx pyyaml + HF_HOME=/root/.cache/huggingface chmod +x singularity-entrypoint.sh %environment export HF_HOME=/root/.cache/huggingface +export LD_LIBRARY_PATH=/opt/conda/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %runscript /bin/bash singularity-entrypoint.sh \ No newline at end of file diff --git a/singularity/Singularity.vllm b/singularity/Singularity.vllm index d24f421..844c477 100644 --- a/singularity/Singularity.vllm +++ b/singularity/Singularity.vllm @@ -12,6 +12,12 @@ From: vllm/vllm-openai:latest pkg-config cmake ninja-build rm -rf /var/lib/apt/lists/* + # FIPS workaround: opencv-python-headless >=4.13 bundles a FIPS-enabled + # OpenSSL 1.1.1k from CentOS/RHEL that crashes on FIPS-enabled hosts. + # Pin to 4.12.0.88 which does not bundle OpenSSL. + # See: https://github.com/opencv/opencv-python/issues/1184 + pip install opencv-python-headless==4.12.0.88 + # Pick a Python interpreter that actually exists in the base image if command -v python >/dev/null 2>&1; then PY=python @@ -37,6 +43,9 @@ print("Transformers:", transformers.__version__) print("vLLM:", vllm.__version__) PY +%environment + export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + %runscript mkdir -p /app cd /app