nerdyrodent / rudalle-aspect-ratio-eng

rudalle-aspect-ratio with basic translation into Russian from any supported language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ruDALLE aspect ratio images

Generate any arbitrary aspect ratio images using the ruDALLE models

Installing

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

Quick Start

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)

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}
}

About

rudalle-aspect-ratio with basic translation into Russian from any supported language


Languages

Language:Python 100.0%