File size: 1,469 Bytes
1e9dbeb
 
ac989ef
 
 
 
 
 
 
1e9dbeb
ac989ef
 
ffcf71a
ac989ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---

license: cc-by-sa-4.0
language:
- ru
- en
pipeline_tag: text-to-image
tags:
- PyTorch
- Transformers
---

# Sunset Cities
This is the [Malevich](https://huggingface.co/sberbank-ai/rudalle-Malevich) ruDALL-E model finetuned on anime screenshots of big cities at sunset.
<img style="text-align:center; display:block;" src="https://huggingface.co/Xibanya/sunset_city/resolve/main/citysunset.png" width="256">

### installation
```

pip install rudalle

```

### How to use
Basic implementation to get a list of image data objects.

```python

from translate import Translator

from rudalle import get_rudalle_model, get_tokenizer, get_vae

from rudalle.pipelines import generate_images



model = get_rudalle_model('Malevich', pretrained=True, fp16=True, device='cuda')

model.load_state_dict(torch.load(CHECKPOINT_PATH))

vae = get_vae().to('cuda')

tokenizer = get_tokenizer()

input_text = Translator(to_lang='ru').translate('city at sunset')

images, _ = generate_images(

        text=input_text,

        tokenizer=tokenizer, dalle=model, vae=vae,

        images_num=1,

        top_k=2048,

        top_p=0.95,

        temperature=1.0

    )

```

the Malevich model only recognizes input in Russian. If you're going to paste Cyrillic directly into the code rather than filter an English prompt through the translate API, you will need to put this at the top of the file:

```python

#!/usr/bin/env python3

# -*- coding: utf-8 -*-

```