-
Notifications
You must be signed in to change notification settings - Fork 53
282 lines (248 loc) · 10.7 KB
/
Copy pathci.yml
File metadata and controls
282 lines (248 loc) · 10.7 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
name: CI
on:
push:
branches:
- main
- "pull-request/[0-9]+"
tags:
- '**'
# `merge_group` fires when a PR enters GitHub's merge queue. GitHub creates
# a temporary `gh-readonly-queue/main/pr-<n>-<sha>` ref containing the PR
# rebased on top of `main` + any earlier queued PRs and runs the required
# checks against it. The job names below must match the required-check
# names configured in branch protection.
merge_group:
branches: [main]
jobs:
cpu:
runs-on: linux-amd64-cpu8
container:
image: nvidia/cuda:13.2.1-cudnn-devel-ubuntu24.04
env:
UV_PROJECT_ENVIRONMENT: /tmp/flashdreams-venv
UV_LINK_MODE: copy
# Exercise the dependency branch used by current Python releases.
UV_PYTHON: "3.12"
steps:
- name: Get PR info
if: startsWith(github.ref_name, 'pull-request/')
id: get-pr-info
uses: nv-gha-runners/get-pr-info@main
- name: Install lint system dependencies
run: |
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
python3 python3-dev python3-venv \
git curl ca-certificates
- name: Checkout
uses: actions/checkout@v4
- name: Setup proxy cache
uses: nv-gha-runners/setup-proxy-cache@main
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-suffix: "cpu"
- name: Install lint dependencies
run: |
# ty needs third-party packages to resolve imports. Skip packages
# that cannot be installed on CPU-only runners:
# - transformer-engine-torch: source-only, requires GPU arch to compile
uv venv --clear
uv sync --locked --extra dev --group lint \
--no-install-package transformer-engine-torch
- name: Run linter checks
run: |
# Container runs as root but the workspace is owned by the runner
# uid -- git refuses to operate without safe.directory.
git config --global --add safe.directory "$(pwd)"
uv run --group lint pre-commit run -a
- name: Install remaining system dependencies
run: |
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
ffmpeg \
gcc g++ ninja-build \
libnccl-dev \
unzip
rm -rf /var/lib/apt/lists/*
- name: Build flashdreams wheel
run: uv build --wheel --package flashdreams
- name: Run CPU unit tests
run: uv run --no-sync pytest -m ci_cpu -v
# Documentation is built and deployed by `.github/workflows/doc.yml`.
gpu:
runs-on: linux-amd64-gpu-rtxpro6000-latest-2
timeout-minutes: 120
container:
image: nvidia/cuda:13.2.1-cudnn-devel-ubuntu24.04
options: --gpus all
env:
# Place the venv outside the workspace so uv does not interfere with
# the checkout directory owned by the runner.
UV_PROJECT_ENVIRONMENT: /tmp/flashdreams-venv
UV_LINK_MODE: copy
# imgui-bundle publishes Linux ARM64 wheels for Python 3.11+, but not
# 3.10. Keep GB300 CI on a wheel-supported interpreter and fail instead
# of attempting its large, platform-sensitive native source build.
UV_PYTHON: "3.11"
UV_NO_BUILD_PACKAGE: imgui-bundle
# Limit parallel CUDA compilation jobs to avoid OOM (each nvcc job
# uses ~9GB peak memory).
MAX_JOBS: 8
OMNIDREAMS_QUALITY_REFERENCE_REPO: ${{ vars.OMNIDREAMS_QUALITY_REFERENCE_REPO || 'nvidia/omni-dreams-samples' }}
OMNIDREAMS_QUALITY_REFERENCE_PATH: ${{ vars.OMNIDREAMS_QUALITY_REFERENCE_PATH || 'data/quality_references/single_view/omnidreams-sv-2steps-chunk2-loc6-lightvae-lighttae/239560dc-33d1-11ef-9720-00044bcbccac/reference_compare_region.mp4' }}
OMNIDREAMS_QUALITY_REFERENCE_CLIP: /tmp/omnidreams_quality_reference/reference_compare_region.mp4
OMNIDREAMS_QUALITY_ARTIFACT_DIR: /tmp/omnidreams_quality_artifacts
steps:
- name: Get PR info
if: startsWith(github.ref_name, 'pull-request/')
id: get-pr-info
uses: nv-gha-runners/get-pr-info@main
- name: Detect GPU architecture
id: gpu-arch
run: |
nvidia-smi
# Get compute capability (e.g. "12.0") and strip the dot for nvcc
# arch format (e.g. "120").
compute_cap=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '[:space:]')
arch=$(echo "${compute_cap}" | tr -d '.')
echo "arch=${arch}" >> "$GITHUB_OUTPUT"
echo "Detected GPU compute capability: ${compute_cap} -> sm_${arch}"
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
python3 python3-dev python3-venv \
ffmpeg \
gcc g++ ninja-build \
libgl1-mesa-dev \
libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev \
libnccl-dev \
curl git ca-certificates unzip
rm -rf /var/lib/apt/lists/*
- name: Setup proxy cache
uses: nv-gha-runners/setup-proxy-cache@main
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-suffix: "gpu-sm${{ steps.gpu-arch.outputs.arch }}"
# Disable default prune --ci which removes pre-built wheels but also
# invalidates git-sourced builds (timestamps change on cache restore).
# Instead we selectively trim the cache in a post step below.
prune-cache: false
- name: Install dependencies
env:
NVTE_CUDA_ARCHS: ${{ steps.gpu-arch.outputs.arch }}
run: |
uv venv --clear
uv sync --locked --extra dev
- name: Verify GPU availability
run: |
echo "Verifying GPU access..."
nvidia-smi
- name: Download Omnidreams quality reference
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
mkdir -p "$(dirname "${OMNIDREAMS_QUALITY_REFERENCE_CLIP}")"
if [ -n "${HF_TOKEN:-}" ]; then
uv run --no-sync hf download \
"${OMNIDREAMS_QUALITY_REFERENCE_REPO}" \
"${OMNIDREAMS_QUALITY_REFERENCE_PATH}" \
--repo-type dataset \
--local-dir "$(dirname "${OMNIDREAMS_QUALITY_REFERENCE_CLIP}")" \
--token "${HF_TOKEN}"
else
uv run --no-sync hf download \
"${OMNIDREAMS_QUALITY_REFERENCE_REPO}" \
"${OMNIDREAMS_QUALITY_REFERENCE_PATH}" \
--repo-type dataset \
--local-dir "$(dirname "${OMNIDREAMS_QUALITY_REFERENCE_CLIP}")"
fi
cp \
"$(dirname "${OMNIDREAMS_QUALITY_REFERENCE_CLIP}")/${OMNIDREAMS_QUALITY_REFERENCE_PATH}" \
"${OMNIDREAMS_QUALITY_REFERENCE_CLIP}"
test -s "${OMNIDREAMS_QUALITY_REFERENCE_CLIP}"
- name: Run GPU unit tests
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
FLASHDREAMS_OMNIDREAMS_QUALITY_REFERENCE_CLIP: ${{ env.OMNIDREAMS_QUALITY_REFERENCE_CLIP }}
FLASHDREAMS_OMNIDREAMS_QUALITY_EXAMPLE_DATA: "1"
FLASHDREAMS_OMNIDREAMS_QUALITY_TOTAL_BLOCKS: "4"
FLASHDREAMS_OMNIDREAMS_QUALITY_ARTIFACT_DIR: ${{ env.OMNIDREAMS_QUALITY_ARTIFACT_DIR }}
run: uv run --no-sync pytest -m ci_gpu -v
- name: Upload Omnidreams quality artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: omnidreams-quality-artifacts
path: ${{ env.OMNIDREAMS_QUALITY_ARTIFACT_DIR }}
if-no-files-found: ignore
- name: Trim uv cache for upload
if: always()
run: |
cache_dir="${UV_CACHE_DIR:-/github/home/.cache/uv}"
echo "=== Cache size before trim ==="
du -sh "${cache_dir}" || true
du -sh "${cache_dir}"/*/ 2>/dev/null || true
# Remove pre-built (downloaded) wheels -- these are re-downloaded
# quickly from the proxy cache on each run.
rm -rf "${cache_dir}/wheels-v6"
# Remove unzipped wheel archives -- uv can re-extract from .whl
# files in sdists-v9/ on next run.
rm -rf "${cache_dir}/archive-v0"
# Remove build artifacts from git checkouts (build/, *.egg-info,
# __pycache__) that bloat the cache but aren't needed for reuse.
find "${cache_dir}/git-v0/checkouts" \
\( -name "build" -o -name "*.egg-info" -o -name "__pycache__" \) \
-type d -exec rm -rf {} + 2>/dev/null || true
# Remove editable installs -- these are in-repo workspace members
# that get rebuilt instantly from source on every sync.
rm -rf "${cache_dir}/sdists-v9/editable"
echo ""
echo "=== Cache size after trim ==="
du -sh "${cache_dir}" || true
du -sh "${cache_dir}"/*/ 2>/dev/null || true
echo ""
echo "=== Cached built wheels (sdists-v9) ==="
find "${cache_dir}/sdists-v9" -name "*.whl" -exec ls -lh {} \; 2>/dev/null || true
# ===========================================================================
# Publish to PyPI -- runs only on main after cpu + gpu jobs pass.
# ===========================================================================
publish-pypi:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [cpu, gpu]
runs-on: linux-amd64-cpu8
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Build wheel
run: uv build --wheel --package flashdreams
- name: Previously published check
id: previously_published
run: |
version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' flashdreams/flashdreams/_version.py)
echo "version=$version"
if curl -sSf "https://pypi.org/simple/flashdreams/" \
| grep -q "flashdreams-${version}-"; then
echo "Version $version already exists on PyPI -- skipping publish"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Version $version not found on PyPI -- will publish"
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish to PyPI
if: steps.previously_published.outputs.skip != 'true'
run: >
uv publish
--publish-url https://upload.pypi.org/legacy/
--check-url https://pypi.org/simple/
--token ${{ secrets.PYPI_API_TOKEN }}
dist/*