Skip to content

Commit 5df0868

Browse files
wangchen615sjmonson
authored andcommitted
Add Dockerfile and benchmark script for containerized GuideLLM benchmarking
fix pre-commit issue? Add Docker build files and update .gitignore
1 parent 0bcc3e7 commit 5df0868

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

build/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM python:3.12-slim
2+
3+
LABEL org.opencontainers.image.source="https://github.com/neuralmagic/guidellm"
4+
LABEL org.opencontainers.image.description="GuideLLM Benchmark Container"
5+
6+
# Install dependencies and set up environment in a single layer
7+
RUN apt-get update && apt-get install -y \
8+
git \
9+
curl \
10+
&& pip install git+https://github.com/neuralmagic/guidellm.git \
11+
&& useradd -m -u 1000 guidellm \
12+
&& apt-get clean \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Set working directory
16+
WORKDIR /app
17+
18+
# Copy and set up the benchmark script
19+
COPY build/run_benchmark.sh /app/
20+
21+
# Set ownership to non-root user
22+
RUN chown -R guidellm:guidellm /app
23+
24+
# Switch to non-root user
25+
USER guidellm
26+
27+
# Healthcheck
28+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
29+
CMD curl -f http://localhost:8000/health || exit 1
30+
31+
# Set the entrypoint
32+
ENTRYPOINT ["/app/run_benchmark.sh"]

build/run_benchmark.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Required environment variables
5+
TARGET=${TARGET:-"http://localhost:8000"}
6+
MODEL=${MODEL:-"neuralmagic/Meta-Llama-3.1-8B-Instruct-quantized.w4a16"}
7+
RATE_TYPE=${RATE_TYPE:-"sweep"}
8+
DATA=${DATA:-"prompt_tokens=256,output_tokens=128"}
9+
MAX_REQUESTS=${MAX_REQUESTS:-"100"}
10+
MAX_SECONDS=${MAX_SECONDS:-""}
11+
12+
# Output configuration
13+
OUTPUT_PATH=${OUTPUT_PATH:-"/results/guidellm_benchmark_results"}
14+
OUTPUT_FORMAT=${OUTPUT_FORMAT:-"json"} # Can be json, yaml, or yml
15+
16+
# Build the command
17+
CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\""
18+
19+
# Add optional parameters
20+
if [ ! -z "${MAX_REQUESTS}" ]; then
21+
CMD="${CMD} --max-requests ${MAX_REQUESTS}"
22+
fi
23+
24+
if [ ! -z "${MAX_SECONDS}" ]; then
25+
CMD="${CMD} --max-seconds ${MAX_SECONDS}"
26+
fi
27+
28+
# Add output path with appropriate extension
29+
if [ ! -z "${OUTPUT_PATH}" ]; then
30+
CMD="${CMD} --output-path \"${OUTPUT_PATH}.${OUTPUT_FORMAT}\""
31+
fi
32+
33+
# Execute the command
34+
echo "Running command: ${CMD}"
35+
eval "${CMD}"

0 commit comments

Comments
 (0)