---
title: pai-bloom-1b1-text2prompt-sd
canonical_url: "https://www.modelscope.cn/models/AI-ModelScope/pai-bloom-1b1-text2prompt-sd"
md_url: "https://www.modelscope.cn/models/AI-ModelScope/pai-bloom-1b1-text2prompt-sd.md"
repository: AI-ModelScope/pai-bloom-1b1-text2prompt-sd
last_updated: 2024-06-26
license: apache-2.0
model_type:
  - bloom
architectures:
  - BloomForCausalLM
parameters: 1.1B
tensor_type:
  - F16
library_name:
  - transformer
  - safetensors
  - pytorch
frameworks:
  - pytorch
inference_backends:
  - "deploy_task text/emb"
  - "vllm 0.9.2"
downloads: 2861
stars: 2
tags:
  - pytorch
  - transformers
  - text-generation
---

# pai-bloom-1b1-text2prompt-sd

> pai-bloom-1b1-text2prompt-sd - AI-ModelScope 在 ModelScope 开源的模型。简介 Brief Introduction

AI-ModelScope/pai-bloom-1b1-text2prompt-sd 是 ModelScope 魔搭社区上的 1.1B 参数机器学习模型，采用 apache-2.0 许可，可用 deploy_task text/emb、vllm 0.9.2 部署。

- **Repository**: AI-ModelScope/pai-bloom-1b1-text2prompt-sd
- **License**: apache-2.0
- **Parameters**: 1.1B
- **Inference backends**: deploy_task text/emb, vllm 0.9.2
- **Tags**: pytorch, transformers, text-generation
- **Downloads**: 2861
- **Stars**: 2
- **Last updated**: 2024-06-26

Source: https://www.modelscope.cn/models/AI-ModelScope/pai-bloom-1b1-text2prompt-sd

---

# BeautifulPrompt

## 简介 Brief Introduction

我们开源了一个自动Prompt生成模型，您可以直接输入一个极其简单的Prompt，就可以得到经过语言模型优化过的Prompt，帮助您更简单地生成高颜值图像。

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.

* Github: [EasyNLP](https://github.com/alibaba/EasyNLP)

## 使用 Usage

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained('alibaba-pai/pai-bloom-1b1-text2prompt-sd')
model = AutoModelForCausalLM.from_pretrained('alibaba-pai/pai-bloom-1b1-text2prompt-sd').eval().cuda()

raw_prompt = '1 girl'
input = f'Instruction: Give a simple description of the image to generate a drawing prompt.\nInput: {raw_prompt}\nOutput:'
input_ids = tokenizer.encode(input, return_tensors='pt').cuda()

outputs = model.generate(
    input_ids,
    max_length=384,
    do_sample=True,
    temperature=1.0,
    top_k=50,
    top_p=0.95,
    repetition_penalty=1.2,
    num_return_sequences=5)

prompts = tokenizer.batch_decode(outputs[:, input_ids.size(1):], skip_special_tokens=True)
prompts = [p.strip() for p in prompts]
print(prompts)
```

## 作品展示 Gallery

<style>
table th:first-of-type {
    width: 50%;
}
table th:nth-of-type(2) {
    width: 50%;
}
</style>

| Original | BeautifulPrompt |
| ---------------------------------------- | ---------------------------------- |
| 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 |
| ![](example1.png)                        | ![](example2.png)                  |


| Original | BeautifulPrompt |
| ---------------------------------------- | ---------------------------------- |
| prompt: A majestic sailing ship | prompt: a massive sailing ship, epic, cinematic,    artstation, greg rutkowski, james gurney, sparth |
| ![](example3.png)                        | ![](example4.png)                  |



## 使用须知 Notice for Use

使用上述模型需遵守[AIGC模型开源特别条款](https://terms.alicdn.com/legal-agreement/terms/common_platform_service/20230505180457947/20230505180457947.html)。

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.

## Paper Citation

If you find the model useful, please consider cite the paper:

```
@inproceedings{emnlp2023a,
  author    = {Tingfeng Cao and
            Chengyu Wang and
            Bingyan Liu and
            Ziheng Wu and
            Jinhui Zhu and
            Jun Huang},
  title     = {BeautifulPrompt: Towards Automatic Prompt Engineering for Text-to-Image Synthesis},
  booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing: Industry Track},
  pages     = {1--11},
  year      = {2023}
}
```
