Skip to content

Commit db4753a

Browse files
committed
Update readme and update torch installation scripts
1 parent a96f776 commit db4753a

File tree

4 files changed

+138
-90
lines changed

4 files changed

+138
-90
lines changed

Readme.md

Lines changed: 134 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@ FastSD CPU is a faster version of Stable Diffusion on CPU. Based on [Latent Cons
55

66
The following interfaces are available :
77

8-
- Desktop GUI (Qt,faster)
9-
- WebUI
8+
- Desktop GUI, basic text to image generation (Qt,faster)
9+
- WebUI (Advvanced features,Lora,controlnet etc)
1010
- CLI (CommandLine Interface)
1111

1212
🚀 Using __OpenVINO(SDXS-512-0.9)__, it took __0.82 seconds__ (__820 milliseconds__) to create a single 512x512 image on a __Core i7-12700__.
1313

14+
## Table of Contents
15+
16+
- [Introduction](#introduction)
17+
- [Supported Platforms](#Supported platforms)
18+
- [Memory requirements](#memory-requirements)
19+
- [Features](#features)
20+
- [Benchmarks](#fast-inference-benchmarks)
21+
- [Installation](#installation)
22+
- [Real-time text to image (EXPERIMENTAL)](#real-time-text-to-image)
23+
- [Android](#android)
24+
- [Raspberry PI 4](#raspberry)
25+
- [License](#license)
26+
- [Contributors](#contributors)
27+
1428
## Supported platforms⚡️
1529

1630
- Windows
@@ -19,64 +33,6 @@ The following interfaces are available :
1933
- Android + Termux
2034
- Raspberry PI 4
2135

22-
## 🚀 Fastest 1 step inference (SDXS-512-0.9)
23-
24-
:exclamation:This is an experimental model, only text to image workflow is supported.
25-
26-
### Inference Speed
27-
28-
Tested on Core i7-12700 to generate __512x512__ image(1 step).
29-
30-
__SDXS-512-0.9__
31-
32-
| Diffusion Pipeline | Latency |
33-
| --------------------- | ------------- |
34-
| Pytorch | 4.8s |
35-
| OpenVINO | 3.8s |
36-
| OpenVINO + TAESD | __0.82s__ |
37-
38-
## 🚀 Fast 1 step inference (SD/SDXL Turbo - Adversarial Diffusion Distillation,ADD)
39-
40-
Added support for ultra fast 1 step inference using [sdxl-turbo](https://huggingface.co/stabilityai/sdxl-turbo) model
41-
42-
:exclamation: These SD turbo models are intended for research purpose only.
43-
44-
### Inference Speed
45-
46-
Tested on Core i7-12700 to generate __512x512__ image(1 step).
47-
48-
__SD Turbo__
49-
50-
| Diffusion Pipeline | Latency |
51-
| --------------------- | ------------- |
52-
| Pytorch | 7.8s |
53-
| OpenVINO | 5s |
54-
| OpenVINO + TAESD | 1.7s |
55-
56-
__SDXL Turbo__
57-
58-
| Diffusion Pipeline | Latency |
59-
| --------------------- | ------------- |
60-
| Pytorch | 10s |
61-
| OpenVINO | 5.6s |
62-
| OpenVINO + TAESDXL | 2.5s |
63-
64-
## 🚀 Fast 2 step inference (SDXL-Lightning - Adversarial Diffusion Distillation)
65-
66-
SDXL-Lightning works with LCM and LCM-OpenVINO mode.You can select these models from app settings.
67-
68-
Tested on Core i7-12700 to generate __768x768__ image(2 steps).
69-
70-
| Diffusion Pipeline | Latency |
71-
| --------------------- | ------------- |
72-
| Pytorch | 18s |
73-
| OpenVINO | 12s |
74-
| OpenVINO + TAESDXL | 10s |
75-
76-
- *SDXL-Lightning* - [rupeshs/SDXL-Lightning-2steps](https://huggingface.co/rupeshs/SDXL-Lightning-2steps)
77-
78-
- *SDXL-Lightning OpenVINO* - [rupeshs/SDXL-Lightning-2steps-openvino-int8](https://huggingface.co/rupeshs/SDXL-Lightning-2steps-openvino-int8)
79-
8036
## Memory requirements
8137

8238
Minimum system RAM requirment for FastSD CPU.
@@ -95,8 +51,6 @@ If we enable Tiny decoder(TAESD) we can save some memory(2GB approx) for example
9551

9652
:exclamation: Please note that guidance scale >1 increases RAM usage and slow inference speed.
9753

98-
![FastSD CPU Desktop GUI Screenshot](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastsdcpu-gui.jpg)
99-
10054
## Features
10155

10256
- Supports 256,512,768 image sizes
@@ -149,12 +103,108 @@ If we enable Tiny decoder(TAESD) we can save some memory(2GB approx) for example
149103
- Revert default model to SDTurbo
150104
- Update realtime UI
151105

152-
## 2 Steps fast inference (LCM)
106+
<a id="fast-inference-benchmarks"></a>
107+
108+
## Fast Inference Benchmarks
109+
110+
### 🚀 Fast 1 step inference with Hyper-SD
111+
112+
#### Stablediffuion 1.5
113+
114+
Works with LCM-LoRA mode.
115+
Fast 1 step inference supported on `runwayml/stable-diffusion-v1-5` model,select `rupeshs/hypersd-sd1-5-1-step-lora` lcm_lora model from the settings.
116+
117+
#### Stablediffuion XL
118+
119+
Works with LCM,LCM-LoRA and OpenVINO model
120+
121+
- *Hyper-SD SDXL 1 step* - [rupeshs/hyper-sd-sdxl-1-step](https://huggingface.co/rupeshs/hyper-sd-sdxl-1-step)
122+
123+
- *Hyper-SD SDXL 1 step OpenVINO* - [rupeshs/hyper-sd-sdxl-1-step-openvino-int8](https://huggingface.co/rupeshs/hyper-sd-sdxl-1-step-openvino-int8)
124+
125+
#### Inference Speed
126+
127+
Tested on Core i7-12700 to generate __768x768__ image(2 steps).
128+
129+
| Diffusion Pipeline | Latency |
130+
| --------------------- | ------------- |
131+
| Pytorch | 15s |
132+
| OpenVINO | 7s |
133+
| OpenVINO + TAESDXL | 5.8s |
134+
135+
### Fastest 1 step inference (SDXS-512-0.9)
136+
137+
:exclamation:This is an experimental model, only text to image workflow is supported.
138+
139+
#### Inference Speed
140+
141+
Tested on Core i7-12700 to generate __512x512__ image(1 step).
142+
143+
__SDXS-512-0.9__
144+
145+
| Diffusion Pipeline | Latency |
146+
| --------------------- | ------------- |
147+
| Pytorch | 4.8s |
148+
| OpenVINO | 3.8s |
149+
| OpenVINO + TAESD | __0.82s__ |
150+
151+
### 🚀 Fast 1 step inference (SD/SDXL Turbo - Adversarial Diffusion Distillation,ADD)
152+
153+
Added support for ultra fast 1 step inference using [sdxl-turbo](https://huggingface.co/stabilityai/sdxl-turbo) model
154+
155+
:exclamation: These SD turbo models are intended for research purpose only.
156+
157+
#### Inference Speed
158+
159+
Tested on Core i7-12700 to generate __512x512__ image(1 step).
160+
161+
__SD Turbo__
162+
163+
| Diffusion Pipeline | Latency |
164+
| --------------------- | ------------- |
165+
| Pytorch | 7.8s |
166+
| OpenVINO | 5s |
167+
| OpenVINO + TAESD | 1.7s |
168+
169+
__SDXL Turbo__
170+
171+
| Diffusion Pipeline | Latency |
172+
| --------------------- | ------------- |
173+
| Pytorch | 10s |
174+
| OpenVINO | 5.6s |
175+
| OpenVINO + TAESDXL | 2.5s |
176+
177+
### 🚀 Fast 2 step inference (SDXL-Lightning - Adversarial Diffusion Distillation)
178+
179+
SDXL-Lightning works with LCM and LCM-OpenVINO mode.You can select these models from app settings.
180+
181+
Tested on Core i7-12700 to generate __768x768__ image(2 steps).
182+
183+
| Diffusion Pipeline | Latency |
184+
| --------------------- | ------------- |
185+
| Pytorch | 18s |
186+
| OpenVINO | 12s |
187+
| OpenVINO + TAESDXL | 10s |
188+
189+
- *SDXL-Lightning* - [rupeshs/SDXL-Lightning-2steps](https://huggingface.co/rupeshs/SDXL-Lightning-2steps)
190+
191+
- *SDXL-Lightning OpenVINO* - [rupeshs/SDXL-Lightning-2steps-openvino-int8](https://huggingface.co/rupeshs/SDXL-Lightning-2steps-openvino-int8)
192+
193+
### 2 Steps fast inference (LCM)
153194

154195
FastSD CPU supports 2 to 3 steps fast inference using LCM-LoRA workflow. It works well with SD 1.5 models.
155196

156197
![2 Steps inference](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/2steps-inference.jpg)
157198

199+
### Benchmarking scripts
200+
201+
To benchmark run the following batch file on Windows:
202+
203+
- `benchmark.bat` - To benchmark Pytorch
204+
- `benchmark-openvino.bat` - To benchmark OpenVINO
205+
206+
Alternatively you can run benchmarks by passing `-b` command line argument in CLI mode.
207+
158208
## OpenVINO support
159209

160210
Thanks [deinferno](https://github.com/deinferno) for the OpenVINO model contribution.
@@ -174,12 +224,13 @@ You can directly use these models in FastSD CPU.
174224
### Convert SD 1.5 models to OpenVINO LCM-LoRA fused models
175225

176226
We first creates LCM-LoRA baked in model,replaces the scheduler with LCM and then converts it into OpenVINO model. For more details check [LCM OpenVINO Converter](https://github.com/rupeshs/lcm-openvino-converter), you can use this tools to convert any StableDiffusion 1.5 fine tuned models to OpenVINO.
227+
<a id="real-time-text-to-image"></a>
177228

178229
## Real-time text to image (EXPERIMENTAL)
179230

180231
We can generate real-time text to images using FastSD CPU.
181232

182-
**CPU (OpenVINO)**
233+
__CPU (OpenVINO)__
183234

184235
Near real-time inference on CPU using OpenVINO, run the `start-realtime.bat` batch file and open the link in browser (Resolution : 512x512,Latency : 0.82s on Intel Core i7)
185236

@@ -275,17 +326,16 @@ Use the medium size models (723 MB)(For example : <https://huggingface.co/comfya
275326

276327
## FastSD CPU on Windows
277328

278-
:exclamation:**You must have a working Python installation.(Recommended : Python 3.10 or 3.11 )**
329+
:exclamation:__You must have a working Python installation.(Recommended : Python 3.10 or 3.11 )__
330+
331+
![FastSD CPU Desktop GUI Screenshot](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastsdcpu-gui.jpg)
279332

280333
Clone/download this repo or download release.
281334

282-
### Installation
335+
## Installation
283336

284337
- Double click `install.bat` (It will take some time to install,depending on your internet speed.)
285-
286-
### Run
287-
288-
You can run in desktop GUI mode or web UI mode.
338+
- You can run in desktop GUI mode or web UI mode.
289339

290340
#### Desktop GUI
291341

@@ -295,7 +345,7 @@ You can run in desktop GUI mode or web UI mode.
295345

296346
- To start web UI double click `start-webui.bat`
297347

298-
## FastSD CPU on Linux
348+
### FastSD CPU on Linux
299349

300350
Ensure that you have Python 3.9 or 3.10 or 3.11 version installed.
301351

@@ -315,11 +365,11 @@ Ensure that you have Python 3.9 or 3.10 or 3.11 version installed.
315365

316366
`./start-webui.sh`
317367

318-
## FastSD CPU on Mac
368+
### FastSD CPU on Mac
319369

320370
![FastSD CPU running on Mac](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastsdcpu-mac-gui.jpg)
321371

322-
### Installation
372+
#### Installation
323373

324374
Ensure that you have Python 3.9 or 3.10 or 3.11 version installed.
325375

@@ -347,33 +397,35 @@ If you want to increase image generation speed on Mac(M1/M2 chip) try this:
347397

348398
`export DEVICE=mps` and start app `start.sh`
349399

350-
## Web UI screenshot
400+
#### Web UI screenshot
351401

352402
![FastSD CPU WebUI Screenshot](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastcpu-webui.png)
353403

354-
## Google Colab
404+
### Google Colab
355405

356406
Due to the limitation of using CPU/OpenVINO inside colab, we are using GPU with colab.
357407
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SuAqskB-_gjWLYNRFENAkIXZ1aoyINqL?usp=sharing)
358408

359-
## CLI mode (Advanced users)
409+
### CLI mode (Advanced users)
360410

361411
![FastSD CPU CLI Screenshot](https://raw.githubusercontent.com/rupeshs/fastsdcpu/main/docs/images/fastcpu-cli.png)
362412

363413
Open the terminal and enter into fastsdcpu folder.
364414
Activate virtual environment using the command:
365415

366-
#### Windows users
416+
##### Windows users
367417

368418
(Suppose FastSD CPU available in the directory "D:\fastsdcpu")
369419
`D:\fastsdcpu\env\Scripts\activate.bat`
370420

371-
#### Linux users
421+
##### Linux users
372422

373423
`source env/bin/activate`
374424

375425
Start CLI `src/app.py -h`
376426

427+
<a id="android"></a>
428+
377429
## Android (Termux + PRoot)
378430

379431
FastSD CPU running on Google Pixel 7 Pro.
@@ -400,20 +452,15 @@ Run the following command to install without Qt GUI.
400452

401453
Thanks [patienx](https://github.com/patientx) for this guide [Step by step guide to installing FASTSDCPU on ANDROID](https://github.com/rupeshs/fastsdcpu/discussions/123)
402454

455+
Another step by step guide to run FastSD on Android is [here](https://nolowiz.com/how-to-install-and-run-fastsd-cpu-on-android-temux-step-by-step-guide/)
456+
457+
<a id="raspberry"></a>
458+
403459
## Raspberry PI 4 support
404460

405461
Thanks WGNW_MGM for Raspberry PI 4 testing.FastSD CPU worked without problems.
406462
System configuration - Raspberry Pi 4 with 4GB RAM, 8GB of SWAP memory.
407463

408-
## Benchmarking
409-
410-
To benchmark run the following batch file on Windows:
411-
412-
- `benchmark.bat` - To benchmark Pytorch
413-
- `benchmark-openvino.bat` - To benchmark OpenVINO
414-
415-
Alternatively you can run benchmarks by passing `-b` command line argument in CLI mode.
416-
417464
## Known issues
418465

419466
- TAESD will not work with OpenVINO image to image workflow

install-mac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ BASEDIR=$(pwd)
2424
$PYTHON_COMMAND -m venv "$BASEDIR/env"
2525
# shellcheck disable=SC1091
2626
source "$BASEDIR/env/bin/activate"
27-
pip install -r "$BASEDIR/requirements.txt"
2827
pip install torch==2.2.2
28+
pip install -r "$BASEDIR/requirements.txt"
2929
chmod +x "start.sh"
3030
chmod +x "start-webui.sh"
3131
read -n1 -r -p "FastSD CPU installation completed,press any key to continue..." key

install.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ for /f "tokens=2" %%I in ('%PYTHON_COMMAND% --version 2^>^&1') do (
2323
echo Python version: %python_version%
2424

2525
%PYTHON_COMMAND% -m venv "%~dp0env"
26-
call "%~dp0env\Scripts\activate.bat" && pip install -r "%~dp0requirements.txt"
2726
call "%~dp0env\Scripts\activate.bat" && pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
27+
call "%~dp0env\Scripts\activate.bat" && pip install -r "%~dp0requirements.txt"
2828
echo FastSD CPU env installation completed.
2929
pause

install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ BASEDIR=$(pwd)
2424
$PYTHON_COMMAND -m venv "$BASEDIR/env"
2525
# shellcheck disable=SC1091
2626
source "$BASEDIR/env/bin/activate"
27+
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
2728
if [[ "$1" == "--disable-gui" ]]; then
2829
#! For termux , we don't need Qt based GUI
2930
packages="$(grep -v "^ *#\|^PyQt5" requirements.txt | grep .)"
@@ -32,7 +33,7 @@ if [[ "$1" == "--disable-gui" ]]; then
3233
else
3334
pip install -r "$BASEDIR/requirements.txt"
3435
fi
35-
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
36+
3637
chmod +x "start.sh"
3738
chmod +x "start-webui.sh"
3839
read -n1 -r -p "FastSD CPU installation completed,press any key to continue..." key

0 commit comments

Comments
 (0)