Skip to content

Commit 6338698

Browse files
committed
merged with main
2 parents 23077de + ad56886 commit 6338698

151 files changed

Lines changed: 2735 additions & 2417 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @entrpn

.github/workflows/AddPullReady.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Add Pull Ready Label
16+
17+
on:
18+
workflow_run:
19+
workflows: [Unit Test, Linter]
20+
types:
21+
- completed
22+
pull_request_review:
23+
pull_request_review_comment:
24+
workflow_dispatch:
25+
26+
jobs:
27+
AddPullReady:
28+
permissions:
29+
checks: read
30+
pull-requests: write
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const owner = context.repo.owner
38+
const repo = context.repo.repo
39+
let pull_number = -1
40+
if (context.payload.pull_request !== undefined) {
41+
pull_number = context.payload.pull_request.number
42+
} else if (context.payload.workflow_run !== undefined) {
43+
if (context.payload.workflow_run.pull_requests.length === 0) {
44+
console.log("This workflow is NOT running within a PR's context")
45+
process.exit()
46+
}
47+
console.log(context.payload.workflow_run.pull_requests)
48+
pull_number = context.payload.workflow_run.pull_requests[0].number
49+
} else {
50+
console.log("This workflow is running within an invalid context")
51+
process.exit(1)
52+
}
53+
const reviews = await github.rest.pulls.listReviews({
54+
owner,
55+
repo,
56+
pull_number,
57+
})
58+
const decision_query = `
59+
query($owner: String!, $repo: String!, $pull_number: Int!) {
60+
repository(owner: $owner, name: $repo) {
61+
pullRequest(number: $pull_number) {
62+
reviewDecision # Fetches the overall review status
63+
}
64+
}
65+
}
66+
`;
67+
const decision_result = await github.graphql(decision_query, { owner, repo, pull_number });
68+
69+
if (reviews.data.length === 0) {
70+
console.log("Not adding pull ready because the PR is not approved yet.")
71+
process.exit()
72+
}
73+
let is_approved = false
74+
if (decision_result.repository.pullRequest.reviewDecision === "APPROVED") {
75+
is_approved = true
76+
}
77+
if (!is_approved) {
78+
console.log("Not adding pull ready because the PR is not approved yet by sufficient code owners.")
79+
process.exit()
80+
}
81+
82+
const commits = await github.rest.pulls.listCommits({
83+
owner,
84+
repo,
85+
pull_number,
86+
per_page: 100,
87+
})
88+
// Check that the number of commits in the PR is 1.
89+
if (commits.data.length !== 1) {
90+
console.log("Not adding pull ready because the PR has more than one commit. Please squash your commits.")
91+
process.exit(1)
92+
}
93+
const ref = commits.data.slice(-1)[0].sha
94+
const checkRuns = await github.rest.checks.listForRef({
95+
owner,
96+
repo,
97+
ref,
98+
})
99+
if (checkRuns.data.check_runs.length === 0) {
100+
console.log("Not adding pull ready because no check runs are associated with the last commit: " + ref)
101+
process.exit()
102+
}
103+
for (const checkRun of checkRuns.data.check_runs) {
104+
if (checkRun.name.endsWith(context.job)) continue
105+
if (checkRun.conclusion !== "success") {
106+
console.log("Not adding pull ready because " + checkRun.name + " has not passed yet: " + checkRun.html_url)
107+
process.exit()
108+
}
109+
}
110+
console.log("Adding pull ready label because the PR is approved AND all the check runs have passed")
111+
await github.rest.issues.addLabels({
112+
issue_number: pull_number,
113+
labels: ["pull ready"],
114+
owner,
115+
repo,
116+
})

.github/workflows/CPUTests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-20.04]
15-
python-version: ['3.10']
14+
os: [ubuntu-latest]
15+
python-version: ['3.12']
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Set up Python ${{ matrix.python-version }}
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install pylint pyink pytype==2024.2.27
25+
pip install pylint pyink==23.10.0 pytype==2024.2.27
2626
# - name: Typecheck the code with pytype
2727
# run: |
2828
# pytype --jobs auto --disable import-error src/maxdiffusion/

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ After installation completes, run the training script.
255255
- In Wan2.1, the ici_fsdp_parallelism axis is used for sequence parallelism, the ici_tensor_parallelism axis is used for head parallelism.
256256
- You can enable both, keeping in mind that Wan2.1 has 40 heads and 40 must be evenly divisible by ici_tensor_parallelism.
257257
- For Sequence parallelism, the code pads the sequence length to evenly divide the sequence. Try out different ici_fsdp_parallelism numbers, but we find 2 and 4 to be the best right now.
258+
- For use on GPU it is recommended to enable the cudnn_te_flash attention kernel for optimal performance.
259+
- Best performance is achieved with the use of batch parallelism, which can be enabled by using the ici_fsdp_batch_parallelism axis. Note that this parallelism strategy does not support fractional batch sizes.
260+
- ici_fsdp_batch_parallelism and ici_fsdp_parallelism can be combined to allow for fractional batch sizes. However, padding is not currently supported for the cudnn_te_flash attention kernel and it is therefore required that the sequence length is divisible by the number of devices in the ici_fsdp_parallelism axis.
258261

259262
You should eventually see a training run as:
260263

code_style.sh

100644100755
File mode changed.

end_to_end/tpu/eval_assert.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""
2-
Copyright 2024 Google LLC
2+
Copyright 2024 Google LLC
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
77
8-
https://www.apache.org/licenses/LICENSE-2.0
8+
https://www.apache.org/licenses/LICENSE-2.0
99
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
"""
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
"""
1616

1717
"""
1818
Example to run

0 commit comments

Comments
 (0)