Update README.md
Browse files
README.md
CHANGED
@@ -81,50 +81,41 @@ This LoRA enhances FLUX.1 [dev]'s ability to generate detailed autumn landsc
|
|
81 |
First, ensure you have FLUX.1 [dev] installed:
|
82 |
|
83 |
```python
|
|
|
84 |
pip install -U diffusers
|
85 |
-
Usage
|
86 |
-
Loading with Diffusers
|
87 |
-
Here's how to apply the LoRA to FLUX.1 [dev]:
|
88 |
|
|
|
89 |
import torch
|
90 |
from diffusers import FluxPipeline
|
91 |
|
92 |
# Load base model
|
93 |
-
pipe
|
94 |
pipe.enable_model_cpu_offload()
|
95 |
|
96 |
# Load and apply LoRA weights
|
97 |
-
pipe.load_lora_weights(
|
98 |
|
99 |
# Generate image
|
100 |
-
prompt
|
101 |
-
image
|
102 |
prompt,
|
103 |
-
height
|
104 |
-
width
|
105 |
-
guidance_scale
|
106 |
-
num_inference_steps
|
107 |
-
max_sequence_length
|
108 |
-
generator
|
109 |
).images[0]
|
110 |
-
image.save(
|
111 |
|
112 |
# Unload LoRA weights if needed
|
113 |
pipe.unload_lora_weights()
|
114 |
-
Merging LoRA (Optional)
|
115 |
-
To permanently merge the LoRA weights with the base model:
|
116 |
-
pythonCopyimport torch
|
117 |
-
from diffusers import FluxPipeline
|
118 |
-
|
119 |
-
# Load base model
|
120 |
-
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
121 |
|
122 |
-
#
|
123 |
-
pipe.
|
|
|
124 |
pipe.merge_lora_weights()
|
125 |
-
|
126 |
-
# Save merged model
|
127 |
-
pipe.save_pretrained("seasonal-lands-merged")
|
128 |
```
|
129 |
|
130 |
# Trigger Word
|
|
|
81 |
First, ensure you have FLUX.1 [dev] installed:
|
82 |
|
83 |
```python
|
84 |
+
# Install
|
85 |
pip install -U diffusers
|
|
|
|
|
|
|
86 |
|
87 |
+
# Loading with Diffusers
|
88 |
import torch
|
89 |
from diffusers import FluxPipeline
|
90 |
|
91 |
# Load base model
|
92 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
93 |
pipe.enable_model_cpu_offload()
|
94 |
|
95 |
# Load and apply LoRA weights
|
96 |
+
pipe.load_lora_weights("Borcherding/seasonalLandsFluxDev-lora")
|
97 |
|
98 |
# Generate image
|
99 |
+
prompt = "autumnProxy A majestic maple tree with vibrant red and orange leaves, golden afternoon light"
|
100 |
+
image = pipe(
|
101 |
prompt,
|
102 |
+
height=1024,
|
103 |
+
width=1024,
|
104 |
+
guidance_scale=3.5,
|
105 |
+
num_inference_steps=50,
|
106 |
+
max_sequence_length=512,
|
107 |
+
generator=torch.Generator("cpu").manual_seed(0)
|
108 |
).images[0]
|
109 |
+
image.save("autumn-scene.png")
|
110 |
|
111 |
# Unload LoRA weights if needed
|
112 |
pipe.unload_lora_weights()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
# Optional: Merge LoRA weights permanently
|
115 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
116 |
+
pipe.load_lora_weights("Borcherding/SeasonalLandsFluxDev-lora")
|
117 |
pipe.merge_lora_weights()
|
118 |
+
pipe.save_pretrained("seasonal-lands-merged")
|
|
|
|
|
119 |
```
|
120 |
|
121 |
# Trigger Word
|