Views
No views yet
1pip install diffusers transformers accelerate peft bitsandbytes
2# For CUDA support
3pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu1181import torch
2from diffusers import FluxPipeline
3
4# Load the base model
5pipe = FluxPipeline.from_pretrained(
6 "black-forest-labs/FLUX.1-dev",
7 torch_dtype=torch.bfloat16
8)
9
10# Load and fuse the LoRA adapter
11pipe.load_lora_weights("soorya321/flux-lora-adapter")
12pipe.fuse_lora()
13
14# Enable memory efficient attention
15pipe.enable_model_cpu_offload()
16
17# Generate an image
18prompt = "a portrait of a woman in the style of alphonse mucha, art nouveau, ornate floral patterns, golden colors"
19image = pipe(
20 prompt,
21 height=1024,
22 width=768,
23 guidance_scale=7.5,
24 num_inference_steps=50,
25 max_sequence_length=512,
26 generator=torch.Generator("cpu").manual_seed(0)
27).images[0]
28
29image.save("mucha_style_portrait.png")1import torch
2from diffusers import FluxPipeline
3
4# Load with 8-bit quantization for lower memory usage
5pipe = FluxPipeline.from_pretrained(
6 "black-forest-labs/FLUX.1-dev",
7 torch_dtype=torch.bfloat16,
8 load_in_8bit=True, # Enable quantization
9 device_map="auto"
10)
11
12# Load LoRA adapter
13pipe.load_lora_weights("soorya321/flux-lora-adapter")
14pipe.fuse_lora()
15
16# Your generation code here...1from diffusers import FluxPipeline
2import torch
3
4# Load base model with specific configurations
5pipe = FluxPipeline.from_pretrained(
6 "black-forest-labs/FLUX.1-dev",
7 torch_dtype=torch.bfloat16,
8 device_map="auto"
9)
10
11# Load LoRA weights
12pipe.load_lora_weights("soorya321/flux-lora-adapter")
13
14# Generate image
15image = pipe(
16 "elegant woman in the style of alphonse mucha, art nouveau",
17 height=1024,
18 width=768,
19 num_inference_steps=28
20).images[0]| Hyperparameter | Value |
|---|---|
| Base Model | black-forest-labs/FLUX.1-dev |
| Learning Rate | 1e-4 |
| Batch Size | 1 |
| Gradient Accumulation | 4 |
| Max Train Steps | 1000 |
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.0 |
| Optimizer | AdamW |
| LR Scheduler | constant |
| Mixed Precision | bf16 |
| Quantization | 8-bit (bitsandbytes) |
| Target Modules | to_k, to_q, to_v, to_out.0 |
| Resolution | 512x512 |
| Validation | Every 250 steps |
| Seed | 42 |
"in the style of alphonse mucha" - The trained trigger phrase"art nouveau", "ornate", "decorative""golden colors", "warm tones", "muted pastels""portrait", "woman", "floral patterns", "elegant""a elegant woman in the style of alphonse mucha, art nouveau, intricate floral background, golden and warm tones"
"botanical illustration in the style of alphonse mucha, ornate borders, decorative patterns, vintage poster"
"portrait of a goddess in the style of alphonse mucha, flowing hair, art nouveau frame, muted colors"| Prompt | Style Elements |
|---|---|
| "woman in the style of alphonse mucha, flowing hair, ornate background" | Classic Art Nouveau female portrait |
| "botanical illustration in the style of alphonse mucha, decorative border" | Floral patterns with ornate framing |
| "goddess in the style of alphonse mucha, golden colors, art nouveau" | Ethereal figure with characteristic color palette |
1@misc{flux-lora-mucha-style,
2 title={FLUX.1-dev LoRA: Alphonse Mucha Artistic Style},
3 author={Soorya Sendil Nath},
4 year={2024},
5 howpublished={\url{https://huggingface.co/soorya321/flux-lora-adapter}},
6}