Skip to content

Commit b188ca5

Browse files
committed
hub image
1 parent dd8cb2b commit b188ca5

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

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

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,13 @@ pipeline = StableDiffusionPipeline.from_single_file(
7474

7575
[LoRAs](../tutorials/using_peft_for_inference) are lightweight checkpoints fine-tuned to generate images or video in a specific style. If you are using a checkpoint trained with a Diffusers training script, the LoRA configuration is automatically saved as metadata in a safetensors file. When the safetensors file is loaded, the metadata is parsed to correctly configure the LoRA and avoids missing or incorrect LoRA configurations.
7676

77-
```py
78-
import torch
79-
from diffusers import FluxPipeline
77+
The easiest way to inspect the metadata, if available, is by clicking on the Safetensors logo next to the weights.
8078

81-
pipeline = FluxPipeline.from_pretrained(
82-
"black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16
83-
).to("cuda")
84-
pipeline.load_lora_weights("linoyts/yarn_art_Flux_LoRA")
85-
86-
network_alphas, metadata = FluxPipeline.lora_state_dict(
87-
"linoyts/yarn_art_Flux_LoRA",
88-
return_lora_metadata=True
89-
)
90-
91-
print("LoRA metadata:")
92-
for key, value in metadata.items():
93-
print(f" {key}: {value}")
94-
```
79+
<div class="flex justify-center">
80+
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/safetensors_lora.png"/>
81+
</div>
9582

96-
For LoRAs that aren't trained with Diffusers, you can still inject the metadata as long as it is a safetensors file.
83+
For LoRAs that aren't trained with Diffusers, you can still save the metadata as long as it is a safetensors file.
9784

9885
```py
9986
import torch

0 commit comments

Comments
 (0)