Home

Awesome

[Paper] [Colab] [Kaggle] [Model Card]

ruDALLE aspect ratio images

Generate any arbitrary aspect ratio images using the ruDALLE models

Installing

pip install rudalle==1.1.1
git clone https://github.com/shonenkov-AI/rudalle-aspect-ratio

Quick Start

Horizontal images:

import sys
sys.path.insert(0, './rudalle-aspect-ratio')
from rudalle_aspect_ratio import RuDalleAspectRatio, get_rudalle_model
from rudalle import get_vae, get_tokenizer
from rudalle.pipelines import show

device = 'cuda'
dalle = get_rudalle_model('Surrealist_XL', fp16=True, device=device)
vae, tokenizer = get_vae().to(device), get_tokenizer()
rudalle_ar = RuDalleAspectRatio(
    dalle=dalle, vae=vae, tokenizer=tokenizer,
    aspect_ratio=32/9, bs=4, device=device
)
_, result_pil_images = rudalle_ar.generate_images('готический квартал', 768, 0.99, 4)
show(result_pil_images, 1)

Vertical images:

rudalle_ar = RuDalleAspectRatio(
    dalle=dalle, vae=vae, tokenizer=tokenizer,
    aspect_ratio=9/32, bs=4, device=device
)
_, result_pil_images = rudalle_ar.generate_images('голубой цветок', 768, 0.99, 4)
show(result_pil_images, 4)

Citation:

@MISC{rudalle_ar_github,
    author  = {Alex Shonenkov},
    title   = {Github ruDALLE aspect ratio images by shonenkovAI},
    url     = {https://github.com/shonenkov-AI/rudalle-aspect-ratio},
    year    = 2022,
    note    = {Accessed: 13-04-2022}
}