🚀 BeautifulPrompt
私たちは自動プロンプト生成モデルをオープンソースで公開しています。極めてシンプルなプロンプトを入力するだけで、言語モデルによって最適化されたプロンプトを取得でき、より簡単に高品質な画像を生成することができます。
🚀 クイックスタート
このセクションでは、BeautifulPromptモデルの基本的な使い方を説明します。
✨ 主な機能
- 自動的にプロンプトを生成し、高品質な画像生成をサポートします。
- シンプルな入力で、言語モデルによる最適化されたプロンプトを得ることができます。
📦 インストール
このモデルはtransformers
ライブラリを使用しています。必要なライブラリをインストールすることで、簡単に使用できます。
💻 使用例
基本的な使用法
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)
📚 ドキュメント
作品展示
オリジナル |
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 |
 |
 |
オリジナル |
BeautifulPrompt |
prompt: A majestic sailing ship |
prompt: a massive sailing ship, epic, cinematic, artstation, greg rutkowski, james gurney, sparth |
 |
 |
使用须知
⚠️ 重要提示
上記のモデルを使用する場合は、AIGCモデルオープンソース特別条項を遵守する必要があります。
Paper Citation
このモデルが役に立った場合は、以下の論文を引用してください。
@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}
}
📄 ライセンス
このプロジェクトはApache-2.0ライセンスの下で公開されています。