Skip to content

Commit 96cdc39

Browse files
authored
Merge branch 'main' into fix-fast-tests-sayak
2 parents a20688a + 2b443a5 commit 96cdc39

File tree

134 files changed

+8591
-585
lines changed

Some content is hidden

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

134 files changed

+8591
-585
lines changed

.github/workflows/nightly_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
run: |
7373
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
7474
python -m uv pip install -e [quality,test]
75-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
75+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
7676
python -m uv pip install pytest-reportlog
7777
- name: Environment
7878
run: |
@@ -130,8 +130,8 @@ jobs:
130130
run: |
131131
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
132132
python -m uv pip install -e [quality,test]
133-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
134133
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
134+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
135135
python -m uv pip install pytest-reportlog
136136
- name: Environment
137137
run: python utils/print_env.py
@@ -201,7 +201,7 @@ jobs:
201201
run: |
202202
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
203203
python -m uv pip install -e [quality,test]
204-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
204+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
205205
python -m uv pip install pytest-reportlog
206206
207207
- name: Environment
@@ -257,7 +257,7 @@ jobs:
257257
run: |
258258
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
259259
python -m uv pip install -e [quality,test]
260-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
260+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
261261
python -m uv pip install pytest-reportlog
262262
- name: Environment
263263
run: python utils/print_env.py
@@ -282,7 +282,7 @@ jobs:
282282
if: ${{ always() }}
283283
uses: actions/upload-artifact@v4
284284
with:
285-
name: ${{ matrix.config.report }}_test_reports
285+
name: tests_onnx_cuda_reports
286286
path: reports
287287

288288
- name: Generate Report and Notify Channel

.github/workflows/pr_test_peft_backend.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
if [ "${{ matrix.lib-versions }}" == "main" ]; then
9696
python -m pip install -U peft@git+https://github.com/huggingface/peft.git
9797
python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git
98-
python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
98+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
9999
else
100100
python -m uv pip install -U peft transformers accelerate
101101
fi
@@ -110,23 +110,23 @@ jobs:
110110
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
111111
python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \
112112
-s -v \
113-
--make-reports=tests_${{ matrix.config.report }} \
113+
--make-reports=tests_${{ matrix.lib-versions }} \
114114
tests/lora/
115115
python -m pytest -n 4 --max-worker-restart=0 --dist=loadfile \
116116
-s -v \
117-
--make-reports=tests_models_lora_${{ matrix.config.report }} \
117+
--make-reports=tests_models_lora_${{ matrix.lib-versions }} \
118118
tests/models/ -k "lora"
119119
120120
121121
- name: Failure short reports
122122
if: ${{ failure() }}
123123
run: |
124-
cat reports/tests_${{ matrix.config.report }}_failures_short.txt
125-
cat reports/tests_models_lora_${{ matrix.config.report }}_failures_short.txt
124+
cat reports/tests_${{ matrix.lib-versions }}_failures_short.txt
125+
cat reports/tests_models_lora_${{ matrix.lib-versions }}_failures_short.txt
126126
127127
- name: Test suite reports artifacts
128128
if: ${{ always() }}
129129
uses: actions/upload-artifact@v4
130130
with:
131-
name: pr_${{ matrix.config.report }}_test_reports
131+
name: pr_${{ matrix.lib-versions }}_test_reports
132132
path: reports

.github/workflows/pr_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
if: ${{ always() }}
171171
uses: actions/upload-artifact@v4
172172
with:
173-
name: pr_${{ matrix.config.report }}_test_reports
173+
name: pr_${{ matrix.config.framework }}_${{ matrix.config.report }}_test_reports
174174
path: reports
175175

176176
run_staging_tests:

.github/workflows/push_tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
run: |
7777
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
7878
python -m uv pip install -e [quality,test]
79-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
79+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
8080
- name: Environment
8181
run: |
8282
python utils/print_env.py
@@ -127,8 +127,8 @@ jobs:
127127
run: |
128128
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
129129
python -m uv pip install -e [quality,test]
130-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
131130
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
131+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
132132
133133
- name: Environment
134134
run: |
@@ -150,20 +150,20 @@ jobs:
150150
fi
151151
python -m pytest $PYTEST_ARGS --max-worker-restart=0 \
152152
-s -v -k "not Flax and not Onnx" \
153-
--make-reports=tests_torch_cuda \
153+
--make-reports=tests_torch_cuda_${{ matrix.module }} \
154154
tests/${{ matrix.module }}
155155
156156
- name: Failure short reports
157157
if: ${{ failure() }}
158158
run: |
159-
cat reports/tests_torch_cuda_stats.txt
160-
cat reports/tests_torch_cuda_failures_short.txt
159+
cat reports/tests_torch_cuda_${{ matrix.module }}_stats.txt
160+
cat reports/tests_torch_cuda_${{ matrix.module }}_failures_short.txt
161161
162162
- name: Test suite reports artifacts
163163
if: ${{ always() }}
164164
uses: actions/upload-artifact@v4
165165
with:
166-
name: torch_cuda_test_reports
166+
name: torch_cuda_test_reports_${{ matrix.module }}
167167
path: reports
168168

169169
flax_tpu_tests:
@@ -185,7 +185,7 @@ jobs:
185185
run: |
186186
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
187187
python -m uv pip install -e [quality,test]
188-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
188+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
189189
190190
- name: Environment
191191
run: |
@@ -233,7 +233,7 @@ jobs:
233233
run: |
234234
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
235235
python -m uv pip install -e [quality,test]
236-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
236+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
237237
238238
- name: Environment
239239
run: |

.github/workflows/release_tests_fast.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
run: |
7676
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
7777
python -m uv pip install -e [quality,test]
78-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
78+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
7979
- name: Environment
8080
run: |
8181
python utils/print_env.py
@@ -126,8 +126,8 @@ jobs:
126126
run: |
127127
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
128128
python -m uv pip install -e [quality,test]
129-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
130129
python -m uv pip install peft@git+https://github.com/huggingface/peft.git
130+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
131131
132132
- name: Environment
133133
run: |
@@ -149,20 +149,20 @@ jobs:
149149
fi
150150
python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \
151151
-s -v -k "not Flax and not Onnx" \
152-
--make-reports=tests_torch_cuda \
152+
--make-reports=tests_torch_${{ matrix.module }}_cuda \
153153
tests/${{ matrix.module }}
154154
155155
- name: Failure short reports
156156
if: ${{ failure() }}
157157
run: |
158-
cat reports/tests_torch_cuda_stats.txt
159-
cat reports/tests_torch_cuda_failures_short.txt
158+
cat reports/tests_torch_${{ matrix.module }}_cuda_stats.txt
159+
cat reports/tests_torch_${{ matrix.module }}_cuda_failures_short.txt
160160
161161
- name: Test suite reports artifacts
162162
if: ${{ always() }}
163163
uses: actions/upload-artifact@v4
164164
with:
165-
name: torch_cuda_test_reports
165+
name: torch_cuda_${{ matrix.module }}_test_reports
166166
path: reports
167167

168168
flax_tpu_tests:
@@ -184,7 +184,7 @@ jobs:
184184
run: |
185185
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
186186
python -m uv pip install -e [quality,test]
187-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
187+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
188188
189189
- name: Environment
190190
run: |
@@ -232,7 +232,7 @@ jobs:
232232
run: |
233233
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
234234
python -m uv pip install -e [quality,test]
235-
python -m uv pip install accelerate@git+https://github.com/huggingface/accelerate.git
235+
pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git
236236
237237
- name: Environment
238238
run: |

PHILOSOPHY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Pipelines are designed to be easy to use (therefore do not follow [*Simple over
6565
The following design principles are followed:
6666
- Pipelines follow the single-file policy. All pipelines can be found in individual directories under src/diffusers/pipelines. One pipeline folder corresponds to one diffusion paper/project/release. Multiple pipeline files can be gathered in one pipeline folder, as it’s done for [`src/diffusers/pipelines/stable-diffusion`](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines/stable_diffusion). If pipelines share similar functionality, one can make use of the [# Copied from mechanism](https://github.com/huggingface/diffusers/blob/125d783076e5bd9785beb05367a2d2566843a271/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L251).
6767
- Pipelines all inherit from [`DiffusionPipeline`].
68-
- Every pipeline consists of different model and scheduler components, that are documented in the [`model_index.json` file](https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/model_index.json), are accessible under the same name as attributes of the pipeline and can be shared between pipelines with [`DiffusionPipeline.components`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components) function.
68+
- Every pipeline consists of different model and scheduler components, that are documented in the [`model_index.json` file](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/model_index.json), are accessible under the same name as attributes of the pipeline and can be shared between pipelines with [`DiffusionPipeline.components`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components) function.
6969
- Every pipeline should be loadable via the [`DiffusionPipeline.from_pretrained`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained) function.
7070
- Pipelines should be used **only** for inference.
7171
- Pipelines should be very readable, self-explanatory, and easy to tweak.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Generating outputs is super easy with 🤗 Diffusers. To generate an image from
7373
from diffusers import DiffusionPipeline
7474
import torch
7575

76-
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
76+
pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch.float16)
7777
pipeline.to("cuda")
7878
pipeline("An image of a squirrel in Picasso style").images[0]
7979
```
@@ -144,7 +144,7 @@ Also, say 👋 in our public Discord channel <a href="https://discord.gg/G7tWnz9
144144
<tr style="border-top: 2px solid black">
145145
<td>Text-to-Image</td>
146146
<td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/text2img">Stable Diffusion Text-to-Image</a></td>
147-
<td><a href="https://huggingface.co/runwayml/stable-diffusion-v1-5"> runwayml/stable-diffusion-v1-5 </a></td>
147+
<td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5"> stable-diffusion-v1-5/stable-diffusion-v1-5 </a></td>
148148
</tr>
149149
<tr>
150150
<td>Text-to-Image</td>
@@ -174,7 +174,7 @@ Also, say 👋 in our public Discord channel <a href="https://discord.gg/G7tWnz9
174174
<tr>
175175
<td>Text-guided Image-to-Image</td>
176176
<td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/img2img">Stable Diffusion Image-to-Image</a></td>
177-
<td><a href="https://huggingface.co/runwayml/stable-diffusion-v1-5"> runwayml/stable-diffusion-v1-5 </a></td>
177+
<td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5"> stable-diffusion-v1-5/stable-diffusion-v1-5 </a></td>
178178
</tr>
179179
<tr style="border-top: 2px solid black">
180180
<td>Text-guided Image Inpainting</td>

docs/source/en/api/loaders/single_file.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ The [`~loaders.FromSingleFileMixin.from_single_file`] method allows you to load:
2222
2323
## Supported pipelines
2424

25-
- [`CogVideoXPipeline`]
2625
- [`StableDiffusionPipeline`]
2726
- [`StableDiffusionImg2ImgPipeline`]
2827
- [`StableDiffusionInpaintPipeline`]
@@ -50,7 +49,6 @@ The [`~loaders.FromSingleFileMixin.from_single_file`] method allows you to load:
5049
- [`UNet2DConditionModel`]
5150
- [`StableCascadeUNet`]
5251
- [`AutoencoderKL`]
53-
- [`AutoencoderKLCogVideoX`]
5452
- [`ControlNetModel`]
5553
- [`SD3Transformer2DModel`]
5654
- [`FluxTransformer2DModel`]

docs/source/en/api/models/controlnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
2929
url = "https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_canny.pth" # can also be a local path
3030
controlnet = ControlNetModel.from_single_file(url)
3131

32-
url = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned.safetensors" # can also be a local path
32+
url = "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned.safetensors" # can also be a local path
3333
pipe = StableDiffusionControlNetPipeline.from_single_file(url, controlnet=controlnet)
3434
```
3535

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers.m
2929

3030
This pipeline was contributed by [zRzRzRzRzRzRzR](https://github.com/zRzRzRzRzRzRzR). The original codebase can be found [here](https://huggingface.co/THUDM). The original weights can be found under [hf.co/THUDM](https://huggingface.co/THUDM).
3131

32-
There are two models available that can be used with the CogVideoX pipeline:
33-
- [`THUDM/CogVideoX-2b`](https://huggingface.co/THUDM/CogVideoX-2b)
34-
- [`THUDM/CogVideoX-5b`](https://huggingface.co/THUDM/CogVideoX-5b)
32+
There are two models available that can be used with the text-to-video and video-to-video CogVideoX pipelines:
33+
- [`THUDM/CogVideoX-2b`](https://huggingface.co/THUDM/CogVideoX-2b): The recommended dtype for running this model is `fp16`.
34+
- [`THUDM/CogVideoX-5b`](https://huggingface.co/THUDM/CogVideoX-5b): The recommended dtype for running this model is `bf16`.
35+
36+
There is one model available that can be used with the image-to-video CogVideoX pipeline:
37+
- [`THUDM/CogVideoX-5b-I2V`](https://huggingface.co/THUDM/CogVideoX-5b-I2V): The recommended dtype for running this model is `bf16`.
3538

3639
## Inference
3740

@@ -41,10 +44,15 @@ First, load the pipeline:
4144

4245
```python
4346
import torch
44-
from diffusers import CogVideoXPipeline
45-
from diffusers.utils import export_to_video
47+
from diffusers import CogVideoXPipeline, CogVideoXImageToVideoPipeline
48+
from diffusers.utils import export_to_video,load_image
49+
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b").to("cuda") # or "THUDM/CogVideoX-2b"
50+
```
4651

47-
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-2b").to("cuda")
52+
If you are using the image-to-video pipeline, load it as follows:
53+
54+
```python
55+
pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V").to("cuda")
4856
```
4957

5058
Then change the memory layout of the pipelines `transformer` component to `torch.channels_last`:
@@ -53,7 +61,7 @@ Then change the memory layout of the pipelines `transformer` component to `torch
5361
pipe.transformer.to(memory_format=torch.channels_last)
5462
```
5563

56-
Finally, compile the components and run inference:
64+
Compile the components and run inference:
5765

5866
```python
5967
pipe.transformer = torch.compile(pipeline.transformer, mode="max-autotune", fullgraph=True)
@@ -63,7 +71,7 @@ prompt = "A panda, dressed in a small, red jacket and a tiny hat, sits on a wood
6371
video = pipe(prompt=prompt, guidance_scale=6, num_inference_steps=50).frames[0]
6472
```
6573

66-
The [benchmark](https://gist.github.com/a-r-r-o-w/5183d75e452a368fd17448fcc810bd3f) results on an 80GB A100 machine are:
74+
The [T2V benchmark](https://gist.github.com/a-r-r-o-w/5183d75e452a368fd17448fcc810bd3f) results on an 80GB A100 machine are:
6775

6876
```
6977
Without torch.compile(): Average inference time: 96.89 seconds.
@@ -98,6 +106,12 @@ It is also worth noting that torchao quantization is fully compatible with [torc
98106
- all
99107
- __call__
100108

109+
## CogVideoXImageToVideoPipeline
110+
111+
[[autodoc]] CogVideoXImageToVideoPipeline
112+
- all
113+
- __call__
114+
101115
## CogVideoXVideoToVideoPipeline
102116

103117
[[autodoc]] CogVideoXVideoToVideoPipeline

0 commit comments

Comments
 (0)