Skip to content

[feature] 迁移 cache-dit 的 examples 守护管线到 docs 仓 - #207

Merged
hipudding merged 4 commits into
Ascend:mainfrom
yzeyu71:feat/cache-dit-examples-guard
Oct 15, 2026
Merged

hipudding merged 4 commits into
Ascend:mainfrom
yzeyu71:feat/cache-dit-examples-guard

Conversation

@yzeyu71

@yzeyu71 yzeyu71 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

参考 #200(accelerate examples guard)迁移范式,将 workflows 仓 projects/cache-dit 的 examples 守护管线迁移到 docs 仓,新增 4 个文件、共 379 行。

迁移清单

文件 说明
examples-guards/cache-dit/examples_manifest.yaml 1 条 supported(generate.py 单卡)+ 7 条 unsupported,与源文件逐字段一致;保留 scan.unit: files 与 supported/unsupported 的有意重叠(generate.py 单卡可用、torchrun 分布式变体不可用)
examples-guards/cache-dit/scripts/setup_example.sh 模型下载改造(见下)
examples-guards/cache-dit/scripts/run_example.sh 原样平移(含 EXEC/torchrun launcher 支持)
.github/workflows/cache-dit-examples.yml 薄触发器,对接 examples-template.yml 共享引擎

模型下载策略(HF 优先 + gated 例外)

  1. HF 优先:resolve_model 与其他项目一致——共享 HF hub 缓存命中 → 冷池经 HF_ENDPOINT(缺省 hf-mirror.com)snapshot_download 自填。
  2. 保留 ModelScope 兜底(仅 gated):FLUX.1-dev(black-forest-labs)是 HF gated repo 且本仓不注入 HF_TOKEN,冷池时 HF fill 必然 401/403;保留 AI-ModelScope 镜像兜底(落入 per-run 临时目录),注释中明确边界与持久修复路径(cache-seed plant 或 HF_TOKEN secret)。非 gated 模型不受影响,一律走 HF。

manifest 注释补全

overlay_args 8 个参数逐一注释:位置参数 flux(示例选择)、--model-path、--attn _native_npu(NPU attention 后端)、--cache(DBCache 被测能力)、--cpu-offload(bf16 全量权重超 910B4 单卡显存)、--warmup/--repeat/--steps(smoke 最小开销取值)。

关键参数(与 workflows 仓一致)

  • project: cache-dit、upstream_repo: vipshop/cache-dit、max_parallel: 4
  • 镜像 cann:9.1.0-910b-ubuntu22.04-py3.12、runner linux-aarch64-a2-1、timeout 120min
  • schedule 保持注释(bring-up 策略)
  • unsupported 长注释全部保留:examples/api/* 上游 ImportError(PR #752)、torchrun 分布式 OOM/Z-Image complex64 崩溃、ptq svdq CUDA kernel、ray CUDA 硬编码

Test plan

  • manifest 结构化数据与 workflows 仓源文件逐字段一致(PyYAML 解析比对,含 scan.unit 与重叠语义)
  • setup_example.sh diff 严格限定于 resolve_model / setup_flux 注释区域,ModelScope 兜底代码完整保留
  • run_example.sh 与源文件逐字节一致(EOL 归一后)
  • 触发器输入与 examples-template.yml 引擎契约匹配(project / upstream_repo / target_ref / max_parallel)
  • 手动 dispatch cache-dit-examples 验证 manifest-check 与 run-example 矩阵(首次冷池:HF fill 失败 → ModelScope 镜像兜底下载)
  • 手动跑通几轮后放开 schedule cron

@yzeyu71 yzeyu71 changed the title 迁移 cache-dit 的 examples 守护管线到 docs 仓 [feature] 迁移 cache-dit 的 examples 守护管线到 docs 仓 Oct 10, 2026
on:
# Temporarily disabled to save NPU runner time. Re-enable when ready:
# schedule:
# - cron: '30 */6 * * *'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要开启定时任务一天一次

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已开启

参考 PR Ascend#200(accelerate)迁移范式,将 workflows 仓 projects/cache-dit
的 examples 守护管线平移到 docs 仓 examples-guards/cache-dit:
- examples_manifest.yaml:1 supported + 7 unsupported 逐字段平移
  (保留 scan.unit: files 与 supported/unsupported 的有意重叠),
  overlay_args 补充参数注释
- scripts/setup_example.sh:模型下载 HF 优先(HF_ENDPOINT 缺省
  hf-mirror.com);FLUX.1-dev 为 HF gated repo 且本仓无 HF_TOKEN,
  按约定保留 ModelScope 镜像兜底(AI-ModelScope/FLUX.1-dev,注释
  明确边界与持久修复路径),非 gated 模型一律走 HF
- scripts/run_example.sh:原样平移(含 EXEC/torchrun 支持)
- .github/workflows/cache-dit-examples.yml:薄触发器对接
  examples-template.yml 共享引擎,schedule 保持注释(bring-up 策略)
Signed-off-by: yangzeyu <yangzeyu7@huawei.com>
Add a pull_request trigger to cache-dit-examples.yml so changes to the
guard assets (examples-guards/cache-dit/**) or this workflow file re-run
the guard against the latest upstream release, catching regressions
before merge. Mirrors the peft-quick-start example. The PR branch is
handled by the shared examples-template engine (upstream/main already
supports pull_request in the Decide target step).

Co-Authored-By: CodeBuddy <https://codebuddy.ai>
@yzeyu71
yzeyu71 force-pushed the feat/cache-dit-examples-guard branch from 4e8332b to b5356e3 Compare October 14, 2026 06:11
Run 38520772429 hit the 120-minute job timeout in "Setup example
environment" (119.7 min, "Run example" never started). The setup was
downloading FLUX.1-dev from ModelScope into a per-job workspace dir:
the HuggingFace leg 401s (gated repo, no HF_TOKEN in this repo) and
the ModelScope fallback was never published into the shared runner
cache, so every run re-downloaded all 57.89 GB, 23.8 GB of it the
single-file flux1-dev.safetensors the pipeline never reads.

- scripts/hub_cache.py: resolve FLUX_MODEL_PATH the way peft does. A
  snapshot in HF_HOME/hub that holds every required file is used as is,
  with zero network; a miss is downloaded (HuggingFace first,
  ModelScope fallback) into this job's staging dir on the same volume,
  checked, and renamed file by file into snapshots/<sha>, with
  refs/main written last so a half-published snapshot is never a hit.
- allow_patterns trims the fetch to the diffusers component tree
  FluxPipeline.from_pretrained reads: 57.89 GB -> 33.75 GB, dropping
  the duplicate single-file weights (flux1-dev.safetensors 23.8 GB,
  ae.safetensors), dev_grid.jpg and the repo metadata.
- setup_example.sh: drop the HF_ENDPOINT=hf-mirror override (the repo
  convention is huggingface.co / the engine default), replace the
  inline resolve_model helper with the shared hub_cache.py, and
  install the ModelScope fallback up front.
- timeout_minutes 120 -> 180 so a cold-cache fill fits.
@hipudding
hipudding merged commit e0e333e into Ascend:main Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants