Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions examples/openvino/stable_diffusion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Stable Diffusion LCM with OpenVINO Backend

This example demonstrates how to run Latent Consistency Models (LCM) for fast text-to-image generation on Intel hardware using ExecuTorch with the OpenVINO backend.

## Overview

Latent Consistency Models (LCMs) are optimized diffusion models that generate high-quality images in just 4-8 steps, compared to 25-50 steps required by traditional Stable Diffusion models. This implementation:

## Environment Setup
Follow the [instructions](../../../backends/openvino/README.md) of **Prerequisites** and **Setup** in `backends/openvino/README.md` to set up the OpenVINO backend.

### Install dependencies
```bash
pip install -r requirements.txt
```

## Export the Model

Export the LCM model:

```bash
python export_lcm.py \
--model_id SimianLuo/LCM_Dreamshaper_v7 \
--output_dir ./lcm_models \
--device CPU \
--dtype fp16
```
This will create three files in `./lcm_models/`:
- `text_encoder.pte`
- `unet.pte`
- `vae_decoder.pte`

### Generate Images

Run inference with the exported model:

```bash
python openvino_lcm.py \
--models_dir ./lcm_models \
--prompt "a beautiful sunset over mountains" \
--steps 4 \
--dtype fp16
```
## Supported Models

This implementation supports LCM-based Stable Diffusion models:
- **SimianLuo/LCM_Dreamshaper_v7**
- **latent-consistency/lcm-sdxl**
Loading
Loading