Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/ms-swift-quick-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# ms-swift 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. See the
# engine's `workflow_call.inputs` block for the full input contract.
#
# This file replaced the legacy monolithic workflow of the same name
# (hard cutover; the old implementation lives in git history around
# 4ee7f63). Cache keys (monitor-state-ms-swift-*) and artifact names
# are derived from project=ms-swift, not from the workflow name, so
# monitor state carried over unchanged.

name: ms-swift-quick-start

concurrency:
# format() is load-bearing: 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' && 'ms-swift-quick-start-schedule' || 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) dispatch runs
# already live in unique groups so there's nothing to cancel.
cancel-in-progress: false

on:
schedule:
# Run every 3 hours: '30 */3 * * *' fires at minute 30 of every
# 3rd hour (00:30, 03:30, 06:30, ..., 21:30). GitHub Actions caps
# schedule at 5 min minimum, so tighter cadences need
# workflow_dispatch instead.
- cron: '30 */3 * * *'
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/ms-swift/**'
- 'tests/ms-swift/**'

permissions:
contents: read

jobs:
ms-swift-quick-start:
uses: ./.github/workflows/quick-start-template.yml
with:
# Namespaces cache keys (monitor-state-ms-swift-*), artifacts
# (ms-swift-quick-start-<run_id>) and the test working dir
# (workflows/projects/ms-swift).
project: ms-swift
# 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-1"]'
image: swr.cn-south-1.myhuaweicloud.com/ascendhub/cann:9.1.0-910b-ubuntu22.04-py3.12
container_options: >-
--volume=/data/ci-cache/modelscope/ms-swift:/root/.cache/modelscope
timeout_minutes: 60
upstream_repo: modelscope/ms-swift
# Same URL the legacy workflow monitors: doc-hash state carries
# over via the shared monitor-state-ms-swift- cache prefix.
# 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/ms-swift/quick_start.md'
doc_path: https://github.com/Ascend/ascend_docs/blob/main/sources/ms-swift/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.ms-swift.test_quick_start_ascend -v 2>&1
770 changes: 770 additions & 0 deletions .github/workflows/quick-start-template.yml

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions .github/workflows/schemas/result.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/Ascend/ascend_docs/blob/main/.github/workflows/schemas/result.schema.json",
"title": "Guard job result",
"description": "Machine-readable result.json uploaded by every example or quick-start job, success or failure.",
"type": "object",
"required": [
"trigger",
"target_repo",
"target_ref",
"path",
"image",
"job_status"
],
"properties": {
"trigger": {
"type": "string",
"description": "How this run was started. Typical values: workflow_dispatch, schedule."
},
"target_repo": {
"type": "string",
"pattern": "^[^/]+/[^/]+$",
"description": "Repository that was checked out and tested, owner/name."
},
"target_ref": {
"type": "string",
"minLength": 1,
"description": "Branch, tag, or SHA that was tested."
},
"path": {
"type": "string",
"minLength": 1,
"description": "Example script or documented path that this job exercised."
},
"image": {
"type": "string",
"minLength": 1,
"description": "Container image used to run the job."
},
"job_status": {
"type": "string",
"enum": ["success", "failure", "cancelled"],
"description": "GitHub job conclusion for this result."
}
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ sources/pytorch/api_doc.rst
.tasks/
venv/
_static/ascend_config.json
__pycache__/
*.pyc
*.pyo
3 changes: 2 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.venv', 'README.md']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.venv', 'README.md',
'.github', 'tests']


# -- Options for HTML output -------------------------------------------------
Expand Down
12 changes: 10 additions & 2 deletions sources/ms-swift/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
ms-swift
========

NPU 相关文档由 ms-swift 官方维护,请访问官方文档站:
ms-swift 通用文档由 ms-swift 官方维护。本页收录 Ascend NPU 适配的快速上手。

@zheliuyu zheliuyu Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

感谢你的贡献。

就像这里的注释所说,以及以下 RFC 和 PR 所讨论的那样:如果 ms-swift 仓中提供了环境安装指导以及 Ascend NPU 的快速上手文档,我们应该复用它们,而不是在 Ascend/docs 中额外维护一份。

如果您觉得 ms-swift 的快速上手文档不足以指导用户使用,建议直接将此文档内贡献在 ms-swift 项目中,Ascend/docs 会同步更新。

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.

感谢你的答复。

后续也会往ms-swift社区合并关于ascend npu的快速开始的文档。当前ms-swift社区只有一份cuda相关的快速开始文档(https://swift.readthedocs.io/zh-cn/latest/GetStarted/Quick-start.html),npu只是简单描述了是支持的硬件(https://swift.readthedocs.io/zh-cn/latest/GetStarted/SWIFT-installation.html)。

计划是现在ascend doc这个仓库合并ms-swift社区暂时没有npu的快速开始文档,后续考虑往ms-swift贡献对应的文档。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

NPU 的环境安装和快速开始文档在这里:https://swift.readthedocs.io/zh-cn/latest/BestPractices/NPU-support.html
在 Ascend/docs,即本项目中,我也添加了它 https://github.com/Ascend/docs/blob/main/index.rst#ms-swift

所以这里并不建议在额外添加一份 ms-swift 的快速开始文档。

如果仅是想为 Ascend/docs 增加文档测试看护的能力,可以选择其他项目。


.. toctree::
:maxdepth: 2

quick_start

外部链接
--------

- GitHub:`ms-swift <https://github.com/modelscope/ms-swift>`_
- 文档中心:`SWIFT Docs <https://swift.readthedocs.io/zh-cn/latest/>`_
- NPU 支持:`NPU Support <https://swift.readthedocs.io/zh-cn/latest/BestPractices/NPU-support.html>`_
- NPU 官方文档:`NPU Support <https://swift.readthedocs.io/zh-cn/latest/BestPractices/NPU-support.html>`_
Loading
Loading