Skip to content

Commit 3ebdcff

Browse files
committed
add basic docs.
1 parent ea0126d commit 3ebdcff

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/source/en/using-diffusers/other-formats.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,50 @@ Benefits of using a single-file layout include:
240240
1. Easy compatibility with diffusion interfaces such as [ComfyUI](https://github.com/comfyanonymous/ComfyUI) or [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui) which commonly use a single-file layout.
241241
2. Easier to manage (download and share) a single file.
242242

243+
### DDUF
244+
245+
<Tip warning={true}>
246+
247+
DDUF is an experimental file format and APIs related to it can change in the future.
248+
249+
</Tip>
250+
251+
DDUF, aka (**D**DUF’s **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, and flexible way to package all parts of a diffusion model into a single, easy-to-manage file. It tries to provide a sweet spot between our multi-folder format and widely popular single-file format. To learn more about it, please check out the documentation [here](https://huggingface.co/docs/hub/dduf).
252+
253+
Below we show, how to load a DDUF checkpoint in a [`DiffusionPipeline`]:
254+
255+
```py
256+
from diffusers import DiffusionPipeline
257+
import torch
258+
259+
pipe = DiffusionPipeline.from_pretrained(
260+
"DDUF/FLUX.1-dev-DDUF", dduf_file="FLUX.1-dev.dduf", torch_dtype=torch.bfloat16
261+
).to("cuda")
262+
image = pipe(
263+
"photo a cat holding a sign that says Diffusers", num_inference_steps=50, guidance_scale=3.5
264+
).images[0]
265+
image.save("cat.png")
266+
```
267+
268+
To obtain `.dduf` checkpoint, we rely on `huggingface_hub`'s `export_folder_as_dduf()` utility, which takes care of all the necessary file-level validations:
269+
270+
```py
271+
from huggingface_hub import export_folder_as_dduf
272+
from diffusers import DiffusionPipeline
273+
import torch
274+
275+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
276+
277+
save_folder = "flux-dev"
278+
pipe.save_pretrained("flux-dev")
279+
export_folder_as_dduf("flux-dev.dduf", folder_path=save_folder)
280+
281+
<Tip>
282+
283+
We support packaging and loading quantized checkpoints in the DDUF format as long as they respect the multi-folder structure.
284+
285+
</Tip>
286+
243287
## Convert layout and files
244288

245289
Diffusers provides many scripts and methods to convert storage layouts and file formats to enable broader support across the diffusion ecosystem.

0 commit comments

Comments
 (0)