Files
xpu-llm-ports/lfm3/tests/vl/serve_vl.sh
T
Pascal LinxweilerandClaude Opus 5.5 1834792bb8 lfm3: add INT4, FP8 per-channel and VL notes, tests, eval and results
Sync the repo with the working directory: full NOTES.md (rounds 4-5, LFM3-VL),
VL tests and test images, quality eval, AutoRound W4A16 quantization scripts
and calibration recipe, the variant.sh MODEL/DOCKER_ENV options, and the
remaining benchmark results. Large regenerable artifacts (INT4 checkpoint,
ref_vl.pt, raw logprob dumps) stay out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 13:59:43 +01:00

43 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Serve LFM3-VL-2B on a test port, wait until ready, record startup time + VRAM.
# tests/vl/serve_vl.sh NAME [--fresh] [extra vllm args...]
# Container lfm3-vl-NAME on 127.0.0.1:${PORT:-8002}; image ${IMAGE:-lfm3-vllm-xpu:v0.32.0-lfm3-vl};
# model mounted read-only from /mnt/model-library; compile cache ./.cache/vl-NAME. GPU share ${GPU_UTIL:-0.4}
# (the daily lfm3 in llama-swap keeps its 0.5). Log: logs/vl_serve_NAME.log. Stop: docker stop lfm3-vl-NAME
set -euo pipefail
cd "$(dirname "$0")/../.."
NAME=$1; shift
PORT=${PORT:-8002}
IMAGE=${IMAGE:-lfm3-vllm-xpu:v0.32.0-lfm3-vl}
MODEL=${MODEL:-/mnt/model-library/LiquidAI/LFM3-VL-2B}
CACHE=$PWD/.cache/vl-$NAME
if [[ "${1:-}" == "--fresh" ]]; then
shift
[[ -d "$CACHE" ]] && docker run --rm -v "$CACHE":/c --entrypoint find "$IMAGE" /c -mindepth 1 -delete
fi
mkdir -p "$CACHE" logs results
t0=$(date +%s.%N)
docker run -d --rm --name "lfm3-vl-$NAME" \
--device /dev/dri --group-add 991 --ipc=host --shm-size=16g \
-p 127.0.0.1:${PORT}:8000 \
-v /dev/dri:/dev/dri -v /dev/dri/by-path:/dev/dri/by-path:ro \
-v "$MODEL":/model:ro \
-v "$CACHE":/root/.cache/vllm \
-e HF_HUB_OFFLINE=1 -e TRANSFORMERS_OFFLINE=1 ${DOCKER_ENV:-} \
"$IMAGE" /model --host=0.0.0.0 --port=8000 --served-model-name=lfm3-vl-2b \
--gpu-memory-utilization=${GPU_UTIL:-0.4} --dtype=bfloat16 --max-model-len=32768 \
--limit-mm-per-prompt='{"image": 4}' \
--reasoning-parser=qwen3 --enable-auto-tool-choice --tool-call-parser=qwen3_coder \
"$@" >/dev/null
docker logs -f "lfm3-vl-$NAME" > "logs/vl_serve_$NAME.log" 2>&1 &
until curl -sf "127.0.0.1:${PORT}/v1/models" >/dev/null; do
if ! docker inspect "lfm3-vl-$NAME" >/dev/null 2>&1; then
echo "$NAME: container exited during startup (see logs/vl_serve_$NAME.log)"; exit 1
fi
sleep 2
done
t=$(echo "$(date +%s.%N) - $t0" | bc)
vram=$(xpu-smi stats -d 0 | sed -n 's/.*GPU Memory Used (MiB).*current: \([0-9]*\).*/\1/p')
printf '%s\tvl-%s\t%.0f\t%s\t%s\n' "$(date +%FT%T)" "$NAME" "$t" "$vram" "$*" >> results/variants_startup.tsv
echo "$NAME ready in ${t%.*} s, GPU memory used (whole card) ${vram} MiB"