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
EulerAncestralDiscreteSchedulerOutput Output class for the scheduler's `step` function output. Args: prev_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images): Computed sample `(x_{t-1})` of previous timestep. `prev_sample` should be used as next model input in the denoising loop....
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/schedulers/euler_ancestral.md
https://huggingface.co/docs/diffusers/en/api/schedulers/euler_ancestral/#eulerancestraldiscretescheduleroutput
#eulerancestraldiscretescheduleroutput
.md
265_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/schedulers/score_sde_ve.md
https://huggingface.co/docs/diffusers/en/api/schedulers/score_sde_ve/
.md
266_0
`ScoreSdeVeScheduler` is a variance exploding stochastic differential equation (SDE) scheduler. It was introduced in the [Score-Based Generative Modeling through Stochastic Differential Equations](https://huggingface.co/papers/2011.13456) paper by Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, St...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/schedulers/score_sde_ve.md
https://huggingface.co/docs/diffusers/en/api/schedulers/score_sde_ve/#scoresdevescheduler
#scoresdevescheduler
.md
266_1
ScoreSdeVeScheduler `ScoreSdeVeScheduler` is a variance exploding stochastic differential equation (SDE) scheduler. This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic methods the library implements for all schedulers such as loading and saving. Args...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/schedulers/score_sde_ve.md
https://huggingface.co/docs/diffusers/en/api/schedulers/score_sde_ve/#scoresdevescheduler
#scoresdevescheduler
.md
266_2
SdeVeOutput Output class for the scheduler's `step` function output. Args: prev_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images): Computed sample `(x_{t-1})` of previous timestep. `prev_sample` should be used as next model input in the denoising loop. prev_sample_mean (`torch....
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/api/schedulers/score_sde_ve.md
https://huggingface.co/docs/diffusers/en/api/schedulers/score_sde_ve/#sdeveoutput
#sdeveoutput
.md
266_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/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/
.md
267_0
Unconditional image generation is a popular application of diffusion models that generates images that look like those in the dataset used for training. Typically, the best results are obtained from finetuning a pretrained model on a specific dataset. You can find many of these checkpoints on the [Hub](https://huggingf...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#train-a-diffusion-model
#train-a-diffusion-model
.md
267_1
For convenience, create a `TrainingConfig` class containing the training hyperparameters (feel free to adjust them): ```py >>> from dataclasses import dataclass >>> @dataclass ... class TrainingConfig: ... image_size = 128 # the generated image resolution ... train_batch_size = 16 ... eval_batch_size = ...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#training-configuration
#training-configuration
.md
267_2
You can easily load the [Smithsonian Butterflies](https://huggingface.co/datasets/huggan/smithsonian_butterflies_subset) dataset with the 🤗 Datasets library: ```py >>> from datasets import load_dataset >>> config.dataset_name = "huggan/smithsonian_butterflies_subset" >>> dataset = load_dataset(config.dataset_name, ...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#load-the-dataset
#load-the-dataset
.md
267_3
Pretrained models in 🧨 Diffusers are easily created from their model class with the parameters you want. For example, to create a [`UNet2DModel`]: ```py >>> from diffusers import UNet2DModel >>> model = UNet2DModel( ... sample_size=config.image_size, # the target image resolution ... in_channels=3, # the ...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#create-a-unet2dmodel
#create-a-unet2dmodel
.md
267_4
The scheduler behaves differently depending on whether you're using the model for training or inference. During inference, the scheduler generates image from the noise. During training, the scheduler takes a model output - or a sample - from a specific point in the diffusion process and applies noise to the image accor...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#create-a-scheduler
#create-a-scheduler
.md
267_5
By now, you have most of the pieces to start training the model and all that's left is putting everything together. First, you'll need an optimizer and a learning rate scheduler: ```py >>> from diffusers.optimization import get_cosine_schedule_with_warmup >>> optimizer = torch.optim.AdamW(model.parameters(), lr=co...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#train-the-model
#train-the-model
.md
267_6
Unconditional image generation is one example of a task that can be trained. You can explore other tasks and training techniques by visiting the [🧨 Diffusers Training Examples](../training/overview) page. Here are some examples of what you can learn: * [Textual Inversion](../training/text_inversion), an algorithm th...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/basic_training.md
https://huggingface.co/docs/diffusers/en/tutorials/basic_training/#next-steps
#next-steps
.md
267_7
<!--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/tutorials/tutorial_overview.md
https://huggingface.co/docs/diffusers/en/tutorials/tutorial_overview/
.md
268_0
Welcome to 🧨 Diffusers! If you're new to diffusion models and generative AI, and want to learn more, then you've come to the right place. These beginner-friendly tutorials are designed to provide a gentle introduction to diffusion models and help you understand the library fundamentals - the core components and how 🧨...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/tutorial_overview.md
https://huggingface.co/docs/diffusers/en/tutorials/tutorial_overview/#overview
#overview
.md
268_1
<!--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/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/
.md
269_0
Diffusion models are slower than their GAN counterparts because of the iterative and sequential reverse diffusion process. There are several techniques that can address this limitation such as progressive timestep distillation ([LCM LoRA](../using-diffusers/inference_with_lcm_lora)), model compression ([SSD-1B](https:/...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#accelerate-inference-of-text-to-image-diffusion-models
#accelerate-inference-of-text-to-image-diffusion-models
.md
269_1
Let's start with a baseline. Disable reduced precision and the [`scaled_dot_product_attention` (SDPA)](../optimization/torch2.0#scaled-dot-product-attention) function which is automatically used by Diffusers: ```python from diffusers import StableDiffusionXLPipeline # Load the pipeline in full-precision and place it...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#baseline
#baseline
.md
269_2
Enable the first optimization, reduced precision or more specifically bfloat16. There are several benefits of using reduced precision: * Using a reduced numerical precision (such as float16 or bfloat16) for inference doesn’t affect the generation quality but significantly improves latency. * The benefits of using bfl...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#bfloat16
#bfloat16
.md
269_3
Attention blocks are intensive to run. But with PyTorch's [`scaled_dot_product_attention`](../optimization/torch2.0#scaled-dot-product-attention) function, it is a lot more efficient. This function is used by default in Diffusers so you don't need to make any changes to the code. ```python from diffusers import Stabl...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#sdpa
#sdpa
.md
269_4
PyTorch 2 includes `torch.compile` which uses fast and optimized kernels. In Diffusers, the UNet and VAE are usually compiled because these are the most compute-intensive modules. First, configure a few compiler flags (refer to the [full list](https://github.com/pytorch/pytorch/blob/main/torch/_inductor/config.py) for ...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#torchcompile
#torchcompile
.md
269_5
Specifying `fullgraph=True` ensures there are no graph breaks in the underlying model to take full advantage of `torch.compile` without any performance degradation. For the UNet and VAE, this means changing how you access the return variables. ```diff - latents = unet( - latents, timestep=timestep, encoder_hidden_s...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#prevent-graph-breaks
#prevent-graph-breaks
.md
269_6
During the iterative reverse diffusion process, the `step()` function is [called](https://github.com/huggingface/diffusers/blob/1d686bac8146037e97f3fd8c56e4063230f71751/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L1228) on the scheduler each time after the denoiser predicts the less nois...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#remove-gpu-sync-after-compilation
#remove-gpu-sync-after-compilation
.md
269_7
The UNet and VAE in SDXL use Transformer-like blocks which consists of attention blocks and feed-forward blocks. In an attention block, the input is projected into three sub-spaces using three different projection matrices – Q, K, and V. These projections are performed separately on the input. But we can horizontally...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#combine-the-attention-blocks-projection-matrices
#combine-the-attention-blocks-projection-matrices
.md
269_8
You can also use the ultra-lightweight PyTorch quantization library, [torchao](https://github.com/pytorch-labs/ao) (commit SHA `54bcd5a10d0abbe7b0c045052029257099f83fd9`), to apply [dynamic int8 quantization](https://pytorch.org/tutorials/recipes/recipes/dynamic_quantization.html) to the UNet and VAE. Quantization adds...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/fast_diffusion.md
https://huggingface.co/docs/diffusers/en/tutorials/fast_diffusion/#dynamic-quantization
#dynamic-quantization
.md
269_9
<!--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/tutorials/autopipeline.md
https://huggingface.co/docs/diffusers/en/tutorials/autopipeline/
.md
270_0
Diffusers provides many pipelines for basic tasks like generating images, videos, audio, and inpainting. On top of these, there are specialized pipelines for adapters and features like upscaling, super-resolution, and more. Different pipeline classes can even use the same checkpoint because they share the same pretrain...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/autopipeline.md
https://huggingface.co/docs/diffusers/en/tutorials/autopipeline/#autopipeline
#autopipeline
.md
270_1
The [AutoPipeline](../api/pipelines/auto_pipeline) supports [Stable Diffusion](../api/pipelines/stable_diffusion/overview), [Stable Diffusion XL](../api/pipelines/stable_diffusion/stable_diffusion_xl), [ControlNet](../api/pipelines/controlnet), [Kandinsky 2.1](../api/pipelines/kandinsky.md), [Kandinsky 2.2](../api/pipe...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/autopipeline.md
https://huggingface.co/docs/diffusers/en/tutorials/autopipeline/#unsupported-checkpoints
#unsupported-checkpoints
.md
270_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/tutorials/inference_with_big_models.md
https://huggingface.co/docs/diffusers/en/tutorials/inference_with_big_models/
.md
271_0
A modern diffusion model, like [Stable Diffusion XL (SDXL)](../using-diffusers/sdxl), is not just a single model, but a collection of multiple models. SDXL has four different model-level components: * A variational autoencoder (VAE) * Two text encoders * A UNet for denoising Usually, the text encoders and the denoi...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/inference_with_big_models.md
https://huggingface.co/docs/diffusers/en/tutorials/inference_with_big_models/#working-with-big-models
#working-with-big-models
.md
271_1
On distributed setups, you can run inference across multiple GPUs with Accelerate. > [!WARNING] > This feature is experimental and its APIs might change in the future. With Accelerate, you can use the `device_map` to determine how to distribute the models of a pipeline across multiple devices. This is useful in sit...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/inference_with_big_models.md
https://huggingface.co/docs/diffusers/en/tutorials/inference_with_big_models/#device-placement
#device-placement
.md
271_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/tutorials/using_peft_for_inference.md
https://huggingface.co/docs/diffusers/en/tutorials/using_peft_for_inference/
.md
272_0
There are many adapter types (with [LoRAs](https://huggingface.co/docs/peft/conceptual_guides/adapter#low-rank-adaptation-lora) being the most popular) trained in different styles to achieve different effects. You can even combine multiple adapters to create new and unique images. In this tutorial, you'll learn how t...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/using_peft_for_inference.md
https://huggingface.co/docs/diffusers/en/tutorials/using_peft_for_inference/#load-loras-for-inference
#load-loras-for-inference
.md
272_1
You can also merge different adapter checkpoints for inference to blend their styles together. Once again, use the [`~loaders.peft.PeftAdapterMixin.set_adapters`] method to activate the `pixel` and `toy` adapters and specify the weights for how they should be merged. ```python pipe.set_adapters(["pixel", "toy"], ad...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/using_peft_for_inference.md
https://huggingface.co/docs/diffusers/en/tutorials/using_peft_for_inference/#merge-adapters
#merge-adapters
.md
272_2
For even more customization, you can control how strongly the adapter affects each part of the pipeline. For this, pass a dictionary with the control strengths (called "scales") to [`~loaders.peft.PeftAdapterMixin.set_adapters`]. For example, here's how you can turn on the adapter for the `down` parts, but turn it of...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/using_peft_for_inference.md
https://huggingface.co/docs/diffusers/en/tutorials/using_peft_for_inference/#customize-adapters-strength
#customize-adapters-strength
.md
272_3
You have attached multiple adapters in this tutorial, and if you're feeling a bit lost on what adapters have been attached to the pipeline's components, use the [`~diffusers.loaders.StableDiffusionLoraLoaderMixin.get_active_adapters`] method to check the list of active adapters: ```py active_adapters = pipe.get_activ...
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/tutorials/using_peft_for_inference.md
https://huggingface.co/docs/diffusers/en/tutorials/using_peft_for_inference/#manage-adapters
#manage-adapters
.md
272_4