File size: 1,063 Bytes
0e71da5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
license: apache-2.0
base_model: lambdalabs/miniSD-diffusers
tags:
- stable-diffusion
- lora
- diffusers
- concept-swap
---

# Giraffe-Zebra Concept Swap LoRA

This LoRA adapter swaps the concepts of giraffes and zebras in Stable Diffusion.

## Training Details
- Base Model: lambdalabs/miniSD-diffusers
- LoRA Rank: 64
- Training Epochs: 30
- Learning Rate: 0.0002

## Usage
```python
from diffusers import StableDiffusionPipeline
from peft import PeftModel
import torch

# Load base model
pipe = StableDiffusionPipeline.from_pretrained(
    "lambdalabs/miniSD-diffusers",
    torch_dtype=torch.float16
)

# Load LoRA weights
pipe.unet = PeftModel.from_pretrained(
    pipe.unet,
    "SurenaSa/IOAI2024_CV_Problem_V6_LoRA",
    is_trainable=False
)

pipe.to("cuda")

# Generate
prompt = "a photo of a giraffe"  # Will generate a zebra!
image = pipe(prompt, num_inference_steps=30, guidance_scale=7.5).images[0]
image.save("output.png")
```

## Examples
- Prompt: "a photo of a giraffe" → Generates zebra
- Prompt: "a photo of a zebra" → Generates giraffe