[Paper] [Colab] [Kaggle] [Model Card]
Generate any arbitrary aspect ratio images using the ruDALLE models
pip install rudalle==1.0.0
git clone https://github.com/shonenkov-AI/rudalle-aspect-ratio
Horizontal images:
The file gen_image.py
has some basic changes to the default example. Changes include:
- Translation from any supported language into Russian
- Saves individual images in a user-specified location with a user-specified prefix
- User-specified cache directory
It is based on the example below:
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('готический квартал', 1024, 0.975, 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('голубой цветок', 512, 0.975, 4)
show(result_pil_images, 4)
@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}
}