Skip to content

Commit 672c5e1

Browse files
authored
Merge branch 'PaddlePaddle:develop' into sot/getattribute2getattr
2 parents a56dff7 + 6a5c516 commit 672c5e1

File tree

274 files changed

+14450
-1891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+14450
-1891
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ on:
44
push:
55
branches:
66
- develop
7+
- release/*
78

89
env:
10+
BRANCH: ${{ github.ref_name }}
911
COMMIT_ID: ${{ github.sha }}
1012
TASK: PaddleFormers-CE-${{ github.sha }}-build
1113
CE_name: build-ce
@@ -46,8 +48,8 @@ jobs:
4648
-v $work_dir:/workspace \
4749
-v /home/.cache/pip:/home/.cache/pip \
4850
-v /home/paddle-1/models/:/home/models/ \
49-
-e BRANCH \
50-
-e COMMIT_ID \
51+
-e "BRANCH=$BRANCH" \
52+
-e "COMMIT_ID=$COMMIT_ID" \
5153
-e work_dir \
5254
-e ce_scripts \
5355
-e no_proxy \
@@ -71,7 +73,10 @@ jobs:
7173
git config --global user.email "paddle_ce@example.com"
7274
git pull
7375
git submodule update --init --recursive --force
74-
git checkout -b $COMMIT_ID $COMMIT_ID
76+
git remote add upstream https://github.com/PaddlePaddle/PaddleFormers.git
77+
echo "Checking out ${BRANCH}..."
78+
git fetch upstream ${BRANCH}:${BRANCH}
79+
git checkout ${BRANCH}
7580
git log --pretty=oneline -10
7681
'
7782

.github/workflows/cherry-pick.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: Cherry Pick
2+
3+
on:
4+
pull_request_target:
5+
branches: [develop]
6+
types: [closed, labeled]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
issues: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
cherry-pick:
19+
if: >
20+
github.event.pull_request.merged == true &&
21+
(
22+
github.event.action == 'labeled' ||
23+
contains(join(github.event.pull_request.labels.*.name, ' '), 'cherry-pick')
24+
)
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
32+
33+
- name: Cherry Pick
34+
env:
35+
GH_TOKEN: ${{ secrets.CHERRY_PICK_BOT_TOKEN }}
36+
PR_NUMBER: ${{ github.event.pull_request.number }}
37+
PR_TITLE: ${{ github.event.pull_request.title }}
38+
PR_BODY: ${{ github.event.pull_request.body }}
39+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
40+
MERGE_COMMIT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
41+
BOT_USERNAME: ShigureNyako
42+
BOT_EMAIL: shigure_nyako@outlook.com
43+
REPO_NAME: ShigureNyako/PaddleFormers
44+
run: |
45+
# Function to post comment
46+
post_comment() {
47+
gh pr comment "$PR_NUMBER" --body "$1"
48+
}
49+
50+
# Configure git for the original author
51+
echo "Fetching author info for $PR_AUTHOR..."
52+
AUTHOR_INFO=$(gh api "/users/$PR_AUTHOR" --jq '{email: .email, name: .name}')
53+
AUTHOR_EMAIL=$(echo "$AUTHOR_INFO" | jq -r '.email')
54+
AUTHOR_NAME=$(echo "$AUTHOR_INFO" | jq -r '.name')
55+
56+
if [ "$AUTHOR_EMAIL" = "null" ] || [ -z "$AUTHOR_EMAIL" ]; then
57+
AUTHOR_EMAIL="${PR_AUTHOR}@users.noreply.github.com"
58+
echo "Author email not found, using default: $AUTHOR_EMAIL"
59+
fi
60+
if [ "$AUTHOR_NAME" = "null" ] || [ -z "$AUTHOR_NAME" ]; then
61+
AUTHOR_NAME="${PR_AUTHOR}"
62+
echo "Author name not found, using username: $AUTHOR_NAME"
63+
fi
64+
65+
git config user.name "$AUTHOR_NAME"
66+
git config user.email "$AUTHOR_EMAIL"
67+
68+
# Capture current SHA to return to later
69+
ORIGINAL_HEAD_SHA=$(git rev-parse HEAD)
70+
71+
# Get labels
72+
LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')
73+
74+
if [ -z "$LABELS" ]; then
75+
echo "No labels found."
76+
exit 0
77+
fi
78+
79+
# Loop through labels
80+
while read -r label; do
81+
if [[ "$label" == cherry-pick:* ]]; then
82+
TARGET_BRANCH=$(echo "${label#cherry-pick:}" | xargs)
83+
84+
if [ -z "$TARGET_BRANCH" ]; then
85+
echo "Empty target branch for label '$label', skipping."
86+
continue
87+
fi
88+
89+
echo "Processing cherry-pick to $TARGET_BRANCH"
90+
91+
# Check if target branch exists on remote
92+
if ! git ls-remote --exit-code --heads origin "$TARGET_BRANCH"; then
93+
echo "Target branch $TARGET_BRANCH does not exist."
94+
post_comment "❌ Cherry-pick failed: Target branch \`$TARGET_BRANCH\` does not exist."
95+
continue
96+
fi
97+
98+
# Create a new branch for the cherry-pick
99+
NEW_BRANCH="cherry-pick/$PR_NUMBER/$TARGET_BRANCH"
100+
101+
# Clean up local branch if it exists (from previous run)
102+
if git show-ref --verify --quiet "refs/heads/$NEW_BRANCH"; then
103+
git branch -D "$NEW_BRANCH"
104+
fi
105+
106+
# Fetch the target branch and checkout a new branch from it
107+
git fetch origin "$TARGET_BRANCH"
108+
git checkout -b "$NEW_BRANCH" "origin/$TARGET_BRANCH"
109+
110+
# Cherry pick
111+
# Try standard cherry-pick first (for squash merges or single commits)
112+
if git cherry-pick "$MERGE_COMMIT_SHA"; then
113+
echo "Cherry-pick successful."
114+
else
115+
echo "Standard cherry-pick failed, trying with -m 1 (for merge commits)..."
116+
git cherry-pick --abort
117+
if git cherry-pick -m 1 "$MERGE_COMMIT_SHA"; then
118+
echo "Cherry-pick with -m 1 successful."
119+
else
120+
echo "Cherry-pick failed."
121+
git cherry-pick --abort
122+
post_comment "❌ Cherry-pick failed: Conflicts detected when cherry-picking to \`$TARGET_BRANCH\`. Please resolve manually."
123+
124+
# Cleanup
125+
git checkout "$ORIGINAL_HEAD_SHA"
126+
git branch -D "$NEW_BRANCH"
127+
continue
128+
fi
129+
fi
130+
131+
# Push
132+
# Construct authenticated URL for the fork
133+
FORK_URL_AUTH="https://${BOT_USERNAME}:${GH_TOKEN}@github.com/${REPO_NAME}.git"
134+
135+
echo "Pushing to fork..."
136+
git push "$FORK_URL_AUTH" "$NEW_BRANCH" --force
137+
138+
# Create PR
139+
# If PR_TITLE starts with "[", don't insert an extra space.
140+
if [ "${PR_TITLE:0:1}" = "[" ]; then
141+
NEW_TITLE="[$TARGET_BRANCH]$PR_TITLE"
142+
else
143+
NEW_TITLE="[$TARGET_BRANCH] $PR_TITLE"
144+
fi
145+
146+
NEW_BODY="$PR_BODY
147+
148+
Cherry-pick of #$PR_NUMBER to \`$TARGET_BRANCH\`.
149+
150+
Merged in dev: #$PR_NUMBER <!-- For pass CI -->"
151+
152+
# Prepare head ref for PR creation (owner:branch)
153+
HEAD_REF="${BOT_USERNAME}:${NEW_BRANCH}"
154+
155+
# Check if PR already exists
156+
EXISTING_PR=$(gh pr list --base "$TARGET_BRANCH" --head "$NEW_BRANCH" --json url --jq '.[0].url')
157+
158+
if [ -n "$EXISTING_PR" ]; then
159+
echo "PR already exists: $EXISTING_PR"
160+
post_comment "ℹ️ Cherry-pick PR already exists: $EXISTING_PR"
161+
else
162+
# Create PR using gh CLI, ignoring errors because of "Resource not accessible" false positives
163+
gh pr create --base "$TARGET_BRANCH" --head "$HEAD_REF" --title "$NEW_TITLE" --body "$NEW_BODY" || true
164+
165+
# Wait a bit for eventual consistency
166+
sleep 2
167+
168+
# Search for the created PR
169+
CREATED_PR_URL=$(gh pr list --head "$NEW_BRANCH" --state all --json url --jq '.[0].url')
170+
171+
if [ -n "$CREATED_PR_URL" ]; then
172+
echo "Created PR: $CREATED_PR_URL"
173+
post_comment "✅ Cherry-pick successful! Created PR: $CREATED_PR_URL"
174+
175+
# Request review
176+
gh pr review-request "$CREATED_PR_URL" --reviewer "$PR_AUTHOR" || true
177+
else
178+
echo "Failed to create PR."
179+
post_comment "❌ Cherry-pick failed: Could not create PR to \`$TARGET_BRANCH\`."
180+
continue
181+
fi
182+
fi
183+
184+
# Cleanup for next loop
185+
git checkout "$ORIGINAL_HEAD_SHA"
186+
git branch -D "$NEW_BRANCH"
187+
fi
188+
done <<< "$LABELS"
189+
190+
- name: Remove Cherry Pick Labels
191+
env:
192+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193+
PR_NUMBER: ${{ github.event.pull_request.number }}
194+
REPO_NAME: ${{ github.repository }}
195+
run: |
196+
LABELS=$(gh pr view "$PR_NUMBER" --repo "$REPO_NAME" --json labels --jq '.labels[].name')
197+
if [ -z "$LABELS" ]; then
198+
exit 0
199+
fi
200+
while read -r label; do
201+
if [[ "$label" == cherry-pick:* ]]; then
202+
echo "Removing label: $label"
203+
gh pr edit "$PR_NUMBER" --repo "$REPO_NAME" --remove-label "$label"
204+
fi
205+
done <<< "$LABELS"

.github/workflows/ci_iluvatar.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,30 @@ jobs:
6464
python -m pip install -r requirements.txt
6565
6666
echo "Uninstall PaddlePaddle and PaddleFormers beforehand..."
67-
python -m pip uninstall paddlepaddle paddle-iluvatar-gpu paddleformers -y
67+
python -m pip uninstall paddlepaddle paddle-iluvatar-gpu paddlepaddle-iluvatar paddleformers -y
6868
69-
retry_count=0
70-
max_retries=3
7169
echo "Install PaddlePaddle..."
72-
while [ $retry_count -lt $max_retries ]; do
73-
if python -m pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/; then
74-
echo "PaddlePaddle installation successful"
75-
break
76-
else
77-
retry_count=$((retry_count + 1))
78-
if [ $retry_count -lt $max_retries ]; then
79-
echo "PaddlePaddle installation failed, retrying in 10 seconds... (Attempt $retry_count/$max_retries)"
80-
sleep 10
81-
else
82-
echo "PaddlePaddle installation failed after $max_retries attempts, Please try rerun this job."
83-
exit 1
84-
fi
85-
fi
86-
done
87-
8870
retry_count=0
71+
max_retries=3
8972
while [ $retry_count -lt $max_retries ]; do
90-
if python -m pip install --pre paddle-iluvatar-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/ixuca/; then
91-
echo "paddle-iluvatar-gpu installation successful"
73+
if python -m pip install --pre paddlepaddle-iluvatar -i https://www.paddlepaddle.org.cn/packages/nightly/ixuca/; then
74+
echo "PaddlePaddle Iluvatar installation successful"
9275
break
9376
else
9477
retry_count=$((retry_count + 1))
9578
if [ $retry_count -lt $max_retries ]; then
96-
echo "paddle-iluvatar-gpu installation failed, retrying in 10 seconds... (Attempt $retry_count/$max_retries)"
79+
echo "PaddlePaddle Iluvatar installation failed, retrying in 10 seconds... (Attempt $retry_count/$max_retries)"
9780
sleep 10
9881
else
99-
echo "paddle-iluvatar-gpu installation failed after $max_retries attempts, Please try rerun this job."
82+
echo "PaddlePaddle Iluvatar installation failed after $max_retries attempts, Please try rerun this job."
10083
exit 1
10184
fi
10285
fi
10386
done
10487
10588
echo "Install PaddleFormers..."
10689
retry_count=0
90+
max_retries=3
10791
while [ $retry_count -lt $max_retries ]; do
10892
if python -m pip install -e .; then
10993
echo "PaddleFormers installation successful"

.github/workflows/fleet-model-test.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Fleet Model Test
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
- release/**
5+
types: [opened, synchronize]
6+
branches: [develop, release/**]
87

98
permissions: read-all
109

@@ -419,6 +418,20 @@ jobs:
419418
echo -e "\033[32mIntegration test succeeded: GLM4.5 dpo lora.\033[0m"
420419
fi
421420
'
421+
- name: GLM4.5 pre-train (EP4)
422+
if: (success() || failure()) && steps.formers_install.conclusion == 'success'
423+
run: |
424+
docker exec -t ${{ env.container_name }} /bin/bash -ce '
425+
source /root/proxy
426+
timeout 5m bash -x PaddleFormers/tests/integration_test/glm45_pt_ep4.sh
427+
glm45_exit_code=$?
428+
if [[ "$glm45_exit_code" != "0" ]]; then
429+
echo -e "::error:: \033[31mIntegration test failed: GLM4.5 EP4.\033[0m"
430+
exit 1
431+
else
432+
echo -e "\033[32mIntegration test succeeded: GLM4.5 EP4.\033[0m"
433+
fi
434+
'
422435
423436
- name: GLM4.5 pre-train (FP8)
424437
if: (success() || failure()) && steps.formers_install.conclusion == 'success'

.github/workflows/model-unittest-gpu.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ jobs:
130130
tar xf PaddleFormers.tar && rm -rf PaddleFormers.tar
131131
echo "work_dir = ${work_dir}"
132132
source ${work_dir}/../../../proxy
133-
pip install uv
134133
cd PaddleFormers
135134
git config --global user.name "PaddleCI"
136135
git config --global user.email "paddle_ci@example.com"
@@ -156,7 +155,6 @@ jobs:
156155
ldconfig
157156
mkdir -p /root/.cache/pip
158157
pip cache dir
159-
uv cache dir
160158
set -e
161159
rm -rf /root/.cache/aistudio/
162160
cd /workspace/PaddleFormers && git config --global --add safe.directory $PWD

.github/workflows/unittest-gpu.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,12 @@ jobs:
161161
ldconfig
162162
mkdir -p /root/.cache/pip
163163
pip cache dir
164-
uv cache dir
165164
set -e
166165
rm -rf /root/.cache/aistudio/
167166
cd /home/models/my_packages && dpkg -i *.deb
168167
cd /workspace/PaddleFormers && git config --global --add safe.directory $PWD
169168
source $work_dir/../../../proxy
170169
source $work_dir/../../../AISTUDIO_ACCESS_TOKEN
171-
pip install uv
172170
echo "work_dir = ${work_dir}"
173171
cp -r ${work_dir}/../../../models ./models
174172
echo "Check whether the local model file exists:"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ PaddleFormers 是基于百度深度学习框架 PaddlePaddle 搭建的 Transform
180180
> git clone https://github.com/PaddlePaddle/PaddleFormers.git
181181
> cd PaddleFormers
182182
> # cuda12.6
183-
> python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu126/
183+
> python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu126/ --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/
184184
> # cuda12.9
185-
> # python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu129/
185+
> # python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu129/ --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu129/
186186
> # cuda13.0
187-
> # python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu130/
187+
> # python -m pip install -e '.[paddlefleet]' --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu130/ --extra-index-url https://www.paddlepaddle.org.cn/packages/stable/cu130/
188188
> ```
189189
------
190190
> **安装方案二:** 如果您不想拉取源码,可以基于下面的命令安装 PaddleFormers 和 PaddleFleet。

0 commit comments

Comments
 (0)