Skip to content

Commit f7dcf56

Browse files
committed
feat: support sharegpt dataset, custom output format and update progress
0 parents  commit f7dcf56

27 files changed

Lines changed: 4677 additions & 0 deletions

.flake8

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[flake8]
2+
max-line-length = 88
3+
max-complexity = 10
4+
select = C,E,F,W,B,B950
5+
ignore = E203,E501,W503,E701,E704
6+
exclude =
7+
.git,
8+
__pycache__,
9+
*.egg-info,
10+
.nox,
11+
.venv,
12+
.pytest_cache,
13+
.mypy_cache
14+
*/generated*
15+
*/migrations

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- "v*-dev"
9+
tags: ["*.*.*"]
10+
11+
jobs:
12+
linux-build:
13+
timeout-minutes: 20
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
python-version: ["3.11"]
19+
steps:
20+
- uses: actions/checkout@v4
21+
name: Checkout code
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Cache dependencies
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.cache/uv
33+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-uv-${{ matrix.python-version }}-
36+
37+
- name: Run CI build
38+
run: |
39+
make ci
40+
41+
- name: Upload wheel as artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: guidellm-box-dist
45+
path: dist/*.whl
46+
retention-days: 5

.github/workflows/pack.yaml

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# This workflow packs the Docker images for the GuideLLM Box.
2+
3+
name: Pack
4+
5+
permissions:
6+
actions: read
7+
contents: write
8+
pull-requests: write
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
on:
15+
workflow_dispatch: {}
16+
push:
17+
branches:
18+
- "main"
19+
- "v*-dev"
20+
tags:
21+
- "v*.*.*"
22+
paths-ignore:
23+
- "mkdocs.yml"
24+
- "docs/**"
25+
- "**.md"
26+
- "**.mdx"
27+
- "**.png"
28+
- "**.jpg"
29+
- "**.gif"
30+
pull_request:
31+
branches:
32+
- "main"
33+
- "v*-dev"
34+
paths:
35+
- ".github/workflows/pack.yaml"
36+
- "pack/**"
37+
38+
env:
39+
INPUT_PYTHON_VERSION: 3.11
40+
INPUT_USERNAME: gpustack
41+
INPUT_PASSWORD: ${{ secrets.CI_DOCKERHUB_PASSWORD }}
42+
INPUT_NAMESPACE: gpustack
43+
INPUT_REPOSITORY: guidellm-box
44+
45+
jobs:
46+
pack:
47+
runs-on: ubuntu-22.04
48+
timeout-minutes: 360
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
fetch-tags: true
55+
persist-credentials: false
56+
- name: Maximize Docker Build Space
57+
uses: gpustack/.github/.github/actions/maximize-docker-build-space@main
58+
with:
59+
deep-clean: true
60+
root-reserve-mb: 20480
61+
- name: Setup BuildX Cache
62+
id: setup-buildx-cache
63+
uses: actions/cache@v4
64+
with:
65+
path: ${{ github.workspace }}/.cache
66+
key: cache-mount-${{ hashFiles('uv.lock') }}
67+
- name: Restore BuildX Cache
68+
uses: reproducible-containers/buildkit-cache-dance@v3
69+
with:
70+
builder: ${{ steps.setup-buildx.outputs.name }}
71+
cache-dir: ${{ github.workspace }}/.cache
72+
dockerfile: ${{ github.workspace }}/Dockerfile
73+
skip-extraction: ${{ steps.setup-buildx-cache.outputs.cache-hit }}
74+
- name: Setup QEMU
75+
uses: docker/setup-qemu-action@v3
76+
with:
77+
image: tonistiigi/binfmt:qemu-v9.2.2
78+
platforms: "arm64"
79+
- name: Setup BuildX
80+
uses: docker/setup-buildx-action@v3
81+
with:
82+
driver-opts: |
83+
network=host
84+
env.BUILDKIT_STEP_LOG_MAX_SIZE=-1
85+
env.BUILDKIT_STEP_LOG_MAX_SPEED=-1
86+
- name: Login DockerHub
87+
if: ${{ github.event_name != 'pull_request' }}
88+
uses: docker/login-action@v3
89+
with:
90+
username: ${{ env.INPUT_USERNAME }}
91+
password: ${{ env.INPUT_PASSWORD }}
92+
- name: Get Metadata
93+
id: metadata
94+
uses: docker/metadata-action@v5
95+
with:
96+
images: "${{ env.INPUT_NAMESPACE }}/${{ env.INPUT_REPOSITORY }}"
97+
tags: |
98+
type=ref,event=pr
99+
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}
100+
type=sha,prefix=dev-,enable=${{ github.ref == 'refs/heads/main' }}
101+
type=ref,event=branch,enable=${{ contains(github.ref, 'refs/heads/v') && endsWith(github.ref, '-dev') }}
102+
type=sha,prefix={{branch}}-,enable=${{ contains(github.ref, 'refs/heads/v') && endsWith(github.ref, '-dev') }}
103+
type=pep440,pattern={{raw}}
104+
type=pep440,pattern=v{{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc') }}
105+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc') }}
106+
flavor: |
107+
latest=false
108+
- name: Get Cache Ref
109+
run: |
110+
#
111+
# Use different cache ref for different branches.
112+
#
113+
# Examples:
114+
# CACHE_FROM_REF
115+
# - vX.Y.Z -> "gpustack/build-cache:guidellm-box-${VERSION|DEFAULT_BRANCH}"
116+
# - PR/PUSH to branch -> "gpustack/build-cache:guidellm-box-${BRANCH|DEFUALT_BRANCH}"
117+
# CACHE_TO_REF
118+
# - vX.Y.Z -> "gpustack/build-cache:guidellm-box-${VERSION}"
119+
# - PUSH to branch -> "gpustack/build-cache:guidellm-box-${BRANCH}"
120+
#
121+
# Stories:
122+
# CACHE_FROM_REF
123+
# - Release tag v0.7.0rc1 -> gpustack/build-cache:guidellm-box-v0.7, if not found, fallback to gpustack/build-cache:guidellm-box-main
124+
# - Release tag v0.7.0 -> gpustack/build-cache:guidellm-box-v0.7
125+
# - PR to "main" branch -> gpustack/build-cache:guidellm-box-main
126+
# - PR to "v0.7-dev" branch -> gpustack/build-cache:guidellm-box-v0.7, if not found, fallback to gpustack/build-cache:guidellm-box-main
127+
# - Push to "main" branch -> gpustack/build-cache:guidellm-box-main
128+
# - Push to "v0.7-dev" branch -> gpustack/build-cache:guidellm-box-v0.7, if not found, fallback to gpustack/build-cache:guidellm-box-main
129+
# CACHE_TO_REF
130+
# - Release tag v0.7.0rc1 -> gpustack/build-cache:guidellm-box-v0.7
131+
# - Release tag v0.7.0 -> gpustack/build-cache:guidellm-box-v0.7
132+
# - PR to "main" branch -> gpustack/build-cache:guidellm-box-main
133+
# - PR to "v0.7-dev" branch -> gpustack/build-cache:guidellm-box-v0.7
134+
# - Push to "main" branch -> gpustack/build-cache:guidellm-box-main
135+
# - Push to "v0.7-dev" branch -> gpustack/build-cache:guidellm-box-v0.7
136+
#
137+
DEFAULT_BRANCH="main"
138+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
139+
REF="${GITHUB_REF#refs/tags/}"
140+
IFS="." read -r VERSION_MAJOR VERSION_MINOR VERSION_PATCH <<< "${REF}"
141+
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}"
142+
CACHE_FROM_REF="gpustack/build-cache:guidellm-box-${VERSION}"
143+
CACHE_TO_REF="${CACHE_FROM_REF}"
144+
else
145+
REF="${GITHUB_BASE_REF:-${GITHUB_REF}}"
146+
BRANCH="${REF#refs/heads/}"
147+
BRANCH="${BRANCH%-dev}"
148+
CACHE_FROM_REF="gpustack/build-cache:guidellm-box-${BRANCH}"
149+
CACHE_TO_REF="${CACHE_FROM_REF}"
150+
fi
151+
if ! docker manifest inspect "${CACHE_FROM_REF}" >/dev/null 2>&1; then
152+
CACHE_FROM_REF="gpustack/build-cache:guidellm-box-${DEFAULT_BRANCH}"
153+
fi
154+
echo "CACHE_FROM_REF=${CACHE_FROM_REF}" >> $GITHUB_ENV
155+
echo "CACHE_TO_REF=${CACHE_TO_REF}" >> $GITHUB_ENV
156+
echo "DEBUG: GITHUB_BASE_REF=${GITHUB_BASE_REF}"
157+
echo "DEBUG: GITHUB_REF=${GITHUB_REF}"
158+
echo "DEBUG: CACHE_FROM_REF=${CACHE_FROM_REF}"
159+
echo "DEBUG: CACHE_TO_REF=${CACHE_TO_REF}"
160+
- name: Get Image Labels
161+
run: |
162+
#!/usr/bin/env bash
163+
164+
set -eo pipefail
165+
166+
LABELS=(
167+
"org.opencontainers.image.source=${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.source'] }}"
168+
"org.opencontainers.image.version=${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.version'] }}"
169+
"org.opencontainers.image.revision=${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.revision'] }}"
170+
"org.opencontainers.image.created=${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.created'] }}"
171+
)
172+
INPUT_DOCKER_MIRRORED_NAME_FILTER_LABELS=$(printf "%s;" "${LABELS[@]}")
173+
echo "INPUT_DOCKER_MIRRORED_NAME_FILTER_LABELS=${INPUT_DOCKER_MIRRORED_NAME_FILTER_LABELS}" >> $GITHUB_ENV
174+
- name: Package
175+
uses: docker/build-push-action@v6
176+
with:
177+
allow: |
178+
network.host
179+
security.insecure
180+
ulimit: |
181+
nofile=65536:65536
182+
shm-size: 16G
183+
provenance: true
184+
sbom: true
185+
push: ${{ github.event_name != 'pull_request' }}
186+
file: ${{ github.workspace }}/pack/Dockerfile
187+
context: ${{ github.workspace }}
188+
platforms: "linux/amd64,linux/arm64"
189+
build-args: |
190+
PYTHON_VERSION=${{ env.INPUT_PYTHON_VERSION }}
191+
GPUSTACK_RUNTIME_DOCKER_MIRRORED_NAME_FILTER_LABELS=${{ env.INPUT_DOCKER_MIRRORED_NAME_FILTER_LABELS }}
192+
tags: |
193+
${{ steps.metadata.outputs.tags }}
194+
labels: |
195+
${{ steps.metadata.outputs.labels }}
196+
cache-from: |
197+
type=registry,ref=${{ env.CACHE_FROM_REF }}
198+
cache-to: |
199+
${{ github.event_name != 'pull_request' && format('type=registry,mode=max,compression=gzip,ref={0},ignore-error=true', env.CACHE_TO_REF) || '' }}

0 commit comments

Comments
 (0)