Skip to content

Commit 7c594b0

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/docs into fix-docs
2 parents bb82827 + c229733 commit 7c594b0

File tree

19 files changed

+377
-210
lines changed

19 files changed

+377
-210
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Paddle API Docs
2+
docs/api/paddle @jzhang533 @sunzhongkai588 @mattheliu

.github/workflows/check-bypass.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow-name:
5+
required: true
6+
type: string
7+
secrets:
8+
github-token:
9+
required: true
10+
outputs:
11+
can-skip:
12+
description: "Whether the workflow can be skipped."
13+
value: ${{ jobs.check-bypass.outputs.can-skip }}
14+
15+
jobs:
16+
check-bypass:
17+
name: Check bypass
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
env:
22+
CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "luotao1", "SigureMo", "ooooo-create"]'
23+
outputs:
24+
can-skip: ${{ steps.check-bypass.outputs.can-skip }}
25+
steps:
26+
- name: Cleanup
27+
run: |
28+
rm -rf * .[^.]*
29+
30+
- id: check-bypass
31+
name: Check Bypass
32+
uses: PFCCLab/ci-bypass@v2
33+
with:
34+
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
non-pull-request-event-strategy: "never-skipped"
36+
type: "composite"
37+
composite-rule: |
38+
{
39+
"any": [
40+
{
41+
"type": "labeled",
42+
"label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"],
43+
"username": ${{ env.CI_TEAM_MEMBERS }}
44+
},
45+
{
46+
"type": "commented",
47+
"comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"],
48+
"username": ${{ env.CI_TEAM_MEMBERS }}
49+
}
50+
]
51+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Codestyle Check
2+
3+
on:
4+
pull_request:
5+
branches: ["develop"]
6+
7+
jobs:
8+
check-bypass:
9+
name: Check bypass
10+
if: ${{ inputs.can-skip != 'true' }}
11+
uses: ./.github/workflows/check-bypass.yml
12+
with:
13+
workflow-name: "codestyle"
14+
secrets:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
17+
check-codestyle:
18+
name: Run codestyle check
19+
needs: check-bypass
20+
if: ${{ github.repository_owner == 'PaddlePaddle' && needs.check-bypass.outputs.can-skip != 'true' }}
21+
runs-on: ubuntu-latest
22+
env:
23+
PR_ID: ${{ github.event.pull_request.number }}
24+
BRANCH: develop
25+
26+
steps:
27+
- name: Cleanup
28+
run: |
29+
rm -rf * .[^.]*
30+
31+
- name: Checkout base repo
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ github.event.pull_request.base.ref }}
35+
fetch-depth: 200
36+
37+
- name: Merge PR to test branch
38+
run: |
39+
git fetch origin pull/${PR_ID}/merge
40+
git checkout -b test FETCH_HEAD
41+
42+
- name: Install uv
43+
uses: astral-sh/setup-uv@v6
44+
with:
45+
python-version: "3.13"
46+
enable-cache: true
47+
48+
- name: Install prek
49+
run: |
50+
uv tool install prek
51+
52+
- name: Run prek
53+
run: |
54+
set +e
55+
bash -x ci_scripts/check_code.sh;EXCODE=$?
56+
exit $EXCODE

ci_scripts/check_code.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@ set +x
2222
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
2323
cd $SCRIPT_DIR/..
2424

25-
# use pre-commit 2.17
26-
if ! [[ $(pre-commit --version) == *"2.17.0"* ]]; then
27-
pip install pre-commit==2.17.0 1>nul
28-
fi
29-
3025
diff_files=$(git diff --name-only --diff-filter=ACMR ${BRANCH})
3126
num_diff_files=$(echo "$diff_files" | wc -l)
3227
echo -e "diff files between pr and ${BRANCH}:\n${diff_files}"
3328

29+
PRE_COMMIT_EXE="pre-commit"
30+
# Use prek to replace pre-commit if prek is installed
31+
if command -v prek &> /dev/null
32+
then
33+
echo "Detected prek, use prek to check code style for better performance."
34+
PRE_COMMIT_EXE="prek"
35+
else
36+
echo "prek not found, use pre-commit to check code style."
37+
fi
38+
3439
echo "Checking code style by pre-commit ..."
35-
pre-commit run --files ${diff_files};check_error=$?
40+
$PRE_COMMIT_EXE run --files ${diff_files};check_error=$?
3641

3742
if test ! -z "$(git diff)"; then
3843
echo -e '\n************************************************************************************'
@@ -47,7 +52,7 @@ if [ ${check_error} != 0 ];then
4752
echo "Your PR code style check failed."
4853
echo "Please install pre-commit locally and set up git hook scripts:"
4954
echo ""
50-
echo " pip install pre-commit==2.17.0"
55+
echo " pip install pre-commit"
5156
echo " pre-commit install"
5257
echo ""
5358
if [[ $num_diff_files -le 100 ]];then

ci_scripts/check_pr_approval.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

ci_scripts/checkapproval.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

ci_scripts/ci_start.sh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,11 @@ else
102102
fi
103103

104104
EXIT_CODE=0
105-
# 3 check code style/format.
106-
ls ${DIR_PATH}
107-
/bin/bash -x ${DIR_PATH}/check_code.sh
108-
if [ $? -ne 0 ];then
109-
EXIT_CODE=1
110-
fi
111105

112106
git merge --no-edit upstream/${BRANCH}
113107
need_check_cn_doc_files=$(find_all_cn_api_files_modified_by_pr)
114108
echo $need_check_cn_doc_files
115-
# 4 Chinese api docs check
109+
# 3 Chinese api docs check
116110
if [ "${need_check_cn_doc_files}" = "" ] ; then
117111
echo "chinese api doc fileslist is empty, skip check."
118112
else
@@ -127,7 +121,7 @@ else
127121
fi
128122
fi
129123

130-
# 5 Chinese api_label check
124+
# 4 Chinese api_label check
131125
/bin/bash -x ${DIR_PATH}/check_api_label_cn.sh
132126
if [ $? -ne 0 ];then
133127
set +x
@@ -141,18 +135,12 @@ fi
141135
if [ ${EXIT_CODE} -ne 0 ]; then
142136
set +x
143137
echo "=========================================================================================="
144-
echo "Code style check or API Chinese doc check failed! Please check the error info above carefully."
138+
echo "API Chinese doc check failed! Please check the error info above carefully."
145139
echo "=========================================================================================="
146140
set -x
147141
exit ${EXIT_CODE}
148142
fi
149143

150-
# 6 Approval check
151-
/bin/bash ${DIR_PATH}/checkapproval.sh
152-
if [ $? -ne 0 ];then
153-
exit 1
154-
fi
155-
156144
echo "PADDLE_WHL=${PADDLE_WHL}"
157145
# print preview url
158146
echo "${PREVIEW_URL_PROMPT}"

ci_scripts/report_preview_url.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@ generate_preview_url() {
1111
local file_path="$1"
1212
local pr_id="$2"
1313
local path_no_ext="${file_path%.*}"
14-
local base_url="http://preview-pr-${pr_id}.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/"
14+
15+
# Check if file ends with _en (English version)
16+
# _en.rst will only reach English preview, _en.md can be reached in both English and Chinese previews
17+
# To Simplify, we treat all _en files as English version
18+
if [[ "$path_no_ext" == *_en ]]; then
19+
local base_url="http://preview-pr-${pr_id}.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/en/"
20+
else
21+
# Use /zh/ path for Chinese version
22+
local base_url="http://preview-pr-${pr_id}.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/"
23+
fi
24+
1525
local final_url="${base_url}${path_no_ext}.html"
1626
echo "$final_url"
1727
}
1828

19-
mapfile -t all_git_files < <(git diff --name-only --diff-filter=ACMR develop | sed 's#^docs/##')
29+
# Use merge-base to find the common ancestor between PR branch and develop
30+
# This ensures we only get changes from this PR, excluding commits merged to develop after PR creation
31+
BASE_COMMIT=$(git merge-base HEAD develop 2>/dev/null || echo "develop")
32+
33+
mapfile -t all_git_files < <(git diff --name-only --diff-filter=ACMR "$BASE_COMMIT" | sed 's#^docs/##')
2034

2135
output_lines=()
2236

@@ -31,9 +45,16 @@ done
3145
if [ ${#output_lines[@]} -gt 0 ]; then
3246
cat <<-EOF
3347
<details>
34-
<summary>📚 本次 PR 文档预览链接 (点击展开)</summary>
35-
36-
以下是本次 PR 中变更文档的预览链接:
48+
<summary>📚 本次 PR 文档预览链接(点击展开)</summary>
49+
50+
<table>
51+
<tr>
52+
<td>
53+
ℹ️ <b>预览提醒</b><br>
54+
请等待 <code>Docs-NEW</code> 流水线运行完成后再点击预览链接,否则可能会看到旧版本内容或遇到链接无法访问的情况。
55+
</td>
56+
</tr>
57+
</table>
3758
3859
$(printf '%s\n' "${output_lines[@]}")
3960

docs/api/paddle/distributed/Strategy_cn.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ sharding
3535

3636
优化器分片策略,包含以下配置项:
3737

38-
- **``enable``** (bool) - 是否启用优化器分片策略。默认:False。
38+
- **enable** (bool) - 是否启用优化器分片策略。默认:False。
3939

40-
- **``stage``** (int) - 可以设置为 1、2 或 3。1 表示切分优化器状态,2 代表切分优化器状态和梯度,3 表示切分优化器状态、梯度和参数。默认:1。
40+
- **stage** (int) - 可以设置为 1、2 或 3。1 表示切分优化器状态,2 代表切分优化器状态和梯度,3 表示切分优化器状态、梯度和参数。默认:1。
4141

42-
- **``degree``** (int) - 分片的数量。默认:8。
42+
- **degree** (int) - 分片的数量。默认:8。
4343

4444
**代码示例**
4545

@@ -51,11 +51,11 @@ fused_passes
5151

5252
计算融合策略,包含以下配置项:
5353

54-
- **``enable``** (bool) - 是否启用计算融合策略。默认:False。
54+
- **enable** (bool) - 是否启用计算融合策略。默认:False。
5555

56-
- **``gemm_epilogue``** (bool) - 是否融合 ``Linear`` 层中的 ``matmul`` 和 ``add`` 计算。默认:False。
56+
- **gemm_epilogue** (bool) - 是否融合 ``Linear`` 层中的 ``matmul`` 和 ``add`` 计算。默认:False。
5757

58-
- **``dropout_add``** (bool) - 是否融合 ``dropout`` 和 ``add`` 计算。默认:False。
58+
- **dropout_add** (bool) - 是否融合 ``dropout`` 和 ``add`` 计算。默认:False。
5959

6060
**代码示例**
6161

@@ -67,11 +67,11 @@ gradient_merge
6767

6868
梯度融合策略,包含以下配置项:
6969

70-
- **``enable``** (bool) - 是否启用梯度融合策略。默认:False。
70+
- **enable** (bool) - 是否启用梯度融合策略。默认:False。
7171

72-
- **``k_steps``** (int) - 梯度融合的步数。默认:1。
72+
- **k_steps** (int) - 梯度融合的步数。默认:1。
7373

74-
- **``avg``** (bool) - 是否平均梯度。默认:True。
74+
- **avg** (bool) - 是否平均梯度。默认:True。
7575

7676
**代码示例**
7777

@@ -83,13 +83,13 @@ pipeline
8383

8484
流水线并行策略,包含以下配置项:
8585

86-
- **``enable``** (bool) - 是否启用流水线并行策略。默认:False。
86+
- **enable** (bool) - 是否启用流水线并行策略。默认:False。
8787

88-
- **``schedule_mode``** (str) - 流水线并行的调度模式。默认:1F1B。
88+
- **schedule_mode** (str) - 流水线并行的调度模式。默认:1F1B。
8989

90-
- **``micro_batch_size``** (int) - mini-batch 中包含的每个 micro-batch 的大小。默认:1。
90+
- **micro_batch_size** (int) - mini-batch 中包含的每个 micro-batch 的大小。默认:1。
9191

92-
- **``accumulate_steps``** (int) - 累积步数。默认:1。
92+
- **accumulate_steps** (int) - 累积步数。默认:1。
9393

9494
**代码示例**
9595

0 commit comments

Comments
 (0)