Skip to content

Commit 4eb4c84

Browse files
committed
cache allocator warmup for from_single_file
1 parent 493f850 commit 4eb4c84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ A single-file format stores *all* the model (UNet, transformer, text encoder) we
3737
- Greater compatibility with [ComfyUI](https://github.com/comfyanonymous/ComfyUI) or [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui).
3838
- Easier to download and share a single file.
3939

40-
Use [`~loaders.FromSingleFileMixin.from_single_file`] to load a single file.
40+
Use [`~loaders.FromSingleFileMixin.from_single_file`] to load a single file. Pass `"cuda"` to the `device_map` argument to pre-allocate GPU memory and reduce model loading time (refer to the [parallel loading](../using-diffusers/loading#parallel-loading) docs for more details).
4141

4242
```py
4343
import torch
@@ -46,6 +46,7 @@ from diffusers import StableDiffusionXLPipeline
4646
pipeline = StableDiffusionXLPipeline.from_single_file(
4747
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors",
4848
torch_dtype=torch.float16,
49+
device_map="cuda"
4950
)
5051
```
5152

@@ -62,6 +63,7 @@ pipeline = FluxPipeline.from_single_file(
6263
"black-forest-labs/FLUX.1-dev",
6364
transformer=transformer,
6465
torch_dtype=torch.bfloat16,
66+
device_map="cuda"
6567
)
6668
```
6769

0 commit comments

Comments
 (0)