Stable diffusion is a deep learning, text-to-image model and used to generate detailted images conditioned on text description, thout it can also be applied to other task such as inpainting or outpainting and generate image to image translate guide by text prompt.
try online on google colab:
luna can running on online colab notebook you can check here:
- luna
- luna with tpu
- luna with gpu and mixed precision
- 15 seconds generation time per image (512 x 512) on default colab GPU without drop the quality
usagagge for online colab:
-
click the connect
-
open on
runtime
and click run all (ctrl+f9
if using shortcut ) -
online collab running luna
//create venv
python3 -m venv venv
//activate venv
source venv/bin/activate
clone on https :
git clone https://github.com/De-Rune/luna
cd luna
pip install -r requirements.txt
clone on ssh :
git clone [email protected]:De-Rune/luna.git
cd luna
pip install -r requirements.txt
note : if using mac m1 you can try installing the requirements_m1.txt
python text2image.py --prompt="example text"
to change the output file name run using the --output
flag
python text2image.py --prompt="cool picture" --output="cool_pic.png"
pip install git+https://github.com/De-Rune/luna
and run the package using
from stable_diffusion_tensorflow.stable_diffusion import StableDiffusion
generator = StableDiffusion(img_height=512, img_width=512, jit_compose=False)
img = generator.generate(
"DSLR photograph of an astronut riding a horse",
num_steps = 50,
unconditional_guidance_scale = 75,
temperature = 1,
batch_size = 1,
)
you can change dimension of image by change the img_height
and img_width
generator = StableDiffusion(
img_height = 1020 # or change 1080
img_height = 1080 # or change 800
)
if pip encountered an issue, try running pip with higher privilege using sudo