Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/source/en/api/pipelines/animatediff.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ scheduler = DDIMScheduler.from_pretrained(
pipe.scheduler = scheduler

# enable memory savings
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
Expand Down Expand Up @@ -395,8 +395,8 @@ pipe = AnimateDiffSDXLPipeline.from_pretrained(
).to("cuda")

# enable memory savings
pipe.enable_vae_slicing()
pipe.enable_vae_tiling()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()

output = pipe(
prompt="a panda surfing in the ocean, realistic, high quality",
Expand Down Expand Up @@ -441,7 +441,7 @@ scheduler = DDIMScheduler.from_pretrained(
pipe.scheduler = scheduler

# enable memory savings
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

# helper function to load videos
Expand Down Expand Up @@ -640,7 +640,7 @@ scheduler = DDIMScheduler.from_pretrained(
pipe.scheduler = scheduler

# enable memory savings
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
Expand Down Expand Up @@ -714,7 +714,7 @@ scheduler = DDIMScheduler.from_pretrained(
pipe.scheduler = scheduler

# enable memory savings
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
Expand Down Expand Up @@ -772,8 +772,8 @@ pipe.scheduler = DDIMScheduler.from_pretrained(
)

# enable memory savings
pipe.enable_vae_slicing()
pipe.enable_vae_tiling()
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()

# enable FreeInit
# Refer to the enable_free_init documentation for a full list of configurable parameters
Expand Down Expand Up @@ -840,7 +840,7 @@ pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, beta_schedule="

pipe.load_lora_weights("wangfuyun/AnimateLCM", weight_name="sd15_lora_beta.safetensors", adapter_name="lcm-lora")

pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
Expand Down Expand Up @@ -882,7 +882,7 @@ pipe.load_lora_weights("wangfuyun/AnimateLCM", weight_name="sd15_lora_beta.safet
pipe.load_lora_weights("guoyww/animatediff-motion-lora-tilt-up", adapter_name="tilt-up")

pipe.set_adapters(["lcm-lora", "tilt-up"], [1.0, 0.8])
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
pipe.enable_model_cpu_offload()

output = pipe(
Expand Down
6 changes: 0 additions & 6 deletions docs/source/en/api/pipelines/controlnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ The original codebase can be found at [lllyasviel/ControlNet](https://github.com
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention
- load_textual_inversion
Expand All @@ -49,8 +47,6 @@ The original codebase can be found at [lllyasviel/ControlNet](https://github.com
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention
- load_textual_inversion
Expand All @@ -61,8 +57,6 @@ The original codebase can be found at [lllyasviel/ControlNet](https://github.com
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention
- load_textual_inversion
Expand Down
8 changes: 0 additions & 8 deletions docs/source/en/api/pipelines/latent_consistency_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,6 @@ export_to_gif(frames, "animation.gif")
- __call__
- enable_freeu
- disable_freeu
- enable_vae_slicing
- disable_vae_slicing
- enable_vae_tiling
- disable_vae_tiling

## LatentConsistencyModelImg2ImgPipeline

Expand All @@ -655,10 +651,6 @@ export_to_gif(frames, "animation.gif")
- __call__
- enable_freeu
- disable_freeu
- enable_vae_slicing
- disable_vae_slicing
- enable_vae_tiling
- disable_vae_tiling

## StableDiffusionPipelineOutput

Expand Down
10 changes: 5 additions & 5 deletions docs/source/en/api/pipelines/mochi.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview")

# Enable memory savings
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()
pipe.vae.enable_tiling()

prompt = "Close-up of a chameleon's eye, with its scaly skin changing color. Ultra high resolution 4k."

Expand All @@ -109,7 +109,7 @@ pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview", variant="bf16", to

# Enable memory savings
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()
pipe.vae.enable_tiling()

prompt = "Close-up of a chameleon's eye, with its scaly skin changing color. Ultra high resolution 4k."
frames = pipe(prompt, num_frames=85).frames[0]
Expand Down Expand Up @@ -138,7 +138,7 @@ from diffusers.utils import export_to_video
from diffusers.video_processor import VideoProcessor

pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview", force_zeros_for_empty_prompt=True)
pipe.enable_vae_tiling()
pipe.vae.enable_tiling()
pipe.enable_model_cpu_offload()

prompt = "An aerial shot of a parade of elephants walking across the African savannah. The camera showcases the herd and the surrounding landscape."
Expand Down Expand Up @@ -205,7 +205,7 @@ transformer = MochiTransformer3DModel.from_pretrained(

pipe = MochiPipeline.from_pretrained(model_id, transformer=transformer)
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()
pipe.vae.enable_tiling()

with torch.autocast(device_type="cuda", dtype=torch.bfloat16, cache_enabled=False):
frames = pipe(
Expand Down Expand Up @@ -245,7 +245,7 @@ transformer = MochiTransformer3DModel.from_pretrained(ckpt_path, torch_dtype=tor

pipe = MochiPipeline.from_pretrained(model_id, transformer=transformer)
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()
pipe.vae.enable_tiling()

with torch.autocast(device_type="cuda", dtype=torch.bfloat16, cache_enabled=False):
frames = pipe(
Expand Down
4 changes: 0 additions & 4 deletions docs/source/en/api/pipelines/stable_diffusion/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ This model was contributed by the community contributor [HimariO](https://github
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention

Expand All @@ -41,7 +39,5 @@ This model was contributed by the community contributor [HimariO](https://github
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention
4 changes: 0 additions & 4 deletions docs/source/en/api/pipelines/stable_diffusion/text2img.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ The abstract from the paper is:
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention
- enable_vae_tiling
- disable_vae_tiling
- load_textual_inversion
- from_single_file
- load_lora_weights
Expand Down
4 changes: 0 additions & 4 deletions docs/source/en/api/pipelines/stable_unclip.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ image
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention

Expand All @@ -118,8 +116,6 @@ image
- __call__
- enable_attention_slicing
- disable_attention_slicing
- enable_vae_slicing
- disable_vae_slicing
- enable_xformers_memory_efficient_attention
- disable_xformers_memory_efficient_attention

Expand Down
8 changes: 4 additions & 4 deletions docs/source/en/optimization/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ VAE slicing saves memory by splitting large batches of inputs into a single batc

For example, if you're generating 4 images at once, decoding would increase peak activation memory by 4x. VAE slicing reduces this by only decoding 1 image at a time instead of all 4 images at once.

Call [`~StableDiffusionPipeline.enable_vae_slicing`] to enable sliced VAE. You can expect a small increase in performance when decoding multi-image batches and no performance impact for single-image batches.
Call [`~AutoencoderKL.enable_slicing`] to enable sliced VAE. You can expect a small increase in performance when decoding multi-image batches and no performance impact for single-image batches.

```py
import torch
Expand All @@ -183,7 +183,7 @@ pipeline = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
).to("cuda")
pipeline.enable_vae_slicing()
pipeline.vae.enable_slicing()
pipeline(["An astronaut riding a horse on Mars"]*32).images[0]
print(f"Max memory reserved: {torch.cuda.max_memory_allocated() / 1024**3:.2f} GB")
```
Expand All @@ -195,7 +195,7 @@ print(f"Max memory reserved: {torch.cuda.max_memory_allocated() / 1024**3:.2f} G

VAE tiling saves memory by dividing an image into smaller overlapping tiles instead of processing the entire image at once. This also reduces peak memory usage because the GPU is only processing a tile at a time.

Call [`~StableDiffusionPipeline.enable_vae_tiling`] to enable VAE tiling. The generated image may have some tone variation from tile-to-tile because they're decoded separately, but there shouldn't be any obvious seams between the tiles. Tiling is disabled for resolutions lower than a pre-specified (but configurable) limit. For example, this limit is 512x512 for the VAE in [`StableDiffusionPipeline`].
Call [`~AutoencoderKL.enable_tiling`] to enable VAE tiling. The generated image may have some tone variation from tile-to-tile because they're decoded separately, but there shouldn't be any obvious seams between the tiles. Tiling is disabled for resolutions lower than a pre-specified (but configurable) limit. For example, this limit is 512x512 for the VAE in [`StableDiffusionPipeline`].

```py
import torch
Expand All @@ -205,7 +205,7 @@ from diffusers.utils import load_image
pipeline = AutoPipelineForImage2Image.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
).to("cuda")
pipeline.enable_vae_tiling()
pipeline.vae.enable_tiling()

init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/img2img-sdxl-init.png")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/using-diffusers/ip_adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ scheduler = DDIMScheduler.from_pretrained(
steps_offset=1,
)
pipeline.scheduler = scheduler
pipeline.enable_vae_slicing()
pipeline.vae.enable_slicing()
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin")
pipeline.enable_model_cpu_offload()

Expand Down
4 changes: 2 additions & 2 deletions docs/source/ko/optimization/fp16.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ image = pipe(prompt).images[0]

이를 [`~StableDiffusionPipeline.enable_attention_slicing`] 또는 [`~StableDiffusionPipeline.enable_xformers_memory_efficient_attention`]과 결합하여 메모리 사용을 추가로 최소화할 수 있습니다.

VAE 디코드를 한 번에 하나씩 수행하려면 추론 전에 파이프라인에서 [`~StableDiffusionPipeline.enable_vae_slicing`]을 호출합니다. 예를 들어:
VAE 디코드를 한 번에 하나씩 수행하려면 추론 전에 파이프라인에서 [`~AutoencoderKL.enable_slicing`]을 호출합니다. 예를 들어:

```Python
import torch
Expand All @@ -126,7 +126,7 @@ pipe = StableDiffusionPipeline.from_pretrained(
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
pipe.enable_vae_slicing()
pipe.vae.enable_slicing()
images = pipe([prompt] * 32).images
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/ko/using-diffusers/diffedit.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pipeline = StableDiffusionDiffEditPipeline.from_pretrained(
pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)
pipeline.inverse_scheduler = DDIMInverseScheduler.from_config(pipeline.scheduler.config)
pipeline.enable_model_cpu_offload()
pipeline.enable_vae_slicing()
pipeline.vae.enable_slicing()
```

수정하기 위한 이미지를 불러옵니다:
Expand Down Expand Up @@ -169,7 +169,7 @@ pipeline = StableDiffusionDiffEditPipeline.from_pretrained(
"stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16, use_safetensors=True
)
pipeline.enable_model_cpu_offload()
pipeline.enable_vae_slicing()
pipeline.vae.enable_slicing()

@torch.no_grad()
def embed_prompts(sentences, tokenizer, text_encoder, device="cuda"):
Expand Down
8 changes: 4 additions & 4 deletions docs/source/zh/optimization/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ VAE 切片通过将大批次输入拆分为单个数据批次并分别处理它

例如,如果您同时生成 4 个图像,解码会将峰值激活内存增加 4 倍。VAE 切片通过一次只解码 1 个图像而不是所有 4 个图像来减少这种情况。

调用 [`~StableDiffusionPipeline.enable_vae_slicing`] 来启用切片 VAE。您可以预期在解码多图像批次时性能会有小幅提升,而在单图像批次时没有性能影响。
调用 [`~AutoencoderKL.enable_slicing`] 来启用切片 VAE。您可以预期在解码多图像批次时性能会有小幅提升,而在单图像批次时没有性能影响。

```py
import torch
Expand All @@ -181,7 +181,7 @@ pipeline = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
).to("cuda")
pipeline.enable_vae_slicing()
pipeline.vae.enable_slicing()
pipeline(["An astronaut riding a horse on Mars"]*32).images[0]
print(f"Max memory reserved: {torch.cuda.max_memory_allocated() / 1024**3:.2f} GB")
```
Expand All @@ -193,7 +193,7 @@ print(f"Max memory reserved: {torch.cuda.max_memory_allocated() / 1024**3:.2f} G

VAE 平铺通过将图像划分为较小的重叠图块而不是一次性处理整个图像来节省内存。这也减少了峰值内存使用量,因为 GPU 一次只处理一个图块。

调用 [`~StableDiffusionPipeline.enable_vae_tiling`] 来启用 VAE 平铺。生成的图像可能因图块到图块的色调变化而有所不同,因为它们被单独解码,但图块之间不应有明显的接缝。对于低于预设(但可配置)限制的分辨率,平铺被禁用。例如,对于 [`StableDiffusionPipeline`] 中的 VAE,此限制为 512x512。
调用 [`~AutoencoderKL.enable_tiling`] 来启用 VAE 平铺。生成的图像可能因图块到图块的色调变化而有所不同,因为它们被单独解码,但图块之间不应有明显的接缝。对于低于预设(但可配置)限制的分辨率,平铺被禁用。例如,对于 [`StableDiffusionPipeline`] 中的 VAE,此限制为 512x512。

```py
import torch
Expand All @@ -203,7 +203,7 @@ from diffusers.utils import load_image
pipeline = AutoPipelineForImage2Image.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
).to("cuda")
pipeline.enable_vae_tiling()
pipeline.vae.enable_tiling()

init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/img2img-sdxl-init.png")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
import wandb

# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@


# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
import wandb

# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/cogvideo/train_cogvideox_image_to_video_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import wandb

# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/cogvideo/train_cogvideox_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import wandb

# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/cogview4-control/train_control_cogview4.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
import wandb

# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/community/marigold_depth_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@


# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.39.0.dev0")
check_min_version("0.40.0.dev0")


class MarigoldDepthOutput(BaseOutput):
Expand Down
Loading
Loading