Xibanya commited on
Commit
ac989ef
·
1 Parent(s): 56bd996

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md CHANGED
@@ -1,3 +1,47 @@
1
  ---
2
  license: cc-by-sa-4.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-sa-4.0
3
+ language:
4
+ - ru
5
+ - en
6
+ pipeline_tag: text-to-image
7
+ tags:
8
+ - PyTorch
9
+ - Transformers
10
  ---
11
+ # Sunset Cities
12
+ This is the [Malevich](https://huggingface.co/sberbank-ai/rudalle-Malevich) ruDALL-E model finetuned on anime screenshots of big cities at sunset.
13
+
14
+ ### installation
15
+ ```
16
+ pip install rudalle
17
+ ```
18
+
19
+ ### How to use
20
+ Basic implementation to get a list of image data objects.
21
+
22
+ ```python
23
+ from translate import Translator
24
+ from rudalle import get_rudalle_model, get_tokenizer, get_vae
25
+ from rudalle.pipelines import generate_images
26
+
27
+ model = get_rudalle_model('Malevich', pretrained=True, fp16=True, device='cuda')
28
+ model.load_state_dict(torch.load(CHECKPOINT_PATH))
29
+ vae = get_vae().to('cuda')
30
+ tokenizer = get_tokenizer()
31
+ input_text = Translator(to_lang='ru').translate('city at sunset')
32
+ images, _ = generate_images(
33
+ text=input_text,
34
+ tokenizer=tokenizer, dalle=model, vae=vae,
35
+ images_num=1,
36
+ top_k=2048,
37
+ top_p=0.95,
38
+ temperature=1.0
39
+ )
40
+ ```
41
+
42
+ 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:
43
+
44
+ ```python
45
+ #!/usr/bin/env python3
46
+ # -*- coding: utf-8 -*-
47
+ ```