Skip to content

Commit 7154909

Browse files
committed
Add test code for deployment
1 parent ef3c144 commit 7154909

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

uv/test.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
IMAGE="${1:?usage: $0 <image:tag>}"
4+
5+
BLUE='\033[34m'
6+
RED='\033[31m'
7+
RESET='\033[0m'
8+
9+
VERSIONS=(2.4.1 2.5.1 2.6.0 2.7.1 2.9.0)
10+
11+
for v in "${VERSIONS[@]}"; do
12+
echo "=== torch ${v} ==="
13+
if docker run -it --rm --gpus all -e TORCH_VER="$v" "$IMAGE" bash -lc '
14+
set -euo pipefail
15+
work="/tmp/torchtest-${TORCH_VER}"
16+
rm -rf "$work" && mkdir -p "$work" && cd "$work"
17+
18+
init2="uv_init_torch_${TORCH_VER}"
19+
init1="uv_init_torch${TORCH_VER}"
20+
if command -v "$init2" >/dev/null 2>&1; then "$init2"; else "$init1"; fi
21+
22+
./.venv/bin/python -c "import importlib, torch; \
23+
ok = torch.cuda.is_available(); assert ok; \
24+
_ = torch.empty(1, device=\"cuda\"); \
25+
importlib.import_module(\"flash_attn\"); \
26+
importlib.import_module(\"triton\")"
27+
' >/dev/null; then
28+
echo -e "${BLUE}OK${RESET}"
29+
else
30+
echo -e "${RED}FAIL${RESET}"
31+
fi
32+
done

0 commit comments

Comments
 (0)