• Stars
    star
    1,533
  • Rank 30,321 (Top 0.7 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

stable_diffusion.openvino

Implementation of Text-To-Image generation using Stable Diffusion on Intel CPU or GPU.

Requirements

  • Linux, Windows, MacOS
  • Python <= 3.9.0
  • CPU or GPU compatible with OpenVINO.

Install requirements

  • Set up and update PIP to the highest version
  • Install OpenVINOโ„ข Development Tools 2022.3.0 release with PyPI
  • Download requirements
python -m pip install --upgrade pip
pip install openvino-dev[onnx,pytorch]==2022.3.0
pip install -r requirements.txt

Generate image from text description

usage: demo.py [-h] [--model MODEL] [--device DEVICE] [--seed SEED] [--beta-start BETA_START] [--beta-end BETA_END] [--beta-schedule BETA_SCHEDULE]
               [--num-inference-steps NUM_INFERENCE_STEPS] [--guidance-scale GUIDANCE_SCALE] [--eta ETA] [--tokenizer TOKENIZER] [--prompt PROMPT] [--params-from PARAMS_FROM]
               [--init-image INIT_IMAGE] [--strength STRENGTH] [--mask MASK] [--output OUTPUT]

optional arguments:
  -h, --help            show this help message and exit
  --model MODEL         model name
  --device DEVICE       inference device [CPU, GPU]
  --seed SEED           random seed for generating consistent images per prompt
  --beta-start BETA_START
                        LMSDiscreteScheduler::beta_start
  --beta-end BETA_END   LMSDiscreteScheduler::beta_end
  --beta-schedule BETA_SCHEDULE
                        LMSDiscreteScheduler::beta_schedule
  --num-inference-steps NUM_INFERENCE_STEPS
                        num inference steps
  --guidance-scale GUIDANCE_SCALE
                        guidance scale
  --eta ETA             eta
  --tokenizer TOKENIZER
                        tokenizer
  --prompt PROMPT       prompt
  --params-from PARAMS_FROM
                        Extract parameters from a previously generated image.
  --init-image INIT_IMAGE
                        path to initial image
  --strength STRENGTH   how strong the initial image should be noised [0.0, 1.0]
  --mask MASK           mask of the region to inpaint on the initial image
  --output OUTPUT       output image name

Examples

Example Text-To-Image

python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"

Example Image-To-Image

python demo.py --prompt "Photo of Emilia Clarke with a bright red hair" --init-image ./data/input.png --strength 0.5

Example Inpainting

python demo.py --prompt "Photo of Emilia Clarke with a bright red hair" --init-image ./data/input.png --mask ./data/mask.png --strength 0.5

Performance

CPU Time per iter Total time
AMD Ryzen 7 4800H 4.8 s/it 2.58 min
AMD Ryzen Threadripper 1900X 5.34 s/it 2.58 min
Intel(R) Core(TM) i7-4790K @ 4.00GHz 10.1 s/it 5.39 min
Intel(R) Core(TM) i5-8279U 7.4 s/it 3.59 min
Intel(R) Core(TM) i5-8569U @ 2.8GHz (MBP13-2019) 6.17 s/it 3.23 min
Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 7.4 s/it 3.59 min
Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 threads) 2.9 s/it 1.54 min
Intel(R) Core(TM) i7-1280P @ 1.80GHz (6P/8E) 5.45 s/it 2.55 min
Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz 1 s/it 33 s
Intel Arc A770M 6.64 it/s 7.53 s

Acknowledgements

Disclaimer

The authors are not responsible for the content generated using this project. Please, don't use this project to produce illegal, harmful, offensive etc. content.

More Repositories

1

MobileStyleGAN.pytorch

An official implementation of MobileStyleGAN in PyTorch
Python
662
star
2

crnn-pytorch

Pytorch implementation of OCR system using CRNN + CTCLoss
Python
216
star
3

mean_average_precision

Mean Average Precision for Object Detection
Python
192
star
4

random_face

A simple python library for fast image generation of people who do not exist.
Python
177
star
5

mpl.pytorch

Pytorch implementation of MaxPoolingLoss.
Python
175
star
6

thinkpad_x1_carbon_6th_linux

Linux configuration guide for Thinkpad x1 Carbon 6th Gen (2018)
Shell
143
star
7

pytorch_clip_guided_loss

A simple library that implements CLIP guided loss in PyTorch.
Python
77
star
8

VIBE

VIBE Background Subtractior
C++
67
star
9

pytorch_clip_bbox

Pytorch based library to rank predicted bounding boxes using text/image user's prompts.
Python
51
star
10

ESOINN

An enhanced self-organizing incremental neural network for online unsupervised learning
C++
28
star
11

vqvae_dwt_distiller.pytorch

Python
26
star
12

HandDetector

Hand and Fingertip Detecot with OpenCV
C++
25
star
13

SOINN

Self-Organizing and Incremental Neural Networks
C++
20
star
14

haar_pytorch

Pytorch implementation of forward and inverse Haar Wavelets 2D
Python
18
star
15

libGNG

Growing Neural Gas
C++
12
star
16

story-diffusion-runpod-serverless-worker

StoryDiffusion serverless worker
Python
9
star
17

stable_diffusion_quantizer.pytorch

Custom pipelines for stable diffusion model
Python
6
star
18

pytorch_clip_interrogator

Image-to-prompt reconstruction.
Python
4
star
19

smart_pdf

Summarize PDF by LLM
Python
4
star
20

SandboxCV

SandboxCV: sandbox for some computer vision algorithms
C++
2
star
21

pytorch_clip

Pytorch API to work with CLIP models.
Python
2
star
22

random_prompt

Random Prompt generator for ArtWork creation
Python
2
star
23

CloudsStitcher

Framework for stitching point clouds
C++
2
star
24

tts-runpod-serverless-worker

Serverless implementation of Text-To-Speech
Python
2
star
25

PTAM

Implementation of the PTAM as crossplatform library
C++
1
star
26

pybind11_template

Template of python wrapper for C++ class using pybind11+CMake
Python
1
star
27

image_to_sticker

Convert image to sticker
Python
1
star
28

text_to_speech_lab

Some experiments with TTS pipelines
Python
1
star