🚀 スーパープロンプト
T5モデルをSuperPromptデータセットでファインチューニングしたもので、テキストプロンプトをより詳細な説明に拡張します。より詳細なプロンプトが有益なテキストから画像への生成モデルの事前生成ステップとして使用することを想定しています。
🚀 クイックスタート
このモデルを使用するには、まず必要なライブラリをインストールする必要があります。以下のコマンドを使用して、transformers
ライブラリをインストールします。
pip install transformers
💻 使用例
基本的な使用法
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("roborovski/superprompt-v1")
model = T5ForConditionalGeneration.from_pretrained("roborovski/superprompt-v1", device_map="auto")
input_text = "Expand the following prompt to add more detail: A storefront with 'Text to Image' written on it."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
outputs = model.generate(input_ids, max_new_tokens=77)
print(tokenizer.decode(outputs[0]))
重要な注意事項
正確なタスクプレフィックス Expand the following prompt to add more detail:
を使用し、最大トークン数を77に制限することが重要です。これはStable Diffusionモデルの最大プロンプト長です。
⚠️ 重要提示
正確なタスクプレフィックス Expand the following prompt to add more detail:
を使用し、最大トークン数を77に制限することが重要です。これはStable Diffusionモデルの最大プロンプト長です。
📚 ドキュメント
サンプル
DrawBench データセットから取ったサンプルプロンプトです。
プロンプト |
拡張後 |
A storefront with 'Hello World' written on it. |
The storefront of "Hello World" is painted in vibrant shades of orange and yellow, with the words "Hello World" written in bold, cursive letters across the front. The storefront is surrounded by a bustling cityscape, with skyscrapers and neon signs lining the walls. The storefront is surrounded by a sea of people, all gazing up at the sky with a sense of excitement and excitement. |
An old photograph of a 1920s airship shaped like a pig, floating over a wheat field. |
In a surreal and whimsical scene, a vintage airplane shaped like a pig glides effortlessly over a vast wheat field. The pig's eyes are closed, and its tail swishes back and forth as it floats effortlessly over the landscape. The sun casts a warm glow on the scene, illuminating the intricate details of the pig's fur and the surrounding landscape. The airship's engines hum softly, a testament to the power of imagination and imagination. |
A painting by Grant Wood of an astronaut couple, american gothic style. |
In this surreal masterpiece, Grant Wood depicts a lone astronaut, dressed in a sleek silver spacesuit, gazing out at the vast expanse of space. The astronaut's eyes are closed, and his hands are clasped tightly around his body. The scene is set against a backdrop of swirling, distorted clouds, reminiscent of the American gothic style. The painting is a true masterpiece, capturing the essence of the human spirit and the beauty of the universe. |
A sheep to the right of a wine glass. |
A majestic white sheep with a wagging tail stands to the right of a sparkling wine glass, her long ears twitching as she gazes intently at the glass. The sun is setting in the background, casting a warm orange glow on the scene. The scene is set in a cozy living room, with a fireplace and a wooden table in the background. |
📄 ライセンス
このプロジェクトはMITライセンスの下で公開されています。