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 |
|---|---|---|---|---|---|
For identity-preserving text-to-video, pass a text prompt and an image contain clear face (e.g., preferably half-body or full-body). By default, ConsisID generates a 720x480 video for the best results.
```python
from diffusers.utils import export_to_video
prompt = "The video captures a boy walking along a city stree... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/consisid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/consisid/#identity-preserving-text-to-video | #identity-preserving-text-to-video | .md | 69_3 |
Learn more about ConsisID with the following resources.
- A [video](https://www.youtube.com/watch?v=PhlgC-bI5SQ) demonstrating ConsisID's main features.
- The research paper, [Identity-Preserving Text-to-Video Generation by Frequency Decomposition](https://hf.co/papers/2411.17440) for more details. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/consisid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/consisid/#resources | #resources | .md | 69_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/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/ | .md | 70_0 | |
[[open-in-colab]]
🤗 Diffusers provides a [`~diffusers.utils.PushToHubMixin`] for uploading your model, scheduler, or pipeline to the Hub. It is an easy way to store your files on the Hub, and also allows you to share your work with others. Under the hood, the [`~diffusers.utils.PushToHubMixin`]:
1. creates a repos... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/#push-files-to-the-hub | #push-files-to-the-hub | .md | 70_1 |
To push a model to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the model to be stored on the Hub:
```py
from diffusers import ControlNetModel
controlnet = ControlNetModel(
block_out_channels=(32, 64),
layers_per_block=2,
in_channels=4,
down_block_types=("DownBlock2D... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/#models | #models | .md | 70_2 |
To push a scheduler to the Hub, call [`~diffusers.utils.PushToHubMixin.push_to_hub`] and specify the repository id of the scheduler to be stored on the Hub:
```py
from diffusers import DDIMScheduler
scheduler = DDIMScheduler(
beta_start=0.00085,
beta_end=0.012,
beta_schedule="scaled_linear",
clip_sample=False,
set_a... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/#scheduler | #scheduler | .md | 70_3 |
You can also push an entire pipeline with all it's components to the Hub. For example, initialize the components of a [`StableDiffusionPipeline`] with the parameters you want:
```py
from diffusers import (
UNet2DConditionModel,
AutoencoderKL,
DDIMScheduler,
StableDiffusionPipeline,
)
from transformers import CLIPText... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/#pipeline | #pipeline | .md | 70_4 |
Set `private=True` in the [`~diffusers.utils.PushToHubMixin.push_to_hub`] function to keep your model, scheduler, or pipeline files private:
```py
controlnet.push_to_hub("my-controlnet-model-private", private=True)
```
Private repositories are only visible to you, and other users won't be able to clone the reposito... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/push_to_hub.md | https://huggingface.co/docs/diffusers/en/using-diffusers/push_to_hub/#privacy | #privacy | .md | 70_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/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/ | .md | 71_0 | |
[[open-in-colab]] | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#load-community-pipelines-and-components | #load-community-pipelines-and-components | .md | 71_1 |
> [!TIP] Take a look at GitHub Issue [#841](https://github.com/huggingface/diffusers/issues/841) for more context about why we're adding community pipelines to help everyone easily share their work without being slowed down.
Community pipelines are any [`DiffusionPipeline`] class that are different from the original ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#community-pipelines | #community-pipelines | .md | 71_2 |
Community pipelines can also be loaded from a local file if you pass a file path instead. The path to the passed directory must contain a pipeline.py file that contains the pipeline class.
```py
pipeline = DiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5",
custom_pipeline="./path/to/pip... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#load-from-a-local-file | #load-from-a-local-file | .md | 71_3 |
By default, community pipelines are loaded from the latest stable version of Diffusers. To load a community pipeline from another version, use the `custom_revision` parameter.
<hfoptions id="version">
<hfoption id="main">
For example, to load from the main branch:
```py
pipeline = DiffusionPipeline.from_pretraine... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#load-from-a-specific-version | #load-from-a-specific-version | .md | 71_4 |
Community pipelines can also be loaded with the [`~DiffusionPipeline.from_pipe`] method which allows you to load and reuse multiple pipelines without any additional memory overhead (learn more in the [Reuse a pipeline](./loading#reuse-a-pipeline) guide). The memory requirement is determined by the largest single pipeli... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#load-with-frompipe | #load-with-frompipe | .md | 71_5 |
Community pipelines are a really fun and creative way to extend the capabilities of the original pipeline with new and unique features. You can find all community pipelines in the [diffusers/examples/community](https://github.com/huggingface/diffusers/tree/main/examples/community) folder with inference and training exa... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#example-community-pipelines | #example-community-pipelines | .md | 71_6 |
Community components allow users to build pipelines that may have customized components that are not a part of Diffusers. If your pipeline has custom components that Diffusers doesn't already support, you need to provide their implementations as Python modules. These customized components could be a VAE, UNet, and sche... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/custom_pipeline_overview.md | https://huggingface.co/docs/diffusers/en/using-diffusers/custom_pipeline_overview/#community-components | #community-components | .md | 71_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/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/ | .md | 72_0 | |
The denoising loop of a pipeline can be modified with custom defined functions using the `callback_on_step_end` parameter. The callback function is executed at the end of each step, and modifies the pipeline attributes and variables for the next step. This is really useful for *dynamically* adjusting certain pipeline a... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/#pipeline-callbacks | #pipeline-callbacks | .md | 72_1 |
We provide a list of callbacks you can plug into an existing pipeline and modify the denoising loop. This is the current list of official callbacks:
- `SDCFGCutoffCallback`: Disables the CFG after a certain number of steps for all SD 1.5 pipelines, including text-to-image, image-to-image, inpaint, and controlnet.
- `... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/#official-callbacks | #official-callbacks | .md | 72_2 |
Dynamic classifier-free guidance (CFG) is a feature that allows you to disable CFG after a certain number of inference steps which can help you save compute with minimal cost to performance. The callback function for this should have the following arguments:
- `pipeline` (or the pipeline instance) provides access to ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/#dynamic-classifier-free-guidance | #dynamic-classifier-free-guidance | .md | 72_3 |
> [!TIP]
> The interruption callback is supported for text-to-image, image-to-image, and inpainting for the [StableDiffusionPipeline](../api/pipelines/stable_diffusion/overview) and [StableDiffusionXLPipeline](../api/pipelines/stable_diffusion/stable_diffusion_xl).
Stopping the diffusion process early is useful when ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/#interrupt-the-diffusion-process | #interrupt-the-diffusion-process | .md | 72_4 |
> [!TIP]
> This tip was contributed by [asomoza](https://github.com/asomoza).
Display an image after each generation step by accessing and converting the latents after each step into an image. The latent space is compressed to 128x128, so the images are also 128x128 which is useful for a quick preview.
1. Use the f... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/callback.md | https://huggingface.co/docs/diffusers/en/using-diffusers/callback/#display-image-after-each-generation-step | #display-image-after-each-generation-step | .md | 72_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/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/ | .md | 73_0 | |
[[open-in-colab]]
Diffusion systems consist of multiple components like parameterized models and schedulers that interact in complex ways. That is why we designed the [`DiffusionPipeline`] to wrap the complexity of the entire diffusion system into an easy-to-use API. At the same time, the [`DiffusionPipeline`] is ent... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#load-pipelines | #load-pipelines | .md | 73_1 |
> [!TIP]
> Skip to the [DiffusionPipeline explained](#diffusionpipeline-explained) section if you're interested in an explanation about how the [`DiffusionPipeline`] class works.
There are two ways to load a pipeline for a task:
1. Load the generic [`DiffusionPipeline`] class and allow it to automatically detect th... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#load-a-pipeline | #load-a-pipeline | .md | 73_2 |
To load a pipeline locally, use [git-lfs](https://git-lfs.github.com/) to manually download a checkpoint to your local disk.
```bash
git-lfs install
git clone https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5
```
This creates a local folder, ./stable-diffusion-v1-5, on your disk and you should pass... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#local-pipeline | #local-pipeline | .md | 73_3 |
You can customize a pipeline by loading different components into it. This is important because you can:
- change to a scheduler with faster generation speed or higher generation quality depending on your needs (call the `scheduler.compatibles` method on your pipeline to see compatible schedulers)
- change a default ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#customize-a-pipeline | #customize-a-pipeline | .md | 73_4 |
When you load multiple pipelines that share the same model components, it makes sense to reuse the shared components instead of reloading everything into memory again, especially if your hardware is memory-constrained. For example:
1. You generated an image with the [`StableDiffusionPipeline`] but you want to improve... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#reuse-a-pipeline | #reuse-a-pipeline | .md | 73_5 |
Pipelines loaded with [`~DiffusionPipeline.from_pipe`] can be customized with different model components or methods. However, whenever you modify the *state* of the model components, it affects all the other pipelines that share the same components. For example, if you call [`~diffusers.loaders.IPAdapterMixin.unload_ip... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#modify-frompipe-components | #modify-frompipe-components | .md | 73_6 |
The memory requirement of loading multiple pipelines with [`~DiffusionPipeline.from_pipe`] is determined by the pipeline with the highest memory-usage regardless of the number of pipelines you create.
| Pipeline | Memory usage (GB) |
|---|---|
| StableDiffusionPipeline | 4.400 |
| StableDiffusionSAGPipeline | 4.400 |... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#memory-usage-of-frompipe | #memory-usage-of-frompipe | .md | 73_7 |
Diffusers implements a [safety checker](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py) for Stable Diffusion models which can generate harmful content. The safety checker screens the generated output against known hardcoded not-safe-for-work (NSFW) content.... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#safety-checker | #safety-checker | .md | 73_8 |
A checkpoint variant is usually a checkpoint whose weights are:
- Stored in a different floating point type, such as [torch.float16](https://pytorch.org/docs/stable/tensors.html#data-types), because it only requires half the bandwidth and storage to download. You can't use this variant if you're continuing training o... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#checkpoint-variants | #checkpoint-variants | .md | 73_9 |
As a class method, [`DiffusionPipeline.from_pretrained`] is responsible for two things:
- Download the latest version of the folder structure required for inference and cache it. If the latest folder structure is available in the local cache, [`DiffusionPipeline.from_pretrained`] reuses the cache and won't redownload... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/loading.md | https://huggingface.co/docs/diffusers/en/using-diffusers/loading/#diffusionpipeline-explained | #diffusionpipeline-explained | .md | 73_10 |
<!--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/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/ | .md | 74_0 | |
Video generation models include a temporal dimension to bring images, or frames, together to create a video. These models are trained on large-scale datasets of high-quality text-video pairs to learn how to combine the modalities to ensure the generated video is coherent and realistic.
[Explore](https://huggingface.c... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#video-generation | #video-generation | .md | 74_1 |
There are a few important parameters you can configure in the pipeline that'll affect the video generation process and quality. Let's take a closer look at what these parameters do and how changing them affects the output. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#configure-model-parameters | #configure-model-parameters | .md | 74_2 |
The `num_frames` parameter determines how many video frames are generated per second. A frame is an image that is played in a sequence of other frames to create motion or a video. This affects video length because the pipeline generates a certain number of frames per second (check a pipeline's API reference for the def... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#number-of-frames | #number-of-frames | .md | 74_3 |
The `guidance_scale` parameter controls how closely aligned the generated video and text prompt or initial image is. A higher `guidance_scale` value means your generated video is more aligned with the text prompt or initial image, while a lower `guidance_scale` value means your generated video is less aligned which cou... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#guidance-scale | #guidance-scale | .md | 74_4 |
A negative prompt deters the model from generating things you don’t want it to. This parameter is commonly used to improve overall generation quality by removing poor or bad features such as “low resolution” or “bad details”.
```py
import torch
from diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter
f... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#negative-prompt | #negative-prompt | .md | 74_5 |
There are some pipeline parameters that are unique to each model such as adjusting the motion in a video or adding noise to the initial image.
<hfoptions id="special-parameters">
<hfoption id="Stable Video Diffusion">
Stable Video Diffusion provides additional micro-conditioning for the frame rate with the `fps` pa... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#model-specific-parameters | #model-specific-parameters | .md | 74_6 |
Video generation can be controlled similar to how text-to-image, image-to-image, and inpainting can be controlled with a [`ControlNetModel`]. The only difference is you need to use the [`~pipelines.text_to_video_synthesis.pipeline_text_to_video_zero.CrossFrameAttnProcessor`] so each frame attends to the first frame. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#control-video-generation | #control-video-generation | .md | 74_7 |
Text2Video-Zero video generation can be conditioned on pose and edge images for even greater control over a subject's motion in the generated video or to preserve the identity of a subject/object in the video. You can also use Text2Video-Zero with [InstructPix2Pix](../api/pipelines/pix2pix) for editing videos with text... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#text2video-zero | #text2video-zero | .md | 74_8 |
Video generation requires a lot of memory because you're generating many video frames at once. You can reduce your memory requirements at the expense of some inference speed. Try:
1. offloading pipeline components that are no longer needed to the CPU
2. feed-forward chunking runs the feed-forward layer in a loop inst... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#optimize | #optimize | .md | 74_9 |
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) to learn more about supported quantizati... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/text-img2vid.md | https://huggingface.co/docs/diffusers/en/using-diffusers/text-img2vid/#quantization | #quantization | .md | 74_10 |
<!--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/using-diffusers/t2i_adapter.md | https://huggingface.co/docs/diffusers/en/using-diffusers/t2i_adapter/ | .md | 75_0 | |
[T2I-Adapter](https://hf.co/papers/2302.08453) is a lightweight adapter for controlling and providing more accurate
structure guidance for text-to-image models. It works by learning an alignment between the internal knowledge of the
text-to-image model and an external control signal, such as edge detection or depth est... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/t2i_adapter.md | https://huggingface.co/docs/diffusers/en/using-diffusers/t2i_adapter/#t2i-adapter | #t2i-adapter | .md | 75_1 |
Text-to-image models rely on a prompt to generate an image, but sometimes, text alone may not be enough to provide more
accurate structural guidance. T2I-Adapter allows you to provide an additional control image to guide the generation
process. For example, you can provide a canny image (a white outline of an image on ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/t2i_adapter.md | https://huggingface.co/docs/diffusers/en/using-diffusers/t2i_adapter/#text-to-image | #text-to-image | .md | 75_2 |
T2I-Adapters are also composable, allowing you to use more than one adapter to impose multiple control conditions on an
image. For example, you can use a pose map to provide structural control and a depth map for depth control. This is
enabled by the [`MultiAdapter`] class.
Let's condition a text-to-image model with ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/t2i_adapter.md | https://huggingface.co/docs/diffusers/en/using-diffusers/t2i_adapter/#multiadapter | #multiadapter | .md | 75_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/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/ | .md | 76_0 | |
[[open-in-colab]]
Inpainting replaces or edits specific areas of an image. This makes it a useful tool for image restoration like removing defects and artifacts, or even replacing an image area with something entirely new. Inpainting relies on a mask to determine which regions of an image to fill in; the area to inpa... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#inpainting | #inpainting | .md | 76_1 |
Throughout this guide, the mask image is provided in all of the code examples for convenience. You can inpaint on your own images, but you'll need to create a mask image for it. Use the Space below to easily create a mask image.
Upload a base image to inpaint on and use the sketch tool to draw a mask. Once you're don... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#create-a-mask-image | #create-a-mask-image | .md | 76_2 |
The [`~VaeImageProcessor.blur`] method provides an option for how to blend the original image and inpaint area. The amount of blur is determined by the `blur_factor` parameter. Increasing the `blur_factor` increases the amount of blur applied to the mask edges, softening the transition between the original image and in... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#mask-blur | #mask-blur | .md | 76_3 |
[Stable Diffusion Inpainting](https://huggingface.co/runwayml/stable-diffusion-inpainting), [Stable Diffusion XL (SDXL) Inpainting](https://huggingface.co/diffusers/stable-diffusion-xl-1.0-inpainting-0.1), and [Kandinsky 2.2 Inpainting](https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder-inpaint) are among... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#popular-models | #popular-models | .md | 76_4 |
Stable Diffusion Inpainting is a latent diffusion model finetuned on 512x512 images on inpainting. It is a good starting point because it is relatively fast and generates good quality images. To use this model for inpainting, you'll need to pass a prompt, base and mask image to the pipeline:
```py
import torch
from d... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#stable-diffusion-inpainting | #stable-diffusion-inpainting | .md | 76_5 |
SDXL is a larger and more powerful version of Stable Diffusion v1.5. This model can follow a two-stage model process (though each model can also be used alone); the base model generates an image, and a refiner model takes that image and further enhances its details and quality. Take a look at the [SDXL](sdxl) guide for... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#stable-diffusion-xl-sdxl-inpainting | #stable-diffusion-xl-sdxl-inpainting | .md | 76_6 |
The Kandinsky model family is similar to SDXL because it uses two models as well; the image prior model creates image embeddings, and the diffusion model generates images from them. You can load the image prior and diffusion model separately, but the easiest way to use Kandinsky 2.2 is to load it into the [`AutoPipelin... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#kandinsky-22-inpainting | #kandinsky-22-inpainting | .md | 76_7 |
So far, this guide has used inpaint specific checkpoints such as [stable-diffusion-v1-5/stable-diffusion-inpainting](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-inpainting). But you can also use regular checkpoints like [stable-diffusion-v1-5/stable-diffusion-v1-5](https://huggingface.co/stable-diffus... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#non-inpaint-specific-checkpoints | #non-inpaint-specific-checkpoints | .md | 76_8 |
Image features - like quality and "creativity" - are dependent on pipeline parameters. Knowing what these parameters do is important for getting the results you want. Let's take a look at the most important parameters and see how changing them affects the output. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#configure-pipeline-parameters | #configure-pipeline-parameters | .md | 76_9 |
`strength` is a measure of how much noise is added to the base image, which influences how similar the output is to the base image.
* 📈 a high `strength` value means more noise is added to an image and the denoising process takes longer, but you'll get higher quality images that are more different from the base imag... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#strength | #strength | .md | 76_10 |
`guidance_scale` affects how aligned the text prompt and generated image are.
* 📈 a high `guidance_scale` value means the prompt and generated image are closely aligned, so the output is a stricter interpretation of the prompt
* 📉 a low `guidance_scale` value means the prompt and generated image are more loosely al... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#guidance-scale | #guidance-scale | .md | 76_11 |
A negative prompt assumes the opposite role of a prompt; it guides the model away from generating certain things in an image. This is useful for quickly improving image quality and preventing the model from generating things you don't want.
```py
import torch
from diffusers import AutoPipelineForInpainting
from diffu... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#negative-prompt | #negative-prompt | .md | 76_12 |
A method for increasing the inpainting image quality is to use the [`padding_mask_crop`](https://huggingface.co/docs/diffusers/v0.25.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.__call__.padding_mask_crop) parameter. When enabled, this option crops the masked area with some user-... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#padding-mask-crop | #padding-mask-crop | .md | 76_13 |
[`AutoPipelineForInpainting`] can be chained with other 🤗 Diffusers pipelines to edit their outputs. This is often useful for improving the output quality from your other diffusion pipelines, and if you're using multiple pipelines, it can be more memory-efficient to chain them together to keep the outputs in latent sp... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#chained-inpainting-pipelines | #chained-inpainting-pipelines | .md | 76_14 |
Chaining a text-to-image and inpainting pipeline allows you to inpaint the generated image, and you don't have to provide a base image to begin with. This makes it convenient to edit your favorite text-to-image outputs without having to generate an entirely new image.
Start with the text-to-image pipeline to create a... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#text-to-image-to-inpaint | #text-to-image-to-inpaint | .md | 76_15 |
You can also chain an inpainting pipeline before another pipeline like image-to-image or an upscaler to improve the quality.
Begin by inpainting an image:
```py
import torch
from diffusers import AutoPipelineForInpainting, AutoPipelineForImage2Image
from diffusers.utils import load_image, make_image_grid
pipeline ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#inpaint-to-image-to-image | #inpaint-to-image-to-image | .md | 76_16 |
Getting an image to look exactly the way you want is challenging because the denoising process is random. While you can control certain aspects of generation by configuring parameters like `negative_prompt`, there are better and more efficient methods for controlling image generation. | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#control-image-generation | #control-image-generation | .md | 76_17 |
Prompt weighting provides a quantifiable way to scale the representation of concepts in a prompt. You can use it to increase or decrease the magnitude of the text embedding vector for each concept in the prompt, which subsequently determines how much of each concept is generated. The [Compel](https://github.com/damian0... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#prompt-weighting | #prompt-weighting | .md | 76_18 |
ControlNet models are used with other diffusion models like Stable Diffusion, and they provide an even more flexible and accurate way to control how an image is generated. A ControlNet accepts an additional conditioning image input that guides the diffusion model to preserve the features in it.
For example, let's con... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#controlnet | #controlnet | .md | 76_19 |
It can be difficult and slow to run diffusion models if you're resource constrained, but it doesn't have to be with a few optimization tricks. One of the biggest (and easiest) optimizations you can enable is switching to memory-efficient attention. If you're using PyTorch 2.0, [scaled-dot product attention](../optimiza... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/inpaint.md | https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint/#optimize | #optimize | .md | 76_20 |
<!--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/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/ | .md | 77_0 | |
[Perturbed-Attention Guidance (PAG)](https://ku-cvlab.github.io/Perturbed-Attention-Guidance/) is a new diffusion sampling guidance that improves sample quality across both unconditional and conditional settings, achieving this without requiring further training or the integration of external modules. PAG is designed t... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/#perturbed-attention-guidance | #perturbed-attention-guidance | .md | 77_1 |
You can apply PAG to the [`StableDiffusionXLPipeline`] for tasks such as text-to-image, image-to-image, and inpainting. To enable PAG for a specific task, load the pipeline using the [AutoPipeline](../api/pipelines/auto_pipeline) API with the `enable_pag=True` flag and the `pag_applied_layers` argument.
> [!TIP]
> 🤗... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/#general-tasks | #general-tasks | .md | 77_2 |
To use PAG with ControlNet, first create a `controlnet`. Then, pass the `controlnet` and other PAG arguments to the `from_pretrained` method of the AutoPipeline for the specified task.
```py
from diffusers import AutoPipelineForText2Image, ControlNetModel
import torch
controlnet = ControlNetModel.from_pretrained(
"d... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/#pag-with-controlnet | #pag-with-controlnet | .md | 77_3 |
[IP-Adapter](https://hf.co/papers/2308.06721) is a popular model that can be plugged into diffusion models to enable image prompting without any changes to the underlying model. You can enable PAG on a pipeline with IP-Adapter loaded.
```py
from diffusers import AutoPipelineForText2Image
from diffusers.utils import l... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/#pag-with-ip-adapter | #pag-with-ip-adapter | .md | 77_4 |
The `pag_applied_layers` argument allows you to specify which layers PAG is applied to. By default, it applies only to the mid blocks. Changing this setting will significantly impact the output. You can use the `set_pag_applied_layers` method to adjust the PAG layers after the pipeline is created, helping you find the ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/pag.md | https://huggingface.co/docs/diffusers/en/using-diffusers/pag/#pagappliedlayers | #pagappliedlayers | .md | 77_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/using-diffusers/depth2img.md | https://huggingface.co/docs/diffusers/en/using-diffusers/depth2img/ | .md | 78_0 | |
[[open-in-colab]]
The [`StableDiffusionDepth2ImgPipeline`] lets you pass a text prompt and an initial image to condition the generation of new images. In addition, you can also pass a `depth_map` to preserve the image structure. If no `depth_map` is provided, the pipeline automatically predicts the depth via an integ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/depth2img.md | https://huggingface.co/docs/diffusers/en/using-diffusers/depth2img/#text-guided-depth-to-image-generation | #text-guided-depth-to-image-generation | .md | 78_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/using-diffusers/cogvideox.md | https://huggingface.co/docs/diffusers/en/using-diffusers/cogvideox/ | .md | 79_0 | |
CogVideoX is a text-to-video generation model focused on creating more coherent videos aligned with a prompt. It achieves this using several methods.
- a 3D variational autoencoder that compresses videos spatially and temporally, improving compression rate and video accuracy.
- an expert transformer block to help a... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/cogvideox.md | https://huggingface.co/docs/diffusers/en/using-diffusers/cogvideox/#cogvideox | #cogvideox | .md | 79_1 |
Model weights may be stored in separate subfolders on the Hub or locally, in which case, you should use the [`~DiffusionPipeline.from_pretrained`] method.
```py
from diffusers import CogVideoXPipeline, CogVideoXImageToVideoPipeline
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-2b",
torch_dtype=torch.floa... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/cogvideox.md | https://huggingface.co/docs/diffusers/en/using-diffusers/cogvideox/#load-model-checkpoints | #load-model-checkpoints | .md | 79_2 |
For text-to-video, pass a text prompt. By default, CogVideoX generates a 720x480 video for the best results.
```py
import torch
from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
prompt = "An elderly gentleman, with a serene expression, sits at the water's edge, a steaming cup of tea... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/cogvideox.md | https://huggingface.co/docs/diffusers/en/using-diffusers/cogvideox/#text-to-video | #text-to-video | .md | 79_3 |
You'll use the [THUDM/CogVideoX-5b-I2V](https://huggingface.co/THUDM/CogVideoX-5b-I2V) checkpoint for this guide.
```py
import torch
from diffusers import CogVideoXImageToVideoPipeline
from diffusers.utils import export_to_video, load_image
prompt = "A vast, shimmering ocean flows gracefully under a twilight sky, i... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/cogvideox.md | https://huggingface.co/docs/diffusers/en/using-diffusers/cogvideox/#image-to-video | #image-to-video | .md | 79_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/using-diffusers/image_quality.md | https://huggingface.co/docs/diffusers/en/using-diffusers/image_quality/ | .md | 80_0 | |
The components of a diffusion model, like the UNet and scheduler, can be optimized to improve the quality of generated images leading to better details. These techniques are especially useful if you don't have the resources to simply use a larger model for inference. You can enable these techniques during inference wit... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/image_quality.md | https://huggingface.co/docs/diffusers/en/using-diffusers/image_quality/#controlling-image-quality | #controlling-image-quality | .md | 80_1 |
[FreeU](https://hf.co/papers/2309.11497) improves image details by rebalancing the UNet's backbone and skip connection weights. The skip connections can cause the model to overlook some of the backbone semantics which may lead to unnatural image details in the generated image. This technique does not require any additi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/image_quality.md | https://huggingface.co/docs/diffusers/en/using-diffusers/image_quality/#details | #details | .md | 80_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/using-diffusers/svd.md | https://huggingface.co/docs/diffusers/en/using-diffusers/svd/ | .md | 81_0 | |
[[open-in-colab]]
[Stable Video Diffusion (SVD)](https://huggingface.co/papers/2311.15127) is a powerful image-to-video generation model that can generate 2-4 second high resolution (576x1024) videos conditioned on an input image.
This guide will show you how to use SVD to generate short videos from images.
Befor... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/svd.md | https://huggingface.co/docs/diffusers/en/using-diffusers/svd/#stable-video-diffusion | #stable-video-diffusion | .md | 81_1 |
You can gain a 20-25% speedup at the expense of slightly increased memory by [compiling](../optimization/torch2.0#torchcompile) the UNet.
```diff
- pipe.enable_model_cpu_offload()
+ pipe.to("cuda")
+ pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
``` | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/svd.md | https://huggingface.co/docs/diffusers/en/using-diffusers/svd/#torchcompile | #torchcompile | .md | 81_2 |
Video generation is very memory intensive because you're essentially generating `num_frames` all at once, similar to text-to-image generation with a high batch size. To reduce the memory requirement, there are multiple options that trade-off inference speed for lower memory requirement:
- enable model offloading: eac... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/svd.md | https://huggingface.co/docs/diffusers/en/using-diffusers/svd/#reduce-memory-usage | #reduce-memory-usage | .md | 81_3 |
Stable Diffusion Video also accepts micro-conditioning, in addition to the conditioning image, which allows more control over the generated video:
- `fps`: the frames per second of the generated video.
- `motion_bucket_id`: the motion bucket id to use for the generated video. This can be used to control the motion of... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/svd.md | https://huggingface.co/docs/diffusers/en/using-diffusers/svd/#micro-conditioning | #micro-conditioning | .md | 81_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/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/ | .md | 82_0 | |
[[open-in-colab]]
Diffusion models are saved in various file types and organized in different layouts. Diffusers stores model weights as safetensors files in *Diffusers-multifolder* layout and it also supports loading files (like safetensors and ckpt files) from a *single-file* layout which is commonly used in the di... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#model-files-and-layouts | #model-files-and-layouts | .md | 82_1 |
PyTorch model weights are typically saved with Python's [pickle](https://docs.python.org/3/library/pickle.html) utility as ckpt or bin files. However, pickle is not secure and pickled files may contain malicious code that can be executed. This vulnerability is a serious concern given the popularity of model sharing. To... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#files | #files | .md | 82_2 |
> [!TIP]
> Learn more about the design decisions and why safetensor files are preferred for saving and loading model weights in the [Safetensors audited as really safe and becoming the default](https://blog.eleuther.ai/safetensors-security-audit/) blog post.
[Safetensors](https://hf.co/docs/safetensors) is a safe and... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#safetensors | #safetensors | .md | 82_3 |
[LoRA](https://hf.co/docs/peft/conceptual_guides/adapter#low-rank-adaptation-lora) is a lightweight adapter that is fast and easy to train, making them especially popular for generating images in a certain way or style. These adapters are commonly stored in a safetensors file, and are widely popular on model sharing pl... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#lora-files | #lora-files | .md | 82_4 |
> [!WARNING]
> Pickled files may be unsafe because they can be exploited to execute malicious code. It is recommended to use safetensors files instead where possible, or convert the weights to safetensors files.
PyTorch's [torch.save](https://pytorch.org/docs/stable/generated/torch.save.html) function uses Python's [... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#ckpt | #ckpt | .md | 82_5 |
There are two ways model files are organized, either in a Diffusers-multifolder layout or in a single-file layout. The Diffusers-multifolder layout is the default, and each component file (text encoder, UNet, VAE) is stored in a separate subfolder. Diffusers also supports loading models from a single-file layout where ... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#storage-layout | #storage-layout | .md | 82_6 |
The Diffusers-multifolder layout is the default storage layout for Diffusers. Each component's (text encoder, UNet, VAE) weights are stored in a separate subfolder. The weights can be stored as safetensors or ckpt files.
<div class="flex flex-row gap-4">
<div class="flex-1">
<img class="rounded-xl" src="https://huggi... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#diffusers-multifolder | #diffusers-multifolder | .md | 82_7 |
The single-file layout stores all the model weights in a single file. All the model components (text encoder, UNet, VAE) weights are kept together instead of separately in subfolders. This can be a safetensors or ckpt file.
<div class="flex justify-center">
<img src="https://huggingface.co/datasets/huggingface/docume... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#single-file | #single-file | .md | 82_8 |
> [!WARNING]
> DDUF is an experimental file format and APIs related to it can change in the future.
DDUF (**D**DUF **D**iffusion **U**nified **F**ormat) is a file format designed to make storing, distributing, and using diffusion models much easier. Built on the ZIP file format, DDUF offers a standardized, efficient,... | /Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/using-diffusers/other-formats.md | https://huggingface.co/docs/diffusers/en/using-diffusers/other-formats/#dduf | #dduf | .md | 82_9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.