erichen-0615's picture
Add files using upload-large-folder tool
9228631 verified
|
Raw
History Blame Contribute Delete
4.51 kB
metadata
pretty_name: vLLM-BERAG Apptainer container
tags:
  - apptainer
  - singularity
  - vllm
  - cuda
  - berag
  - inference

vLLM-BERAG Apptainer container

This repository distributes a prebuilt Apptainer SIF containing the vLLM-BERAG inference environment. It is intended for NVIDIA GPU jobs on HPC systems where reading a Python environment containing many small files from a shared filesystem is slow.

The image combines the compiled CUDA extensions from vllm/vllm-openai:v0.24.0-cu129 with the BERAG Python implementation from source revision 2ca4f5b4fe3aa8018ee5f6bd014a6684570642d9.

Artifact

Property Value
File vllm-berag-2ca4f5b4-v0.24.0-cu129.sif
Size 11,181,588,480 bytes
SHA-256 7ad083a42a9273547b643610165d71cdef6333e02a399d8754dc1caac109c8fd
vLLM 0.24.0 with BERAG extensions
PyTorch 2.11.0+cu129
CUDA runtime 12.9
Architecture Linux x86-64

Model weights, datasets, and LoRA adapters are not included.

Requirements

  • Apptainer with NVIDIA support.
  • An NVIDIA GPU and a host driver compatible with the CUDA 12.9 runtime.
  • Sufficient node-local storage for the approximately 11 GB SIF and runtime caches.

The image was tested with Apptainer 1.5.2 on an NVIDIA A100-SXM4-80GB.

Download

Replace YOUR_HF_USERNAME/vllm-berag-container with this repository's Hub ID:

REPO_ID="YOUR_HF_USERNAME/vllm-berag-container"
LOCAL_DIR="${SLURM_TMPDIR:-/var/tmp/$USER/vllm-berag-container}"

mkdir -p "$LOCAL_DIR"

hf download "$REPO_ID" \
    vllm-berag-2ca4f5b4-v0.24.0-cu129.sif \
    vllm-berag-2ca4f5b4-v0.24.0-cu129.sif.sha256 \
    --repo-type dataset \
    --local-dir "$LOCAL_DIR"

cd "$LOCAL_DIR"
sha256sum -c vllm-berag-2ca4f5b4-v0.24.0-cu129.sif.sha256

GPU smoke test

Use a node-local directory for JIT and framework caches. Bind an existing Hugging Face model cache to /cache/huggingface if model access is needed.

IMAGE="$LOCAL_DIR/vllm-berag-2ca4f5b4-v0.24.0-cu129.sif"
RUNTIME_ROOT="${SLURM_TMPDIR:-/var/tmp/$USER/vllm-berag-runtime}"
HF_CACHE_HOST="/path/to/your/HF_HOME"

mkdir -p \
    "$RUNTIME_ROOT/xdg" \
    "$RUNTIME_ROOT/vllm" \
    "$RUNTIME_ROOT/triton" \
    "$RUNTIME_ROOT/torchinductor"

env -u CUDA_HOME -u CUDA_PATH -u CUDA_ROOT \
apptainer exec \
    --nv \
    --cleanenv \
    --bind "$HF_CACHE_HOST:/cache/huggingface" \
    --bind "$RUNTIME_ROOT:/runtime-cache" \
    --env VLLM_USE_FLASHINFER_SAMPLER=0 \
    --env XDG_CACHE_HOME=/runtime-cache/xdg \
    --env VLLM_CACHE_ROOT=/runtime-cache/vllm \
    --env FLASHINFER_WORKSPACE_BASE=/runtime-cache \
    --env TRITON_CACHE_DIR=/runtime-cache/triton \
    --env TORCHINDUCTOR_CACHE_DIR=/runtime-cache/torchinductor \
    "$IMAGE" \
    python3 -c '
import inspect
import torch
import vllm
import vllm._C_stable_libtorch

print("vLLM:", vllm.__version__)
print("CUDA:", torch.version.cuda)
print("GPU:", torch.cuda.get_device_name(0))
print("generate_berag:", inspect.signature(vllm.LLM.generate_berag))
'

Successful output should report CUDA 12.9, the allocated GPU, and the LLM.generate_berag signature.

BERAG API

The synchronous entry point is:

LLM.generate_berag(
    shared_prefix,
    documents,
    suffix,
    sampling_params=None,
    *,
    berag_params=None,
    request_id=None,
    use_tqdm=True,
    lora_request=None,
    priority=None,
    tokenization_kwargs=None,
    debug=False,
)

Per-request BERAG settings use vllm.berag.BeragParams, with pruning_top_p and optional prior_token_indices fields.

Operational notes

  • Do not load a host CUDA toolkit into the container. apptainer exec --nv provides the host NVIDIA driver libraries; stale CUDA_HOME values can point JIT compilation at a nonexistent toolkit.
  • VLLM_USE_FLASHINFER_SAMPLER=0 avoids runtime FlashInfer sampler compilation in this runtime-only image.
  • Keep model weights on shared storage if necessary, but stage the SIF and runtime caches on node-local storage.
  • This image is intended for trusted offline or batch inference. Review vLLM serving security guidance before exposing an API endpoint.

Provenance and licensing

The SIF bundles software from multiple upstream projects, including vLLM, PyTorch, NVIDIA CUDA runtime libraries, and their transitive dependencies. Each component retains its own license and terms. Review the applicable upstream licenses and redistribution terms before changing this Hub repository from private to public.