Repository navigation
103 lines (98 loc) · 5.38 KB
/
Copy pathdiffusers-quick-start.yml
File metadata and controls
103 lines (98 loc) · 5.38 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
# diffusers quick start guard - project thin trigger.
#
# Calls the common engine .github/workflows/quick-start-template.yml;
# this file only declares what varies per project: schedule,
# concurrency, runner, container image + options, upstream repo,
# monitored doc, and the test entry command. The guard loop, cache
# I/O, state relay and publishing all live in the engine.
#
# Device mounts: a2-2 runner exposes both davinci devices (check-torch
# expects `count: 2`); the doc examples themselves are single-card and
# always address device `npu:0`.
#
# Modelscope cache: the doc's slowest block downloads SD 3.5 Large
# Turbo (~25 GB net), so unlike run-scoped container-local caches,
# this project persists downloads across runs. There is NO
# project-isolated mount here (container_options stays empty):
# container `--volume` isolation was verified NOT to work on these
# K8s-based runners (roll-quick-start bind-mounts its own subdir, yet
# its purge still sees the shared root), so every project shares the
# runner's NFS-backed /root/.cache/modelscope. Cross-run safety comes
# from doc_test.model_cache.purge_modelscope_corrupt instead: it never
# touches modelscope's ._____temp in-flight area and only purges
# shards whose safetensors header is CONFIRMED broken (transient NFS
# read errors are not treated as corruption), so one project's purge
# cycle can no longer delete another run's in-flight downloads.
name: diffusers-quick-start
concurrency:
# PR runs share one group PER PR: two pushes to the same PR would
# otherwise run in parallel against the same shared NFS cache,
# writing the same ._____temp file paths concurrently (modelscope's
# weak file lock does not mutually exclude across containers on
# NFS). Shared group + cancel-in-progress: false = the newer push
# queues behind the older run instead of racing it; each queued run
# still tests its own head SHA. Schedule keeps its fixed group so
# cron cycles never cancel each other's outcome writeback.
# format() is load-bearing in the dispatch arm: a '||' between
# 'manual-' and github.run_id would short-circuit on the truthy
# literal and every dispatch would share one 'manual-' group.
group: ${{ github.event_name == 'schedule' && 'diffusers-quick-start-schedule' || (github.event_name == 'pull_request' && format('diffusers-quick-start-pr-{0}', github.event.pull_request.number)) || format('manual-{0}', github.run_id) }}
# cancel-in-progress: false because (1) a schedule run cancelled
# mid-way loses its outcome writeback - the outcome is what makes
# the retry mechanism work, and the 'if: always()' guard isn't
# enough when the container is being torn down; (2) queued PR runs
# reuse whatever cache entries the in-flight run has already
# completed, so letting it finish is cheaper than cancelling it.
cancel-in-progress: false
on:
schedule:
# Twice a day, 12 h apart: UTC 05:20 and 17:20
# (Beijing +8). All quick-start guards share this cadence; the
# (hour, minute) slot is staggered across the guards so the NPU
# runners do not all fire at the same time.
- cron: '20 5,17 * * *'
workflow_dispatch:
# PR trigger: docs/tests changes get a guard run. paths filter avoids burning
# the self-hosted NPU runner on unrelated PRs. `pull_request` (not
# `pull_request_target`): contents: read is enough, no write-token risk.
pull_request:
branches: [main]
paths:
- 'sources/Diffusers/**'
- 'tests/diffusers/**'
permissions:
contents: read
jobs:
diffusers-quick-start:
uses: ./.github/workflows/quick-start-template.yml
with:
# Namespaces cache keys (monitor-state-diffusers-*), artifacts
# (diffusers-quick-start-<run_id>) and the test working dir
# (workflows/tests/diffusers).
project: diffusers
# Self-hosted NPU runner for the test job only; the engine pins
# the cache I/O jobs (restore-cache / publish-and-persist) to
# GitHub-hosted ubuntu-latest.
test_runner: '["linux-aarch64-a2-2"]'
image: swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.1.0-910b-ubuntu22.04-py3.12
container_options: ''
# 4h: the test's per-command timeout is 2h (first cold-cache run
# downloads ~25 GB; modelscope parallelizes across files, and the
# observed aggregate on the cluster egress is ~15 MB/s ≈ 30 min);
# the job budget must exceed the single slowest command plus the
# rest of the doc's blocks.
timeout_minutes: 240
upstream_repo: huggingface/diffusers
# Doc URL points to the upstream Ascend/docs repo. {0} is filled by the
# engine: PR head SHA on PR runs, 'main' otherwise. Same-repo PRs (head
# SHA exists on Ascend/docs) test the PR-version of the doc; fork PRs
# (head SHA on a fork) 404 on doc fetch - accepted, since the content
# lands on Ascend/docs post-merge.
doc_url: 'https://raw.githubusercontent.com/Ascend/docs/{0}/sources/Diffusers/quick_start.md'
doc_path: https://github.com/Ascend/docs/blob/main/sources/Diffusers/quick_start.md
# cwd is the repo root inside the `workflows` checkout (matches
# engine template's `working-directory: workflows`); env contract
# (MONITORED_DOC_URL / UPSTREAM_REF / NPU_READY) is injected by the
# engine. All project env prep and installs live in the test
# subclass's prepare_environment hook.
test_command: python -m unittest tests.diffusers.test_quick_start_ascend -v 2>&1