RichardErkhov
commited on
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
pai-bloom-1b1-text2prompt-sd - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/alibaba-pai/
|
12 |
+
- Original model: https://huggingface.co/alibaba-pai/pai-bloom-1b1-text2prompt-sd/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: apache-2.0
|
20 |
+
widget:
|
21 |
+
- text: "Instruction: Give a simple description of the image to generate a drawing prompt.\nInput: 1 girl\nOutput:"
|
22 |
+
tags:
|
23 |
+
- pytorch
|
24 |
+
- transformers
|
25 |
+
- text-generation
|
26 |
+
---
|
27 |
+
|
28 |
+
# BeautifulPrompt
|
29 |
+
|
30 |
+
## 简介 Brief Introduction
|
31 |
+
|
32 |
+
我们开源了一个自动Prompt生成模型,您可以直接输入一个极其简单的Prompt,就可以得到经过语言模型优化过的Prompt,帮助您更简单地生成高颜值图像。
|
33 |
+
|
34 |
+
We release an automatic Prompt generation model, you can directly enter an extremely simple Prompt and get a Prompt optimized by the language model to help you generate more beautiful images simply.
|
35 |
+
|
36 |
+
* Github: [EasyNLP](https://github.com/alibaba/EasyNLP)
|
37 |
+
|
38 |
+
## 使用 Usage
|
39 |
+
|
40 |
+
```python
|
41 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
42 |
+
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained('alibaba-pai/pai-bloom-1b1-text2prompt-sd')
|
44 |
+
model = AutoModelForCausalLM.from_pretrained('alibaba-pai/pai-bloom-1b1-text2prompt-sd').eval().cuda()
|
45 |
+
|
46 |
+
raw_prompt = '1 girl'
|
47 |
+
input = f'Instruction: Give a simple description of the image to generate a drawing prompt.\nInput: {raw_prompt}\nOutput:'
|
48 |
+
input_ids = tokenizer.encode(input, return_tensors='pt').cuda()
|
49 |
+
|
50 |
+
outputs = model.generate(
|
51 |
+
input_ids,
|
52 |
+
max_length=384,
|
53 |
+
do_sample=True,
|
54 |
+
temperature=1.0,
|
55 |
+
top_k=50,
|
56 |
+
top_p=0.95,
|
57 |
+
repetition_penalty=1.2,
|
58 |
+
num_return_sequences=5)
|
59 |
+
|
60 |
+
prompts = tokenizer.batch_decode(outputs[:, input_ids.size(1):], skip_special_tokens=True)
|
61 |
+
prompts = [p.strip() for p in prompts]
|
62 |
+
print(prompts)
|
63 |
+
```
|
64 |
+
|
65 |
+
## 作品展示 Gallery
|
66 |
+
|
67 |
+
<style>
|
68 |
+
table th:first-of-type {
|
69 |
+
width: 50%;
|
70 |
+
}
|
71 |
+
table th:nth-of-type(2) {
|
72 |
+
width: 50%;
|
73 |
+
}
|
74 |
+
</style>
|
75 |
+
|
76 |
+
| Original | BeautifulPrompt |
|
77 |
+
| ---------------------------------------- | ---------------------------------- |
|
78 |
+
| prompt: taylor swift, country, golden, fearless,wavehair | prompt: portrait of taylor swift as a beautiful woman, long hair, country, golden ratio, intricate, symmetrical, cinematic lighting, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration |
|
79 |
+
| ![](example1.png) | ![](example2.png) |
|
80 |
+
|
81 |
+
|
82 |
+
| Original | BeautifulPrompt |
|
83 |
+
| ---------------------------------------- | ---------------------------------- |
|
84 |
+
| prompt: A majestic sailing ship | prompt: a massive sailing ship, epic, cinematic, artstation, greg rutkowski, james gurney, sparth |
|
85 |
+
| ![](example3.png) | ![](example4.png) |
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
## 使用须知 Notice for Use
|
90 |
+
|
91 |
+
使用上述模型需遵守[AIGC模型开源特别条款](https://terms.alicdn.com/legal-agreement/terms/common_platform_service/20230505180457947/20230505180457947.html)。
|
92 |
+
|
93 |
+
If you want to use this model, please read this [document](https://terms.alicdn.com/legal-agreement/terms/common_platform_service/20230505180457947/20230505180457947.html) carefully and abide by the terms.
|
94 |
+
|
95 |
+
## Paper Citation
|
96 |
+
|
97 |
+
If you find the model useful, please consider cite the paper:
|
98 |
+
|
99 |
+
```
|
100 |
+
@inproceedings{emnlp2023a,
|
101 |
+
author = {Tingfeng Cao and
|
102 |
+
Chengyu Wang and
|
103 |
+
Bingyan Liu and
|
104 |
+
Ziheng Wu and
|
105 |
+
Jinhui Zhu and
|
106 |
+
Jun Huang},
|
107 |
+
title = {BeautifulPrompt: Towards Automatic Prompt Engineering for Text-to-Image Synthesis},
|
108 |
+
booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing: Industry Track},
|
109 |
+
pages = {1--11},
|
110 |
+
year = {2023}
|
111 |
+
}
|
112 |
+
```
|
113 |
+
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
|