Skip to content

Commit c90a294

Browse files
committed
Merge branch 'main' into refactor/condition-embedders-submodule
2 parents 43c8be3 + a362223 commit c90a294

224 files changed

Lines changed: 2570 additions & 219 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.

.ai/pipelines.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ When adding a new pipeline (or reviewing one), skim `pipeline_flux.py`, `pipelin
6060
4. **Subclassing an existing pipeline for a variant.** Don't use an existing pipeline class (e.g. `FluxPipeline`) to override another (e.g. `FluxImg2ImgPipeline`) inside the core `src/` codebase. Each pipeline lives in its own file with its own class, even if it shares 90% of `__call__` with a sibling. Convention across diffusers — flux, sdxl, wan, qwenimage — is duplicated `__call__` between img2img / text2img / inpaint variants, not subclassing. Reuse private utilities (shared schedulers, prep functions) but not the pipeline class itself.
6161

6262
5. **Copying a method from another pipeline without `# Copied from`.** When you reuse a method like `encode_prompt`, `prepare_latents`, `check_inputs`, or `_prepare_latent_image_ids` from another pipeline, add a `# Copied from` annotation so `make fix-copies` keeps the two in sync. Forgetting it means future refactors to the source drift away from your copy silently — and reviewers waste time spotting near-identical code that should have been linked. The annotation grammar (decorator placement, rename syntax with `with old->new`, etc.) is implemented in [`utils/check_copies.py`](../utils/check_copies.py) — read it for the exact rules.
63+
64+
6. **Be deliberate about methods on the pipeline.** `__call__` is the user's mental model. The methods on the class are how they navigate it. Diffusers convention (flux, sdxl, wan, qwenimage) is a flat class body of public lifecycle methods (`__init__`, `check_inputs`, `encode_prompt`, `prepare_latents`, `__call__`). Two principles, not strict rules — use judgment:
65+
- **If a method is called from `__call__`, and it's a step in the pipeline lifecycle, make it public.** Each call from `__call__` should correspond to a step a user can identify: either a standard one (`encode_prompt`, `prepare_latents`, `set_timesteps`, …) or a pipeline-specific one (`prepare_src_latents`, `prepare_reference_audio_latents`, …). Don't gate these behind a `_`; they're part of the pipeline's API surface alongside their standard siblings.
66+
- **If a method is only used by another method, make it private (`_foo`) or lift it to a module-level function — and keep the count down.** Before adding one, see if the logic can be absorbed into its caller. Unless you expect the helper to be reused by another method (or another task pipeline), absorbing is usually the better call — especially when the body is small. Avoid a pipeline class littered with private helpers that bury the lifecycle..

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
uv pip install -r benchmarks/requirements.txt
4646
- name: Environment
4747
run: |
48-
python utils/print_env.py
48+
diffusers-cli env
4949
- name: Diffusers Benchmarking
5050
env:
5151
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}

.github/workflows/claude_review.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ jobs:
156156
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157157
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
158158
COMMENT_USER: ${{ github.event.comment.user.login }}
159-
BASE_BRANCH: ${{ github.event.repository.default_branch }}
160159
run: |
161160
set -euo pipefail
162161
@@ -186,11 +185,18 @@ jobs:
186185
exit 0
187186
fi
188187
189-
# For fork PRs, an earlier step redirected `origin` to a local bare
190-
# repo to sandbox claude-code-action. Undo that redirect so our push
191-
# reaches the real base repo. Safe: only Claude's edits within the
192-
# allowed paths are committed below — never the fork's other changes.
193-
git config --unset-all url."file:///tmp/local-origin.git".insteadOf 2>/dev/null || true
188+
PR_INFO=$(gh pr view "$PR_NUMBER" --json headRefName,isCrossRepository)
189+
PR_BRANCH=$(echo "$PR_INFO" | jq -r '.headRefName')
190+
IS_FORK=$(echo "$PR_INFO" | jq -r '.isCrossRepository')
191+
192+
# COMMIT THIS isn't supported on fork PRs: we can't push to the
193+
# fork's branch, and falling back to main almost always conflicts
194+
# once the PR touches files that also moved on main. Bail early —
195+
# Claude's review comment with the suggested diff still stands.
196+
if [[ "$IS_FORK" == "true" ]]; then
197+
post_status "ℹ️ \`COMMIT THIS\` isn't supported on fork PRs. Apply Claude's suggestions manually, or open an issue to track them. See [workflow run]($RUN_URL)."
198+
exit 0
199+
fi
194200
195201
git config user.name "claude[bot]"
196202
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -208,8 +214,6 @@ jobs:
208214
exit 1
209215
fi
210216
211-
PR_BRANCH=$(gh pr view "$PR_NUMBER" --json headRefName --jq '.headRefName')
212-
213217
if [[ "$PR_BRANCH" == claude/pr-* ]]; then
214218
# Source PR is already a Claude-opened PR — iterate in place by
215219
# committing and pushing straight to its head branch instead of
@@ -222,9 +226,14 @@ jobs:
222226
exit 0
223227
fi
224228
225-
# Otherwise: commit on the source PR's branch to get a clean SHA,
226-
# then cherry-pick onto a fresh branch cut from the default branch.
227-
# The follow-up PR's diff is therefore exactly Claude's edits vs. main.
229+
# Target the source PR's head branch. The follow-up then applies
230+
# cleanly regardless of how main has diverged, and merging it lands
231+
# Claude's edits onto the PR for the maintainer to fold in.
232+
BASE_BRANCH="$PR_BRANCH"
233+
234+
# Commit on the source PR's branch to get a clean SHA, then
235+
# cherry-pick onto a fresh branch cut from BASE_BRANCH so the
236+
# follow-up PR's diff is exactly Claude's edits vs. BASE_BRANCH.
228237
NEW_BRANCH="claude/pr-${PR_NUMBER}-$(date -u +%Y%m%d-%H%M%S)"
229238
230239
git commit -m "Apply changes from Claude (requested by @${COMMENT_USER} on #${PR_NUMBER})
@@ -248,6 +257,6 @@ jobs:
248257
--title "Apply Claude's changes from #${PR_NUMBER}" \
249258
--body "Automated PR with edits Claude made in response to \`COMMIT THIS\` from @${COMMENT_USER} on [#${PR_NUMBER}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}).
250259
251-
Targets \`${BASE_BRANCH}\` — independent of #${PR_NUMBER}. Further \`COMMIT THIS\` requests on *this* PR will commit directly to it.")
260+
Targets \`${BASE_BRANCH}\` (the head branch of #${PR_NUMBER}). Merging this brings Claude's edits into that PR.")
252261
253262
post_status "✅ Opened follow-up PR (into \`${BASE_BRANCH}\`) with Claude's edits: ${NEW_PR_URL}"

.github/workflows/nightly_tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
uv pip install pytest-reportlog
8282
- name: Environment
8383
run: |
84-
python utils/print_env.py
84+
diffusers-cli env
8585
- name: Pipeline CUDA Test
8686
env:
8787
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -135,7 +135,7 @@ jobs:
135135
uv pip uninstall accelerate && uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
136136
uv pip install pytest-reportlog
137137
- name: Environment
138-
run: python utils/print_env.py
138+
run: diffusers-cli env
139139

140140
- name: Run nightly PyTorch CUDA tests for non-pipeline modules
141141
if: ${{ matrix.module != 'examples'}}
@@ -201,7 +201,7 @@ jobs:
201201
uv pip uninstall tokenizers && uv pip install "tokenizers<=0.23.0"
202202
- name: Environment
203203
run: |
204-
python utils/print_env.py
204+
diffusers-cli env
205205
- name: Run torch compile tests on GPU
206206
env:
207207
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -246,7 +246,7 @@ jobs:
246246
uv pip install pytest-reportlog
247247
- name: Environment
248248
run: |
249-
python utils/print_env.py
249+
diffusers-cli env
250250
- name: Selected Torch CUDA Test on big GPU
251251
env:
252252
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -297,7 +297,7 @@ jobs:
297297
298298
- name: Environment
299299
run: |
300-
python utils/print_env.py
300+
diffusers-cli env
301301
302302
- name: Run PyTorch CUDA tests
303303
env:
@@ -375,7 +375,7 @@ jobs:
375375
uv pip uninstall tokenizers && uv pip install "tokenizers<=0.23.0"
376376
- name: Environment
377377
run: |
378-
python utils/print_env.py
378+
diffusers-cli env
379379
- name: ${{ matrix.config.backend }} quantization tests on GPU
380380
env:
381381
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -425,7 +425,7 @@ jobs:
425425
uv pip install pytest-reportlog
426426
- name: Environment
427427
run: |
428-
python utils/print_env.py
428+
diffusers-cli env
429429
- name: Pipeline-level quantization tests on GPU
430430
env:
431431
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -541,7 +541,7 @@ jobs:
541541
# - name: Environment
542542
# shell: arch -arch arm64 bash {0}
543543
# run: |
544-
# ${CONDA_RUN} python utils/print_env.py
544+
# ${CONDA_RUN} diffusers-cli env
545545
# - name: Run nightly PyTorch tests on M1 (MPS)
546546
# shell: arch -arch arm64 bash {0}
547547
# env:
@@ -597,7 +597,7 @@ jobs:
597597
# - name: Environment
598598
# shell: arch -arch arm64 bash {0}
599599
# run: |
600-
# ${CONDA_RUN} python utils/print_env.py
600+
# ${CONDA_RUN} diffusers-cli env
601601
# - name: Run nightly PyTorch tests on M1 (MPS)
602602
# shell: arch -arch arm64 bash {0}
603603
# env:

.github/workflows/pr_modular_tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
python utils/check_copies.py
7474
python utils/check_dummies.py
7575
python utils/check_support_list.py
76+
python utils/check_forward_call_docstrings.py
7677
make deps_table_check_updated
7778
- name: Check if failure
7879
if: ${{ failure() }}
@@ -127,7 +128,7 @@ jobs:
127128
128129
- name: Environment
129130
run: |
130-
python utils/print_env.py
131+
diffusers-cli env
131132
132133
- name: Run fast PyTorch Pipeline CPU tests
133134
run: |

.github/workflows/pr_test_fetcher.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uv pip install -e ".[quality]"
4040
- name: Environment
4141
run: |
42-
python utils/print_env.py
42+
diffusers-cli env
4343
echo $(git --version)
4444
- name: Fetch Tests
4545
run: |
@@ -97,7 +97,7 @@ jobs:
9797
9898
- name: Environment
9999
run: |
100-
python utils/print_env.py
100+
diffusers-cli env
101101
102102
- name: Run all selected tests on CPU
103103
run: |
@@ -151,7 +151,7 @@ jobs:
151151
152152
- name: Environment
153153
run: |
154-
python utils/print_env.py
154+
diffusers-cli env
155155
156156
- name: Run Hub tests for models, schedulers, and pipelines on a staging env
157157
if: ${{ matrix.config.framework == 'hub_tests_pytorch' }}

.github/workflows/pr_tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
python utils/check_copies.py
6969
python utils/check_dummies.py
7070
python utils/check_support_list.py
71+
python utils/check_forward_call_docstrings.py
7172
make deps_table_check_updated
7273
- name: Check if failure
7374
if: ${{ failure() }}
@@ -123,7 +124,7 @@ jobs:
123124
124125
- name: Environment
125126
run: |
126-
python utils/print_env.py
127+
diffusers-cli env
127128
128129
- name: Run fast PyTorch Pipeline CPU tests
129130
if: ${{ matrix.config.framework == 'pytorch_pipelines' }}
@@ -199,7 +200,7 @@ jobs:
199200
200201
- name: Environment
201202
run: |
202-
python utils/print_env.py
203+
diffusers-cli env
203204
204205
- name: Run Hub tests for models, schedulers, and pipelines on a staging env
205206
if: ${{ matrix.config.framework == 'hub_tests_pytorch' }}
@@ -254,7 +255,7 @@ jobs:
254255
255256
- name: Environment
256257
run: |
257-
python utils/print_env.py
258+
diffusers-cli env
258259
259260
- name: Run fast PyTorch LoRA tests with PEFT
260261
run: |

.github/workflows/pr_tests_gpu.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
python utils/check_copies.py
7070
python utils/check_dummies.py
7171
python utils/check_support_list.py
72+
python utils/check_forward_call_docstrings.py
7273
make deps_table_check_updated
7374
- name: Check if failure
7475
if: ${{ failure() }}
@@ -94,7 +95,7 @@ jobs:
9495
uv pip install -e ".[quality]"
9596
- name: Environment
9697
run: |
97-
python utils/print_env.py
98+
diffusers-cli env
9899
- name: Fetch Pipeline Matrix
99100
id: fetch_pipeline_matrix
100101
run: |
@@ -139,7 +140,7 @@ jobs:
139140
140141
- name: Environment
141142
run: |
142-
python utils/print_env.py
143+
diffusers-cli env
143144
- name: Extract tests
144145
id: extract_tests
145146
run: |
@@ -210,7 +211,7 @@ jobs:
210211
211212
- name: Environment
212213
run: |
213-
python utils/print_env.py
214+
diffusers-cli env
214215
215216
- name: Extract tests
216217
id: extract_tests
@@ -273,7 +274,7 @@ jobs:
273274
274275
- name: Environment
275276
run: |
276-
python utils/print_env.py
277+
diffusers-cli env
277278
278279
- name: Run example tests on GPU
279280
env:

.github/workflows/push_tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uv pip install -e ".[quality]"
4141
- name: Environment
4242
run: |
43-
python utils/print_env.py
43+
diffusers-cli env
4444
- name: Fetch Pipeline Matrix
4545
id: fetch_pipeline_matrix
4646
run: |
@@ -83,7 +83,7 @@ jobs:
8383
uv pip uninstall tokenizers && uv pip install "tokenizers<=0.23.0"
8484
- name: Environment
8585
run: |
86-
python utils/print_env.py
86+
diffusers-cli env
8787
- name: PyTorch CUDA checkpoint tests on Ubuntu
8888
env:
8989
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -137,7 +137,7 @@ jobs:
137137
138138
- name: Environment
139139
run: |
140-
python utils/print_env.py
140+
diffusers-cli env
141141
142142
- name: Run PyTorch CUDA tests
143143
env:
@@ -189,7 +189,7 @@ jobs:
189189
uv pip uninstall tokenizers && uv pip install "tokenizers<=0.23.0"
190190
- name: Environment
191191
run: |
192-
python utils/print_env.py
192+
diffusers-cli env
193193
- name: Run example tests on GPU
194194
env:
195195
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -231,7 +231,7 @@ jobs:
231231
uv pip install -e ".[quality,training]"
232232
- name: Environment
233233
run: |
234-
python utils/print_env.py
234+
diffusers-cli env
235235
- name: Run example tests on GPU
236236
env:
237237
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
@@ -272,7 +272,7 @@ jobs:
272272
273273
- name: Environment
274274
run: |
275-
python utils/print_env.py
275+
diffusers-cli env
276276
277277
- name: Run example tests on GPU
278278
env:

.github/workflows/push_tests_fast.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
6868
- name: Environment
6969
run: |
70-
python utils/print_env.py
70+
diffusers-cli env
7171
7272
- name: Run fast PyTorch CPU tests
7373
if: ${{ matrix.config.framework == 'pytorch' }}

0 commit comments

Comments
 (0)