🚀 BLOOM-560m RLHF SD2 Prompter
このプロジェクトでは、RLHF(Reinforcement Learning from Human Feedback)を使用して、mrm8488/bloom-560m-finetuned-sd-prompts をSD2.0向けにさらにファインチューニングしています。
COLAB DEMO INCLUDING STABLE DIFFUSION: https://colab.research.google.com/github/aicrumb/doohickey/blob/main/rlhf_prompt_tuner.ipynb
🚀 クイックスタート
このモデルを使用するには、以下の手順に従ってください。まず、必要なライブラリをインストールします。
!pip install transformers diffusers accelerate -qq
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
from transformers import pipeline
import torch
model_id = "stabilityai/stable-diffusion-2-base"
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt_pipe = pipeline("text-generation", model="crumb/bloom-560m-RLHF-SD2-prompter")
prompt = "cool landscape"
prompt = "<s>Prompt: " + prompt + ","
extended_prompt = prompt_pipe(prompt, do_sample=True, max_length=42)[0]['generated_text']
extended_prompt = extended_prompt[10:]
print("Prompt is now: ", extended_prompt)
image = pipe(extended_prompt).images[0]
image.save("output.png")
image
✨ 主な機能
- RLHFを使用して、BLOOM-560mモデルをSD2.0向けにファインチューニングします。
- 与えられたプロンプトを拡張し、Stable Diffusionで使用できるプロンプトを生成します。
- 独自のプロンプトを生成することもできます。
📦 インストール
以下のコードを実行して、必要なライブラリをインストールします。
batch_size = 16
learning_rate = 0.001 # this is why I didn't have to spend _forever_ on it
💻 使用例
基本的な使用法
!pip install transformers diffusers accelerate -qq
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
from transformers import pipeline
import torch
model_id = "stabilityai/stable-diffusion-2-base"
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt_pipe = pipeline("text-generation", model="crumb/bloom-560m-RLHF-SD2-prompter")
prompt = "cool landscape"
prompt = "<s>Prompt: " + prompt + ","
extended_prompt = prompt_pipe(prompt, do_sample=True, max_length=42)[0]['generated_text']
extended_prompt = extended_prompt[10:]
print("Prompt is now: ", extended_prompt)
image = pipe(extended_prompt).images[0]
image.save("output.png")
image
生成結果の例
Prompt is now: cool landscape, concept art

Prompt is now: cool landscape, concept art, sharp focus, digital painting

Prompt: 1 0 th century, highly detailed, concept art, cinematic lighting, unreal engine, trending on artstation, artstation hd, artstation hq, very very detailed

📚 ドキュメント
- モデルは、"<s>Prompt: " と通常のプロンプトを使用して拡張を生成します。
- このプロジェクトは、最初のイテレーションで、バイアスとレイヤーノルムの重みのみがトレーニングされました。
📄 ライセンス
このモデルは、bigscience-bloom-rail-1.0ライセンスの下で提供されています。
donate so i can do this on real hardware : https://github.com/aicrumb/aicrumb/blob/main/README.md
Further testing to be done in this area (automated training with aesthetic predicting models, larger data collection about prompt scores, better training in general)
Also, enjoy this graphic I had to make myself because I kept being indecisive of the reward methodology 
属性 |
详情 |
モデル名 |
bloom-560m-RLHF-SD2-prompter |
データセット |
Gustavosta/Stable-Diffusion-Prompts |
ライセンス |
bigscience-bloom-rail-1.0 |