File size: 4,505 Bytes
9228631
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
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:

```bash
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.

```bash
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:

```python
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.