|
|
--- |
|
|
tags: |
|
|
- text-to-image |
|
|
- lora |
|
|
- diffusers |
|
|
- template:diffusion-lora |
|
|
widget: |
|
|
- output: |
|
|
url: images/Screenshot from 2025-12-04 09-36-18.png |
|
|
text: platypus |
|
|
base_model: stable-diffusion-v1-5/stable-diffusion-v1-5 |
|
|
instance_prompt: platypus |
|
|
license: mit |
|
|
language: |
|
|
- en |
|
|
pipeline_tag: text-to-image |
|
|
library_name: diffusers |
|
|
--- |
|
|
# LoRA_platypus |
|
|
|
|
|
<Gallery /> |
|
|
|
|
|
|
|
|
## Trigger words |
|
|
|
|
|
You should use `platypus` to trigger the image generation. |
|
|
|
|
|
|
|
|
## Download model |
|
|
|
|
|
|
|
|
[Download](/Mohan-diffuser/lora_platypus_sd_15/tree/main) them in the Files & versions tab. |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from diffusers import DiffusionPipeline,DDIMScheduler |
|
|
import matplotlib.pyplot as plt |
|
|
|
|
|
# switch to "mps" for apple devices |
|
|
pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", dtype=torch.bfloat16, device_map="cuda") |
|
|
pipeline.load_lora_weights("Mohan-diffuser/lora_platypus_sd_15") |
|
|
|
|
|
pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config) |
|
|
|
|
|
prompt = "platypus" |
|
|
image = pipeline(prompt).images[0] |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Varying The LoRA Scale |
|
|
```python |
|
|
gen_images=[] |
|
|
lora_scales = [0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4] |
|
|
for lora_scale in lora_scales: |
|
|
gen_image = pipeline( |
|
|
prompt="platypus", |
|
|
guidance_scale=7.5, |
|
|
num_inference_steps=25, |
|
|
height=512, |
|
|
width=512, |
|
|
cross_attention_kwargs={"scale": lora_scale}, |
|
|
generator=torch.manual_seed(0) |
|
|
).images[0] |
|
|
|
|
|
gen_images.append(gen_image) |
|
|
|
|
|
|
|
|
fig,axes = plt.subplots(1,8,figsize=(20,10)) |
|
|
for i,ax in enumerate(axes): |
|
|
ax.imshow(gen_images[i]) |
|
|
ax.set_title(f"lora_scale: {lora_scales[i]}") |
|
|
ax.axis('off') |
|
|
plt.show() |
|
|
``` |
|
|
|
|
|
## Effect of different prompts |
|
|
|
|
|
```python |
|
|
platypus_prompts = [ |
|
|
"A cyberpunk platypus", |
|
|
"A steampunk platypus with brass gears and mechanical limbs, intricate Victorian-style machinery, warm tones, highly detailed illustration", |
|
|
"A platypus swimming in a serene river, soft watercolor painting, pastel colors, gentle brush strokes, dreamy atmosphere", |
|
|
"Cute cartoon platypus, big expressive eyes, playful pose, bright cheerful colors, whimsical style, 2D animation style", |
|
|
"A fantasy platypus wearing mystical armor, magical glowing runes on its body, standing on a cliff, dramatic lighting, epic fantasy illustration", |
|
|
"A cybernetic platypus, robotic enhancements, glowing circuits, sci-fi aesthetic, sleek metallic textures, high detail, digital art", |
|
|
"A platypus in the wild, painted in classical oil painting style, rich textures, dramatic lighting, realistic yet painterly, Baroque-inspired composition", |
|
|
"A pop art platypus, vibrant contrasting colors, bold outlines, comic-style halftone patterns, playful modern art", |
|
|
"A platypus rendered in retro pixel art, 16-bit video game style, colorful small-scale grid, cute and nostalgic", |
|
|
"A surreal platypus floating in a dreamlike landscape, abstract shapes, vibrant colors, imaginative surrealism, Salvador Dali inspired" |
|
|
] |
|
|
|
|
|
gen_images=[] |
|
|
|
|
|
for prompt in platypus_prompts: |
|
|
gen_image = pipeline( |
|
|
prompt=prompt, |
|
|
guidance_scale=7.5, |
|
|
num_inference_steps=25, |
|
|
height=512, |
|
|
width=512, |
|
|
cross_attention_kwargs={"scale": 0.9}, |
|
|
generator=torch.manual_seed(42) |
|
|
).images[0] |
|
|
|
|
|
gen_images.append(gen_image) |
|
|
|
|
|
|
|
|
fig,axes = plt.subplots(1,10,figsize=(20,10)) |
|
|
for i,ax in enumerate(axes): |
|
|
ax.imshow(gen_images[i]) |
|
|
ax.axis('off') |
|
|
plt.show() |
|
|
``` |
|
|
### Result |
|
|
 |