Skip to content

Commit 1cfd2ee

Browse files
authored
Merge branch 'main' into integrations/ltx-0.9.5
2 parents e98fea2 + 2f0f281 commit 1cfd2ee

File tree

140 files changed

+15176
-1151
lines changed

Some content is hidden

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

140 files changed

+15176
-1151
lines changed

.github/workflows/nightly_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ jobs:
418418
test_location: "gguf"
419419
- backend: "torchao"
420420
test_location: "torchao"
421+
- backend: "optimum_quanto"
422+
test_location: "quanto"
421423
runs-on:
422424
group: aws-g6e-xlarge-plus
423425
container:

.github/workflows/pr_style_bot.yml

Lines changed: 40 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -9,160 +9,43 @@ permissions:
99
pull-requests: write
1010

1111
jobs:
12-
check-permissions:
13-
if: >
14-
contains(github.event.comment.body, '@bot /style') &&
15-
github.event.issue.pull_request != null
16-
runs-on: ubuntu-latest
17-
outputs:
18-
is_authorized: ${{ steps.check_user_permission.outputs.has_permission }}
19-
steps:
20-
- name: Check user permission
21-
id: check_user_permission
22-
uses: actions/github-script@v6
23-
with:
24-
script: |
25-
const comment_user = context.payload.comment.user.login;
26-
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
username: comment_user
30-
});
31-
const authorized = permission.permission === 'admin';
32-
console.log(`User ${comment_user} has permission level: ${permission.permission}, authorized: ${authorized} (only admins allowed)`);
33-
core.setOutput('has_permission', authorized);
34-
35-
run-style-bot:
36-
needs: check-permissions
37-
if: needs.check-permissions.outputs.is_authorized == 'true'
38-
runs-on: ubuntu-latest
39-
steps:
40-
- name: Extract PR details
41-
id: pr_info
42-
uses: actions/github-script@v6
43-
with:
44-
script: |
45-
const prNumber = context.payload.issue.number;
46-
const { data: pr } = await github.rest.pulls.get({
47-
owner: context.repo.owner,
48-
repo: context.repo.repo,
49-
pull_number: prNumber
50-
});
51-
52-
// We capture both the branch ref and the "full_name" of the head repo
53-
// so that we can check out the correct repository & branch (including forks).
54-
core.setOutput("prNumber", prNumber);
55-
core.setOutput("headRef", pr.head.ref);
56-
core.setOutput("headRepoFullName", pr.head.repo.full_name);
57-
58-
- name: Check out PR branch
59-
uses: actions/checkout@v3
60-
env:
61-
HEADREPOFULLNAME: ${{ steps.pr_info.outputs.headRepoFullName }}
62-
HEADREF: ${{ steps.pr_info.outputs.headRef }}
63-
with:
64-
# Instead of checking out the base repo, use the contributor's repo name
65-
repository: ${{ env.HEADREPOFULLNAME }}
66-
ref: ${{ env.HEADREF }}
67-
# You may need fetch-depth: 0 for being able to push
68-
fetch-depth: 0
69-
token: ${{ secrets.GITHUB_TOKEN }}
70-
71-
- name: Debug
72-
env:
73-
HEADREPOFULLNAME: ${{ steps.pr_info.outputs.headRepoFullName }}
74-
HEADREF: ${{ steps.pr_info.outputs.headRef }}
75-
PRNUMBER: ${{ steps.pr_info.outputs.prNumber }}
76-
run: |
77-
echo "PR number: $PRNUMBER"
78-
echo "Head Ref: $HEADREF"
79-
echo "Head Repo Full Name: $HEADREPOFULLNAME"
80-
81-
- name: Set up Python
82-
uses: actions/setup-python@v4
83-
84-
- name: Install dependencies
85-
run: |
86-
pip install .[quality]
87-
88-
- name: Download necessary files from main branch of Diffusers
89-
run: |
90-
curl -o main_Makefile https://raw.githubusercontent.com/huggingface/diffusers/main/Makefile
91-
curl -o main_setup.py https://raw.githubusercontent.com/huggingface/diffusers/refs/heads/main/setup.py
92-
curl -o main_check_doc_toc.py https://raw.githubusercontent.com/huggingface/diffusers/refs/heads/main/utils/check_doc_toc.py
93-
94-
- name: Compare the files and raise error if needed
95-
run: |
96-
diff_failed=0
97-
98-
if ! diff -q main_Makefile Makefile; then
99-
echo "Error: The Makefile has changed. Please ensure it matches the main branch."
100-
diff_failed=1
101-
fi
102-
103-
if ! diff -q main_setup.py setup.py; then
104-
echo "Error: The setup.py has changed. Please ensure it matches the main branch."
105-
diff_failed=1
106-
fi
107-
108-
if ! diff -q main_check_doc_toc.py utils/check_doc_toc.py; then
109-
echo "Error: The utils/check_doc_toc.py has changed. Please ensure it matches the main branch."
110-
diff_failed=1
111-
fi
112-
113-
if [ $diff_failed -eq 1 ]; then
114-
echo "❌ Error happened as we detected changes in the files that should not be changed ❌"
115-
exit 1
116-
fi
117-
118-
echo "No changes in the files. Proceeding..."
119-
rm -rf main_Makefile main_setup.py main_check_doc_toc.py
120-
121-
- name: Run make style and make quality
122-
run: |
123-
make style && make quality
124-
125-
- name: Commit and push changes
126-
id: commit_and_push
127-
env:
128-
HEADREPOFULLNAME: ${{ steps.pr_info.outputs.headRepoFullName }}
129-
HEADREF: ${{ steps.pr_info.outputs.headRef }}
130-
PRNUMBER: ${{ steps.pr_info.outputs.prNumber }}
131-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132-
run: |
133-
echo "HEADREPOFULLNAME: $HEADREPOFULLNAME, HEADREF: $HEADREF"
134-
# Configure git with the Actions bot user
135-
git config user.name "github-actions[bot]"
136-
git config user.email "github-actions[bot]@users.noreply.github.com"
137-
138-
# Make sure your 'origin' remote is set to the contributor's fork
139-
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/$HEADREPOFULLNAME.git"
140-
141-
# If there are changes after running style/quality, commit them
142-
if [ -n "$(git status --porcelain)" ]; then
143-
git add .
144-
git commit -m "Apply style fixes"
145-
# Push to the original contributor's forked branch
146-
git push origin HEAD:$HEADREF
147-
echo "changes_pushed=true" >> $GITHUB_OUTPUT
148-
else
149-
echo "No changes to commit."
150-
echo "changes_pushed=false" >> $GITHUB_OUTPUT
151-
fi
152-
153-
- name: Comment on PR with workflow run link
154-
if: steps.commit_and_push.outputs.changes_pushed == 'true'
155-
uses: actions/github-script@v6
156-
with:
157-
script: |
158-
const prNumber = parseInt(process.env.prNumber, 10);
159-
const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
160-
161-
await github.rest.issues.createComment({
162-
owner: context.repo.owner,
163-
repo: context.repo.repo,
164-
issue_number: prNumber,
165-
body: `Style fixes have been applied. [View the workflow run here](${runUrl}).`
166-
});
167-
env:
168-
prNumber: ${{ steps.pr_info.outputs.prNumber }}
12+
style:
13+
uses: huggingface/huggingface_hub/.github/workflows/style-bot-action.yml@main
14+
with:
15+
python_quality_dependencies: "[quality]"
16+
pre_commit_script_name: "Download and Compare files from the main branch"
17+
pre_commit_script: |
18+
echo "Downloading the files from the main branch"
19+
20+
curl -o main_Makefile https://raw.githubusercontent.com/huggingface/diffusers/main/Makefile
21+
curl -o main_setup.py https://raw.githubusercontent.com/huggingface/diffusers/refs/heads/main/setup.py
22+
curl -o main_check_doc_toc.py https://raw.githubusercontent.com/huggingface/diffusers/refs/heads/main/utils/check_doc_toc.py
23+
24+
echo "Compare the files and raise error if needed"
25+
26+
diff_failed=0
27+
if ! diff -q main_Makefile Makefile; then
28+
echo "Error: The Makefile has changed. Please ensure it matches the main branch."
29+
diff_failed=1
30+
fi
31+
32+
if ! diff -q main_setup.py setup.py; then
33+
echo "Error: The setup.py has changed. Please ensure it matches the main branch."
34+
diff_failed=1
35+
fi
36+
37+
if ! diff -q main_check_doc_toc.py utils/check_doc_toc.py; then
38+
echo "Error: The utils/check_doc_toc.py has changed. Please ensure it matches the main branch."
39+
diff_failed=1
40+
fi
41+
42+
if [ $diff_failed -eq 1 ]; then
43+
echo "❌ Error happened as we detected changes in the files that should not be changed ❌"
44+
exit 1
45+
fi
46+
47+
echo "No changes in the files. Proceeding..."
48+
rm -rf main_Makefile main_setup.py main_check_doc_toc.py
49+
style_command: "make style && make quality"
50+
secrets:
51+
bot_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr_tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Fast tests for PRs
33
on:
44
pull_request:
55
branches: [main]
6-
types: [synchronize]
76
paths:
87
- "src/diffusers/**.py"
98
- "benchmarks/**.py"

docs/source/en/_toctree.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
title: Overview
8282
- local: hybrid_inference/vae_decode
8383
title: VAE Decode
84+
- local: hybrid_inference/vae_encode
85+
title: VAE Encode
8486
- local: hybrid_inference/api_reference
8587
title: API Reference
8688
title: Hybrid Inference
@@ -173,6 +175,8 @@
173175
title: gguf
174176
- local: quantization/torchao
175177
title: torchao
178+
- local: quantization/quanto
179+
title: quanto
176180
title: Quantization Methods
177181
- sections:
178182
- local: optimization/fp16

docs/source/en/api/pipelines/hunyuan_video.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ The following models are available for the image-to-video pipeline:
4949

5050
| Model name | Description |
5151
|:---|:---|
52-
| [`https://huggingface.co/Skywork/SkyReels-V1-Hunyuan-I2V`](https://huggingface.co/Skywork/SkyReels-V1-Hunyuan-I2V) | Skywork's custom finetune of HunyuanVideo (de-distilled). Performs best with `97x544x960` resolution. Performs best at `97x544x960` resolution, `guidance_scale=1.0`, `true_cfg_scale=6.0` and a negative prompt. |
52+
| [`Skywork/SkyReels-V1-Hunyuan-I2V`](https://huggingface.co/Skywork/SkyReels-V1-Hunyuan-I2V) | Skywork's custom finetune of HunyuanVideo (de-distilled). Performs best with `97x544x960` resolution. Performs best at `97x544x960` resolution, `guidance_scale=1.0`, `true_cfg_scale=6.0` and a negative prompt. |
53+
| [`hunyuanvideo-community/HunyuanVideo-I2V`](https://huggingface.co/hunyuanvideo-community/HunyuanVideo-I2V) | Tecent's official HunyuanVideo I2V model. Performs best at resolutions of 480, 720, 960, 1280. A higher `shift` value when initializing the scheduler is recommended (good values are between 7 and 20) |
5354

5455
## Quantization
5556

docs/source/en/api/pipelines/lumina.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ Use [`torch.compile`](https://huggingface.co/docs/diffusers/main/en/tutorials/fa
5858
First, load the pipeline:
5959

6060
```python
61-
from diffusers import LuminaText2ImgPipeline
61+
from diffusers import LuminaPipeline
6262
import torch
6363

64-
pipeline = LuminaText2ImgPipeline.from_pretrained(
64+
pipeline = LuminaPipeline.from_pretrained(
6565
"Alpha-VLLM/Lumina-Next-SFT-diffusers", torch_dtype=torch.bfloat16
6666
).to("cuda")
6767
```
@@ -86,11 +86,11 @@ image = pipeline(prompt="Upper body of a young woman in a Victorian-era outfit w
8686

8787
Quantization helps reduce the memory requirements of very large models by storing model weights in a lower precision data type. However, quantization may have varying impact on video quality depending on the video model.
8888

89-
Refer to the [Quantization](../../quantization/overview) overview to learn more about supported quantization backends and selecting a quantization backend that supports your use case. The example below demonstrates how to load a quantized [`LuminaText2ImgPipeline`] for inference with bitsandbytes.
89+
Refer to the [Quantization](../../quantization/overview) overview to learn more about supported quantization backends and selecting a quantization backend that supports your use case. The example below demonstrates how to load a quantized [`LuminaPipeline`] for inference with bitsandbytes.
9090

9191
```py
9292
import torch
93-
from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig, Transformer2DModel, LuminaText2ImgPipeline
93+
from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig, Transformer2DModel, LuminaPipeline
9494
from transformers import BitsAndBytesConfig as BitsAndBytesConfig, T5EncoderModel
9595

9696
quant_config = BitsAndBytesConfig(load_in_8bit=True)
@@ -109,7 +109,7 @@ transformer_8bit = Transformer2DModel.from_pretrained(
109109
torch_dtype=torch.float16,
110110
)
111111

112-
pipeline = LuminaText2ImgPipeline.from_pretrained(
112+
pipeline = LuminaPipeline.from_pretrained(
113113
"Alpha-VLLM/Lumina-Next-SFT-diffusers",
114114
text_encoder=text_encoder_8bit,
115115
transformer=transformer_8bit,
@@ -122,9 +122,9 @@ image = pipeline(prompt).images[0]
122122
image.save("lumina.png")
123123
```
124124

125-
## LuminaText2ImgPipeline
125+
## LuminaPipeline
126126

127-
[[autodoc]] LuminaText2ImgPipeline
127+
[[autodoc]] LuminaPipeline
128128
- all
129129
- __call__
130130

docs/source/en/api/pipelines/lumina2.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ Single file loading for Lumina Image 2.0 is available for the `Lumina2Transforme
3636

3737
```python
3838
import torch
39-
from diffusers import Lumina2Transformer2DModel, Lumina2Text2ImgPipeline
39+
from diffusers import Lumina2Transformer2DModel, Lumina2Pipeline
4040

4141
ckpt_path = "https://huggingface.co/Alpha-VLLM/Lumina-Image-2.0/blob/main/consolidated.00-of-01.pth"
4242
transformer = Lumina2Transformer2DModel.from_single_file(
4343
ckpt_path, torch_dtype=torch.bfloat16
4444
)
4545

46-
pipe = Lumina2Text2ImgPipeline.from_pretrained(
46+
pipe = Lumina2Pipeline.from_pretrained(
4747
"Alpha-VLLM/Lumina-Image-2.0", transformer=transformer, torch_dtype=torch.bfloat16
4848
)
4949
pipe.enable_model_cpu_offload()
@@ -60,7 +60,7 @@ image.save("lumina-single-file.png")
6060
GGUF Quantized checkpoints for the `Lumina2Transformer2DModel` can be loaded via `from_single_file` with the `GGUFQuantizationConfig`
6161

6262
```python
63-
from diffusers import Lumina2Transformer2DModel, Lumina2Text2ImgPipeline, GGUFQuantizationConfig
63+
from diffusers import Lumina2Transformer2DModel, Lumina2Pipeline, GGUFQuantizationConfig
6464

6565
ckpt_path = "https://huggingface.co/calcuis/lumina-gguf/blob/main/lumina2-q4_0.gguf"
6666
transformer = Lumina2Transformer2DModel.from_single_file(
@@ -69,7 +69,7 @@ transformer = Lumina2Transformer2DModel.from_single_file(
6969
torch_dtype=torch.bfloat16,
7070
)
7171

72-
pipe = Lumina2Text2ImgPipeline.from_pretrained(
72+
pipe = Lumina2Pipeline.from_pretrained(
7373
"Alpha-VLLM/Lumina-Image-2.0", transformer=transformer, torch_dtype=torch.bfloat16
7474
)
7575
pipe.enable_model_cpu_offload()
@@ -80,8 +80,8 @@ image = pipe(
8080
image.save("lumina-gguf.png")
8181
```
8282

83-
## Lumina2Text2ImgPipeline
83+
## Lumina2Pipeline
8484

85-
[[autodoc]] Lumina2Text2ImgPipeline
85+
[[autodoc]] Lumina2Pipeline
8686
- all
8787
- __call__

docs/source/en/api/pipelines/wan.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
# Wan
1616

17+
<div class="flex flex-wrap space-x-1">
18+
<img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/>
19+
</div>
20+
1721
[Wan 2.1](https://github.com/Wan-Video/Wan2.1) by the Alibaba Wan Team.
1822

1923
<!-- TODO(aryan): update abstract once paper is out -->
@@ -45,6 +49,22 @@ pipe = WanPipeline.from_pretrained("Wan-AI/Wan2.1-T2V-1.3B-Diffusers", scheduler
4549
pipe.scheduler = <CUSTOM_SCHEDULER_HERE>
4650
```
4751

52+
### Using single file loading with Wan
53+
54+
The `WanTransformer3DModel` and `AutoencoderKLWan` models support loading checkpoints in their original format via the `from_single_file` loading
55+
method.
56+
57+
58+
```python
59+
import torch
60+
from diffusers import WanPipeline, WanTransformer3DModel
61+
62+
ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors"
63+
transformer = WanTransformer3DModel.from_single_file(ckpt_path, torch_dtype=torch.bfloat16)
64+
65+
pipe = WanPipeline.from_pretrained("Wan-AI/Wan2.1-T2V-1.3B-Diffusers", transformer=transformer)
66+
```
67+
4868
## WanPipeline
4969

5070
[[autodoc]] WanPipeline

docs/source/en/api/quantization.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Learn how to quantize models in the [Quantization](../quantization/overview) gui
3131
## GGUFQuantizationConfig
3232

3333
[[autodoc]] GGUFQuantizationConfig
34+
35+
## QuantoConfig
36+
37+
[[autodoc]] QuantoConfig
38+
3439
## TorchAoConfig
3540

3641
[[autodoc]] TorchAoConfig

docs/source/en/hybrid_inference/api_reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
## Remote Decode
44

55
[[autodoc]] utils.remote_utils.remote_decode
6+
7+
## Remote Encode
8+
9+
[[autodoc]] utils.remote_utils.remote_encode

0 commit comments

Comments
 (0)