text stringlengths 3 14.4k | source stringclasses 273
values | url stringlengths 47 172 | source_section stringlengths 0 95 | file_type stringclasses 1
value | id stringlengths 3 6 |
|---|---|---|---|---|---|
Motion LoRAs are a collection of LoRAs that work with the `guoyww/animatediff-motion-adapter-v1-5-2` checkpoint. These LoRAs are responsible for adding specific types of motion to the animations.
```python
import torch
from diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter
from diffusers.utils import... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-motion-loras | #using-motion-loras | .md | 158_12 |
You can also leverage the [PEFT](https://github.com/huggingface/peft) backend to combine Motion LoRA's and create more complex animations.
First install PEFT with
```shell
pip install peft
```
Then you can use the following code to combine Motion LoRAs.
```python
import torch
from diffusers import AnimateDiffPi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-motion-loras-with-peft | #using-motion-loras-with-peft | .md | 158_13 |
[FreeInit: Bridging Initialization Gap in Video Diffusion Models](https://arxiv.org/abs/2312.07537) by Tianxing Wu, Chenyang Si, Yuming Jiang, Ziqi Huang, Ziwei Liu.
FreeInit is an effective method that improves temporal consistency and overall quality of videos generated using video-diffusion-models without any addi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-freeinit | #using-freeinit | .md | 158_14 |
[AnimateLCM](https://animatelcm.github.io/) is a motion module checkpoint and an [LCM LoRA](https://huggingface.co/docs/diffusers/using-diffusers/inference_with_lcm_lora) that have been created using a consistency learning strategy that decouples the distillation of the image generation priors and the motion generation... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-animatelcm | #using-animatelcm | .md | 158_15 |
[FreeNoise: Tuning-Free Longer Video Diffusion via Noise Rescheduling](https://arxiv.org/abs/2310.15169) by Haonan Qiu, Menghan Xia, Yong Zhang, Yingqing He, Xintao Wang, Ying Shan, Ziwei Liu.
FreeNoise is a sampling mechanism that can generate longer videos with short-video generation models by employing noise-resch... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-freenoise | #using-freenoise | .md | 158_16 |
Since FreeNoise processes multiple frames together, there are parts in the modeling where the memory required exceeds that available on normal consumer GPUs. The main memory bottlenecks that we identified are spatial and temporal attention blocks, upsampling and downsampling blocks, resnet blocks and feed-forward layer... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#freenoise-memory-savings | #freenoise-memory-savings | .md | 158_17 |
`diffusers>=0.30.0` supports loading the AnimateDiff checkpoints into the `MotionAdapter` in their original format via `from_single_file`
```python
from diffusers import MotionAdapter
ckpt_path = "https://huggingface.co/Lightricks/LongAnimateDiff/blob/main/lt_long_mm_32_frames.ckpt"
adapter = MotionAdapter.from_sin... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#using-fromsinglefile-with-the-motionadapter | #using-fromsinglefile-with-the-motionadapter | .md | 158_18 |
AnimateDiffPipeline
Pipeline for text-to-video generation.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loading methods:... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffpipeline | #animatediffpipeline | .md | 158_19 |
AnimateDiffControlNetPipeline
Pipeline for text-to-video generation with ControlNet guidance.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inhe... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffcontrolnetpipeline | #animatediffcontrolnetpipeline | .md | 158_20 |
AnimateDiffSparseControlNetPipeline
Pipeline for controlled text-to-video generation using the method described in [SparseCtrl: Adding Sparse Controls
to Text-to-Video Diffusion Models](https://arxiv.org/abs/2311.16933).
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the gene... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffsparsecontrolnetpipeline | #animatediffsparsecontrolnetpipeline | .md | 158_21 |
AnimateDiffSDXLPipeline
Pipeline for text-to-video generation using Stable Diffusion XL.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
The... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffsdxlpipeline | #animatediffsdxlpipeline | .md | 158_22 |
AnimateDiffVideoToVideoPipeline
Pipeline for video-to-video generation.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loa... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffvideotovideopipeline | #animatediffvideotovideopipeline | .md | 158_23 |
AnimateDiffVideoToVideoControlNetPipeline
Pipeline for video-to-video generation with ControlNet guidance.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipel... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffvideotovideocontrolnetpipeline | #animatediffvideotovideocontrolnetpipeline | .md | 158_24 |
AnimateDiffPipelineOutput
Output class for AnimateDiff pipelines.
Args:
frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]):
List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing
denoised
PIL image sequences of length `num_frames.` It can also be a N... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/animatediff.md | https://huggingface.co/docs/diffusers/en/api/pipelines/animatediff/#animatediffpipelineoutput | #animatediffpipelineoutput | .md | 158_25 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/ | .md | 159_0 | |
[Text2Video-Zero: Text-to-Image Diffusion Models are Zero-Shot Video Generators](https://huggingface.co/papers/2303.13439) is by Levon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, [Zhangyang Wang](https://www.ece.utexas.edu/people/faculty/atlas-wang), Shant Navasardyan, [Humphrey Shi](https://w... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#text2video-zero | #text2video-zero | .md | 159_1 |
To generate a video from prompt, run the following Python code:
```python
import torch
from diffusers import TextToVideoZeroPipeline
import imageio
model_id = "stable-diffusion-v1-5/stable-diffusion-v1-5"
pipe = TextToVideoZeroPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
prompt = "A panda ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#text-to-video | #text-to-video | .md | 159_2 |
To generate a video from prompt with additional pose control
1. Download a demo video
```python
from huggingface_hub import hf_hub_download
filename = "__assets__/poses_skeleton_gifs/dance1_corr.mp4"
repo_id = "PAIR/Text2Video-Zero"
video_path = hf_hub_download(repo_type="space", repo_id=repo_id, filename=filename... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#text-to-video-with-pose-control | #text-to-video-with-pose-control | .md | 159_3 |
To generate a video from prompt with additional Canny edge control, follow the same steps described above for pose-guided generation using [Canny edge ControlNet model](https://huggingface.co/lllyasviel/sd-controlnet-canny). | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#text-to-video-with-edge-control | #text-to-video-with-edge-control | .md | 159_4 |
To perform text-guided video editing (with [InstructPix2Pix](pix2pix)):
1. Download a demo video
```python
from huggingface_hub import hf_hub_download
filename = "__assets__/pix2pix video/camel.mp4"
repo_id = "PAIR/Text2Video-Zero"
video_path = hf_hub_download(repo_type="space", repo_id=repo_id, filename=filename)... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#video-instruct-pix2pix | #video-instruct-pix2pix | .md | 159_5 |
Methods **Text-To-Video**, **Text-To-Video with Pose Control** and **Text-To-Video with Edge Control**
can run with custom [DreamBooth](../../training/dreambooth) models, as shown below for
[Canny edge ControlNet model](https://huggingface.co/lllyasviel/sd-controlnet-canny) and
[Avatar style DreamBooth](https://hugging... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#dreambooth-specialization | #dreambooth-specialization | .md | 159_6 |
TextToVideoZeroPipeline
Pipeline for zero-shot text-to-video generation using Stable Diffusion.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
Args:
vae ([`Autoenc... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#texttovideozeropipeline | #texttovideozeropipeline | .md | 159_7 |
TextToVideoZeroSDXLPipeline
Pipeline for zero-shot text-to-video generation using Stable Diffusion XL.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
Args:
vae ([`... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#texttovideozerosdxlpipeline | #texttovideozerosdxlpipeline | .md | 159_8 |
TextToVideoPipelineOutput
Output class for zero-shot text-to-video pipeline.
Args:
images (`[List[PIL.Image.Image]`, `np.ndarray`]):
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
num_channels)`.
nsfw_content_detected (`[List[bool]]`):
List indicating whether... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/text_to_video_zero.md | https://huggingface.co/docs/diffusers/en/api/pipelines/text_to_video_zero/#texttovideopipelineoutput | #texttovideopipelineoutput | .md | 159_9 |
<!--Copyright 2024 The HuggingFace Team and Tencent Hunyuan Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_hunyuandit.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_hunyuandit/ | .md | 160_0 | |
HunyuanDiTControlNetPipeline is an implementation of ControlNet for [Hunyuan-DiT](https://arxiv.org/abs/2405.08748).
ControlNet was introduced in [Adding Conditional Control to Text-to-Image Diffusion Models](https://huggingface.co/papers/2302.05543) by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala.
With a ControlNet... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_hunyuandit.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_hunyuandit/#controlnet-with-hunyuan-dit | #controlnet-with-hunyuan-dit | .md | 160_1 |
HunyuanDiTControlNetPipeline
Pipeline for English/Chinese-to-image generation using HunyuanDiT.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_hunyuandit.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_hunyuandit/#hunyuanditcontrolnetpipeline | #hunyuanditcontrolnetpipeline | .md | 160_2 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/kandinsky3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/kandinsky3/ | .md | 161_0 | |
Kandinsky 3 is created by [Vladimir Arkhipkin](https://github.com/oriBetelgeuse),[Anastasia Maltseva](https://github.com/NastyaMittseva),[Igor Pavlov](https://github.com/boomb0om),[Andrei Filatov](https://github.com/anvilarth),[Arseniy Shakhmatov](https://github.com/cene555),[Andrey Kuznetsov](https://github.com/kuznet... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/kandinsky3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/kandinsky3/#kandinsky-3 | #kandinsky-3 | .md | 161_1 |
Kandinsky3Pipeline
- all
- __call__ | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/kandinsky3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/kandinsky3/#kandinsky3pipeline | #kandinsky3pipeline | .md | 161_2 |
Kandinsky3Img2ImgPipeline
- all
- __call__ | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/kandinsky3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/kandinsky3/#kandinsky3img2imgpipeline | #kandinsky3img2imgpipeline | .md | 161_3 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_sd3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3/ | .md | 162_0 | |
StableDiffusion3ControlNetPipeline is an implementation of ControlNet for Stable Diffusion 3.
ControlNet was introduced in [Adding Conditional Control to Text-to-Image Diffusion Models](https://huggingface.co/papers/2302.05543) by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala.
With a ControlNet model, you can provide... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_sd3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3/#controlnet-with-stable-diffusion-3 | #controlnet-with-stable-diffusion-3 | .md | 162_1 |
StableDiffusion3ControlNetPipeline
Args:
transformer ([`SD3Transformer2DModel`]):
Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.
scheduler ([`FlowMatchEulerDiscreteScheduler`]):
A scheduler to be used in combination with `transformer` to denoise the encoded image latents.
vae ([`Au... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_sd3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3/#stablediffusion3controlnetpipeline | #stablediffusion3controlnetpipeline | .md | 162_2 |
StableDiffusion3ControlNetInpaintingPipeline
Args:
transformer ([`SD3Transformer2DModel`]):
Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.
scheduler ([`FlowMatchEulerDiscreteScheduler`]):
A scheduler to be used in combination with `transformer` to denoise the encoded image latents.... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_sd3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3/#stablediffusion3controlnetinpaintingpipeline | #stablediffusion3controlnetinpaintingpipeline | .md | 162_3 |
StableDiffusion3PipelineOutput
Output class for Stable Diffusion pipelines.
Args:
images (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width,
num_channels)`. PIL images or numpy array present the denoised images of the diff... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/controlnet_sd3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3/#stablediffusion3pipelineoutput | #stablediffusion3pipelineoutput | .md | 162_4 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/auto_pipeline.md | https://huggingface.co/docs/diffusers/en/api/pipelines/auto_pipeline/ | .md | 163_0 | |
The `AutoPipeline` is designed to make it easy to load a checkpoint for a task without needing to know the specific pipeline class. Based on the task, the `AutoPipeline` automatically retrieves the correct pipeline class from the checkpoint `model_index.json` file.
> [!TIP]
> Check out the [AutoPipeline](../../tutori... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/auto_pipeline.md | https://huggingface.co/docs/diffusers/en/api/pipelines/auto_pipeline/#autopipeline | #autopipeline | .md | 163_1 |
AutoPipelineForText2Image
[`AutoPipelineForText2Image`] is a generic pipeline class that instantiates a text-to-image pipeline class. The
specific underlying pipeline class is automatically selected from either the
[`~AutoPipelineForText2Image.from_pretrained`] or [`~AutoPipelineForText2Image.from_pipe`] methods.
T... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/auto_pipeline.md | https://huggingface.co/docs/diffusers/en/api/pipelines/auto_pipeline/#autopipelinefortext2image | #autopipelinefortext2image | .md | 163_2 |
AutoPipelineForImage2Image
[`AutoPipelineForImage2Image`] is a generic pipeline class that instantiates an image-to-image pipeline class. The
specific underlying pipeline class is automatically selected from either the
[`~AutoPipelineForImage2Image.from_pretrained`] or [`~AutoPipelineForImage2Image.from_pipe`] method... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/auto_pipeline.md | https://huggingface.co/docs/diffusers/en/api/pipelines/auto_pipeline/#autopipelineforimage2image | #autopipelineforimage2image | .md | 163_3 |
AutoPipelineForInpainting
[`AutoPipelineForInpainting`] is a generic pipeline class that instantiates an inpainting pipeline class. The
specific underlying pipeline class is automatically selected from either the
[`~AutoPipelineForInpainting.from_pretrained`] or [`~AutoPipelineForInpainting.from_pipe`] methods.
Thi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/auto_pipeline.md | https://huggingface.co/docs/diffusers/en/api/pipelines/auto_pipeline/#autopipelineforinpainting | #autopipelineforinpainting | .md | 163_4 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/ | .md | 164_0 | |
Stable Diffusion is a text-to-image latent diffusion model created by the researchers and engineers from [CompVis](https://github.com/CompVis), [Stability AI](https://stability.ai/) and [LAION](https://laion.ai/). Latent diffusion applies the diffusion process over a lower dimensional latent space to reduce memory and ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/#stable-diffusion-pipelines | #stable-diffusion-pipelines | .md | 164_1 |
To help you get the most out of the Stable Diffusion pipelines, here are a few tips for improving performance and usability. These tips are applicable to all Stable Diffusion pipelines. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/#tips | #tips | .md | 164_2 |
[`StableDiffusionPipeline`] uses the [`PNDMScheduler`] by default, but 🤗 Diffusers provides many other schedulers (some of which are faster or output better quality) that are compatible. For example, if you want to use the [`EulerDiscreteScheduler`] instead of the default:
```py
from diffusers import StableDiffusion... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/#explore-tradeoff-between-speed-and-quality | #explore-tradeoff-between-speed-and-quality | .md | 164_3 |
To save memory and use the same components across multiple pipelines, use the `.components` method to avoid loading weights into RAM more than once.
```py
from diffusers import (
StableDiffusionPipeline,
StableDiffusionImg2ImgPipeline,
StableDiffusionInpaintPipeline,
)
text2img = StableDiffusionPipeline.from_pretrai... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/#reuse-pipeline-components-to-save-memory | #reuse-pipeline-components-to-save-memory | .md | 164_4 |
The Stable Diffusion pipelines are automatically supported in [Gradio](https://github.com/gradio-app/gradio/), a library that makes creating beautiful and user-friendly machine learning apps on the web a breeze. First, make sure you have Gradio installed:
```sh
pip install -U gradio
```
Then, create a web demo arou... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/overview.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/overview/#create-web-demos-using-gradio | #create-web-demos-using-gradio | .md | 164_5 |
<!--Copyright 2024 The Intel Labs Team Authors and HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/ldm3d_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/ldm3d_diffusion/ | .md | 165_0 | |
LDM3D was proposed in [LDM3D: Latent Diffusion Model for 3D](https://huggingface.co/papers/2305.10853) by Gabriela Ben Melech Stan, Diana Wofk, Scottie Fox, Alex Redden, Will Saxton, Jean Yu, Estelle Aflalo, Shao-Yen Tseng, Fabio Nonato, Matthias Muller, and Vasudev Lal. LDM3D generates an image and a depth map from a ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/ldm3d_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/ldm3d_diffusion/#text-to-rgb-depth | #text-to-rgb-depth | .md | 165_1 |
StableDiffusionLDM3DPipeline
Pipeline for text-to-image and 3D generation using LDM3D.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits th... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/ldm3d_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/ldm3d_diffusion/#stablediffusionldm3dpipeline | #stablediffusionldm3dpipeline | .md | 165_2 |
LDM3DPipelineOutput
Output class for Stable Diffusion pipelines.
Args:
rgb (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
num_channels)`.
depth (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/ldm3d_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/ldm3d_diffusion/#ldm3dpipelineoutput | #ldm3dpipelineoutput | .md | 165_3 |
[LDM3D-VR](https://arxiv.org/pdf/2311.03226.pdf) is an extended version of LDM3D.
The abstract from the paper is:
*Latent diffusion models have proven to be state-of-the-art in the creation and manipulation of visual outputs. However, as far as we know, the generation of depth maps jointly with RGB is still limited. ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/ldm3d_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/ldm3d_diffusion/#upscaler | #upscaler | .md | 165_4 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/sdxl_turbo.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/sdxl_turbo/ | .md | 166_0 | |
Stable Diffusion XL (SDXL) Turbo was proposed in [Adversarial Diffusion Distillation](https://stability.ai/research/adversarial-diffusion-distillation) by Axel Sauer, Dominik Lorenz, Andreas Blattmann, and Robin Rombach.
The abstract from the paper is:
*We introduce Adversarial Diffusion Distillation (ADD), a novel... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/sdxl_turbo.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/sdxl_turbo/#sdxl-turbo | #sdxl-turbo | .md | 166_1 |
- SDXL Turbo uses the exact same architecture as [SDXL](./stable_diffusion_xl), which means it also has the same API. Please refer to the [SDXL](./stable_diffusion_xl) API reference for more details.
- SDXL Turbo should disable guidance scale by setting `guidance_scale=0.0`.
- SDXL Turbo should use `timestep_spacing='t... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/sdxl_turbo.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/sdxl_turbo/#tips | #tips | .md | 166_2 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/k_diffusion/ | .md | 167_0 | |
[k-diffusion](https://github.com/crowsonkb/k-diffusion) is a popular library created by [Katherine Crowson](https://github.com/crowsonkb/). We provide `StableDiffusionKDiffusionPipeline` and `StableDiffusionXLKDiffusionPipeline` that allow you to run Stable DIffusion with samplers from k-diffusion.
Note that most the... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/k_diffusion/#k-diffusion | #k-diffusion | .md | 167_1 |
StableDiffusionKDiffusionPipeline | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/k_diffusion/#stablediffusionkdiffusionpipeline | #stablediffusionkdiffusionpipeline | .md | 167_2 |
StableDiffusionXLKDiffusionPipeline | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/k_diffusion.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/k_diffusion/#stablediffusionxlkdiffusionpipeline | #stablediffusionxlkdiffusionpipeline | .md | 167_3 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/image_variation.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/image_variation/ | .md | 168_0 | |
The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by [Justin Pinkney](https://www.justinpinkney.com/) from [Lambda](https://lambdalabs.com/).
The original codebase can be found at [LambdaLabsML/lambda-diffusers](https://github.com/Lam... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/image_variation.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/image_variation/#image-variation | #image-variation | .md | 168_1 |
StableDiffusionImageVariationPipeline
Pipeline to generate image variations from an input image using Stable Diffusion.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.)... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/image_variation.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/image_variation/#stablediffusionimagevariationpipeline | #stablediffusionimagevariationpipeline | .md | 168_2 |
StableDiffusionPipelineOutput
Output class for Stable Diffusion pipelines.
Args:
images (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
num_channels)`.
nsfw_content_detected (`List[bool]`)
List indicating whether the c... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/image_variation.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/image_variation/#stablediffusionpipelineoutput | #stablediffusionpipelineoutput | .md | 168_3 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/ | .md | 169_0 | |
The Stable Diffusion model was created by researchers and engineers from [CompVis](https://github.com/CompVis), [Stability AI](https://stability.ai/), [Runway](https://github.com/runwayml), and [LAION](https://laion.ai/). The [`StableDiffusionPipeline`] is capable of generating photorealistic images given any text inpu... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/#text-to-image | #text-to-image | .md | 169_1 |
StableDiffusionPipeline
Pipeline for text-to-image generation using Stable Diffusion.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/#stablediffusionpipeline | #stablediffusionpipeline | .md | 169_2 |
StableDiffusionPipelineOutput
Output class for Stable Diffusion pipelines.
Args:
images (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
num_channels)`.
nsfw_content_detected (`List[bool]`)
List indicating whether the c... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/#stablediffusionpipelineoutput | #stablediffusionpipelineoutput | .md | 169_3 |
FlaxStableDiffusionPipeline
- all
- __call__ | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/#flaxstablediffusionpipeline | #flaxstablediffusionpipeline | .md | 169_4 |
[[autodoc]] FlaxStableDiffusionPipelineOutput: module diffusers.pipelines.stable_diffusion has no attribute FlaxStableDiffusionPipelineOutput | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/text2img.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/text2img/#flaxstablediffusionpipelineoutput | #flaxstablediffusionpipelineoutput | .md | 169_5 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/latent_upscale.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/latent_upscale/ | .md | 170_0 | |
The Stable Diffusion latent upscaler model was created by [Katherine Crowson](https://github.com/crowsonkb/k-diffusion) in collaboration with [Stability AI](https://stability.ai/). It is used to enhance the output image resolution by a factor of 2 (see this demo [notebook](https://colab.research.google.com/drive/1o1qYJ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/latent_upscale.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/latent_upscale/#latent-upscaler | #latent-upscaler | .md | 170_1 |
StableDiffusionLatentUpscalePipeline
Pipeline for upscaling Stable Diffusion output image resolution by a factor of 2.
This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/latent_upscale.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/latent_upscale/#stablediffusionlatentupscalepipeline | #stablediffusionlatentupscalepipeline | .md | 170_2 |
StableDiffusionPipelineOutput
Output class for Stable Diffusion pipelines.
Args:
images (`List[PIL.Image.Image]` or `np.ndarray`)
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width,
num_channels)`.
nsfw_content_detected (`List[bool]`)
List indicating whether the c... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/latent_upscale.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/latent_upscale/#stablediffusionpipelineoutput | #stablediffusionpipelineoutput | .md | 170_3 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/ | .md | 171_0 | |
Stable Diffusion 2 is a text-to-image _latent diffusion_ model built upon the work of the original [Stable Diffusion](https://stability.ai/blog/stable-diffusion-public-release), and it was led by Robin Rombach and Katherine Crowson from [Stability AI](https://stability.ai/) and [LAION](https://laion.ai/).
*The Stable... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/#stable-diffusion-2 | #stable-diffusion-2 | .md | 171_1 |
```py
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
import torch
repo_id = "stabilityai/stable-diffusion-2-base"
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/#text-to-image | #text-to-image | .md | 171_2 |
```py
import torch
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import load_image, make_image_grid
img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
mask_url = "https://raw.githubuserconte... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/#inpainting | #inpainting | .md | 171_3 |
```py
from diffusers import StableDiffusionUpscalePipeline
from diffusers.utils import load_image, make_image_grid
import torch
# load model and scheduler
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline = pipe... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/#super-resolution | #super-resolution | .md | 171_4 |
```py
import torch
from diffusers import StableDiffusionDepth2ImgPipeline
from diffusers.utils import load_image, make_image_grid
pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
"stabilityai/stable-diffusion-2-depth",
torch_dtype=torch.float16,
).to("cuda")
url = "http://images.cocodataset.org/val2017/00000... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_2.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_2/#depth-to-image | #depth-to-image | .md | 171_5 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/ | .md | 172_0 | |
Stable Diffusion 3 (SD3) was proposed in [Scaling Rectified Flow Transformers for High-Resolution Image Synthesis](https://arxiv.org/pdf/2403.03206.pdf) by Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Muller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, Dustin Podell, Tim... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#stable-diffusion-3 | #stable-diffusion-3 | .md | 172_1 |
_As the model is gated, before using it with diffusers you first need to go to the [Stable Diffusion 3 Medium Hugging Face page](https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers), fill in the form and accept the gate. Once you are in, you need to login so that your system knows you’ve accepted the... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#usage-example | #usage-example | .md | 172_2 |
An IP-Adapter lets you prompt SD3 with images, in addition to the text prompt. This is especially useful when describing complex concepts that are difficult to articulate through text alone and you have reference images. To load and use an IP-Adapter, you need:
- `image_encoder`: Pre-trained vision model used to obta... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#image-prompting-with-ip-adapters | #image-prompting-with-ip-adapters | .md | 172_3 |
SD3 uses three text encoders, one of which is the very large T5-XXL model. This makes it challenging to run the model on GPUs with less than 24GB of VRAM, even when using `fp16` precision. The following section outlines a few memory optimizations in Diffusers that make it easier to run SD3 on low resource hardware. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#memory-optimisations-for-sd3 | #memory-optimisations-for-sd3 | .md | 172_4 |
The most basic memory optimization available in Diffusers allows you to offload the components of the model to CPU during inference in order to save memory, while seeing a slight increase in inference latency. Model offloading will only move a model component onto the GPU when it needs to be executed, while keeping the... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#running-inference-with-model-offloading | #running-inference-with-model-offloading | .md | 172_5 |
Removing the memory-intensive 4.7B parameter T5-XXL text encoder during inference can significantly decrease the memory requirements for SD3 with only a slight loss in performance.
```python
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained(
"stabilityai/stab... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#dropping-the-t5-text-encoder-during-inference | #dropping-the-t5-text-encoder-during-inference | .md | 172_6 |
We can leverage the `bitsandbytes` library to load and quantize the T5-XXL text encoder to 8-bit precision. This allows you to keep using all three text encoders while only slightly impacting performance.
First install the `bitsandbytes` library.
```shell
pip install bitsandbytes
```
Then load the T5-XXL model us... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#using-a-quantized-version-of-the-t5-text-encoder | #using-a-quantized-version-of-the-t5-text-encoder | .md | 172_7 |
Using compiled components in the SD3 pipeline can speed up inference by as much as 4X. The following code snippet demonstrates how to compile the Transformer and VAE components of the SD3 pipeline.
```python
import torch
from diffusers import StableDiffusion3Pipeline
torch.set_float32_matmul_precision("high")
torch... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#using-torch-compile-to-speed-up-inference | #using-torch-compile-to-speed-up-inference | .md | 172_8 |
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.
Refer to the [Quantization](../../quantization/overview) overview to learn more about supported q... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#quantization | #quantization | .md | 172_9 |
By default, the T5 Text Encoder prompt uses a maximum sequence length of `256`. This can be adjusted by setting the `max_sequence_length` to accept fewer or more tokens. Keep in mind that longer sequences require additional resources and result in longer generation times, such as during batch inference.
```python
pro... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#using-long-prompts-with-the-t5-text-encoder | #using-long-prompts-with-the-t5-text-encoder | .md | 172_10 |
You can send a different prompt to the CLIP Text Encoders and the T5 Text Encoder to prevent the prompt from being truncated by the CLIP Text Encoders and to improve generation.
<Tip>
The prompt with the CLIP Text Encoders is still truncated to the 77 token limit.
</Tip>
```python
prompt = "A whimsical and crea... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#sending-a-different-prompt-to-the-t5-text-encoder | #sending-a-different-prompt-to-the-t5-text-encoder | .md | 172_11 |
Tiny AutoEncoder for Stable Diffusion (TAESD3) is a tiny distilled version of Stable Diffusion 3's VAE by [Ollin Boer Bohan](https://github.com/madebyollin/taesd) that can decode [`StableDiffusion3Pipeline`] latents almost instantly.
To use with Stable Diffusion 3:
```python
import torch
from diffusers import Stabl... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#tiny-autoencoder-for-stable-diffusion-3 | #tiny-autoencoder-for-stable-diffusion-3 | .md | 172_12 |
The `SD3Transformer2DModel` and `StableDiffusion3Pipeline` classes support loading the original checkpoints via the `from_single_file` method. This method allows you to load the original checkpoint files that were used to train the models. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#loading-the-original-checkpoints-via-fromsinglefile | #loading-the-original-checkpoints-via-fromsinglefile | .md | 172_13 |
```python
from diffusers import SD3Transformer2DModel
model = SD3Transformer2DModel.from_single_file("https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/sd3_medium.safetensors")
``` | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#loading-the-original-checkpoints-for-the-sd3transformer2dmodel | #loading-the-original-checkpoints-for-the-sd3transformer2dmodel | .md | 172_14 |
```python
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_single_file(
"https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/sd3_medium_incl_clips.safetensors",
torch_dtype=torch.float16,
text_encoder_3=None
)
pipe.enable_model_cpu_offload()
image = p... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#loading-the-single-file-checkpoint-without-t5 | #loading-the-single-file-checkpoint-without-t5 | .md | 172_15 |
> [!TIP]
> The following example loads a checkpoint stored in a 8-bit floating point format which requires PyTorch 2.3 or later.
```python
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_single_file(
"https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/m... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#loading-the-single-file-checkpoint-with-t5 | #loading-the-single-file-checkpoint-with-t5 | .md | 172_16 |
```python
import torch
from diffusers import SD3Transformer2DModel, StableDiffusion3Pipeline
transformer = SD3Transformer2DModel.from_single_file(
"https://huggingface.co/stabilityai/stable-diffusion-3.5-large-turbo/blob/main/sd3.5_large.safetensors",
torch_dtype=torch.bfloat16,
)
pipe = StableDiffusion3Pipeline.from_... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#loading-the-single-file-checkpoint-for-the-stable-diffusion-35-transformer-model | #loading-the-single-file-checkpoint-for-the-stable-diffusion-35-transformer-model | .md | 172_17 |
StableDiffusion3Pipeline
Args:
transformer ([`SD3Transformer2DModel`]):
Conditional Transformer (MMDiT) architecture to denoise the encoded image latents.
scheduler ([`FlowMatchEulerDiscreteScheduler`]):
A scheduler to be used in combination with `transformer` to denoise the encoded image latents.
vae ([`AutoencoderK... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/stable_diffusion_3.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_3/#stablediffusion3pipeline | #stablediffusion3pipeline | .md | 172_18 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/inpaint.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/inpaint/ | .md | 173_0 | |
The Stable Diffusion model can also be applied to inpainting which lets you edit specific parts of an image by providing a mask and a text prompt using Stable Diffusion. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/pipelines/stable_diffusion/inpaint.md | https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/inpaint/#inpainting | #inpainting | .md | 173_1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.