text-to-image license:creativeml-openrail-m region:us
---
license: creativeml-openrail-m
pipeline_tag: text-to-image
---
LoRA based on Stability AI SDXL-Turbo, for more information on the main model: https://huggingface.co/stabilityai/sdxl-turbo
![xyz_grid-0015-2494203713-20231201144837.png](https://cdn-uploads.huggingface.co/production/uploads/64186a8b5d6f3d15c64cd821/7OwTbNa7cGUqIuZOi7lQ9.png)

### Diffusers

```
pip install diffusers transformers accelerate --upgrade
```

- **Text-to-image**:
```py
import torch
from diffusers import LCMScheduler, AutoPipelineForText2Image

model_id = "stabilityai/stable-diffusion-xl-base-1.0"
adapter_id = "shiroppo/sd_xl_turbo_lora"

pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")

pipe.load_lora_weights(adapter_id)
pipe.fuse_lora()

prompt = "the_prompt"

image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=0).images[0]
```