File size: 819 Bytes
8cec54a 1da5291 8cec54a 60458f9 1da5291 8cec54a 1da5291 8cec54a 1da5291 8cec54a 1da5291 8cec54a 1da5291 b89fe5f 1da5291 |
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 |
---
library_name: peft
base_model: segmind/tiny-sd
pipeline_tag: text-to-image
---
# Usage
```python
from peft import PeftModel
from diffusers import LCMScheduler, AutoPipelineForText2Image
model_id = "segmind/tiny-sd"
adapter_id = "akameswa/lcm-lora-tiny-sd"
pipe = AutoPipelineForText2Image.from_pretrained(model_id)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")
PeftModel.from_pretrained(pipe.unet, adapter_id)
prompt = "a dog wearing a knitted hat on the floor"
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=1.0).images[0]
display(image)
```
# Saving complete model
```python
pipe.fuse_lora(lora_scale=1.0)
pipe.unload_lora_weights()
for param in pipe.unet.parameters():
param.data = param.data.contiguous()
pipe.save_pretrained("./lcm-tiny-sd")
``` |