RichardErkhov
commited on
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
bloom-560m-RLHF-SD2-prompter-aesthetic - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/crumb/
|
12 |
+
- Original model: https://huggingface.co/crumb/bloom-560m-RLHF-SD2-prompter-aesthetic/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: bigscience-bloom-rail-1.0
|
20 |
+
tags:
|
21 |
+
- stable-diffusion
|
22 |
+
- diffusion
|
23 |
+
model-index:
|
24 |
+
- name: bloom-560m-RLHF-SD2-prompter
|
25 |
+
results: []
|
26 |
+
|
27 |
+
datasets:
|
28 |
+
- Gustavosta/Stable-Diffusion-Prompts
|
29 |
+
|
30 |
+
widget:
|
31 |
+
- text: "<s>Prompt: "
|
32 |
+
|
33 |
+
inference:
|
34 |
+
parameters:
|
35 |
+
eos_token_id: 2
|
36 |
+
max_length: 128
|
37 |
+
do_sample: true
|
38 |
+
---
|
39 |
+
|
40 |
+
# The RAT (RLHF-Aesthetic Tuned model for prompt synthesis)
|
41 |
+
|
42 |
+
**COLAB DEMO INCLUDING STABLE DIFFUSION: https://colab.research.google.com/github/aicrumb/doohickey/blob/main/rlhf_prompt_tuner.ipynb**
|
43 |
+
|
44 |
+
This is a further finetuned version of [crumb/bloom-560m-RLHF-SD2-prompter](https://hf.co/crumb/bloom-560m-RLHF-SD2-prompter) to optimize for aesthetic score with models from https://github.com/crowsonkb/simulacra-aesthetic-models instead of me hand scoring each image
|
45 |
+
|
46 |
+
donate so i can do this on real hardware : https://github.com/aicrumb/aicrumb/blob/main/README.md
|
47 |
+
|
48 |
+
trained at bs=32, lr=0.0001, only tuning biases and layernorm weights
|
49 |
+
|
50 |
+
## Example usage
|
51 |
+
|
52 |
+
```python
|
53 |
+
# Install libraries needed to run the models
|
54 |
+
!pip install transformers diffusers accelerate -qq
|
55 |
+
|
56 |
+
# Import the libraries
|
57 |
+
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
|
58 |
+
from transformers import pipeline
|
59 |
+
import torch
|
60 |
+
|
61 |
+
# This is the model that the transformer was finetuned to generate prompts for
|
62 |
+
model_id = "stabilityai/stable-diffusion-2-base"
|
63 |
+
|
64 |
+
# Use the Euler scheduler here
|
65 |
+
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
|
66 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
|
67 |
+
pipe = pipe.to("cuda")
|
68 |
+
|
69 |
+
# Load the transformer model
|
70 |
+
prompt_pipe = pipeline("text-generation", model="crumb/bloom-560m-RLHF-SD2-prompter-aesthetic")
|
71 |
+
prompt = "cool landscape"
|
72 |
+
|
73 |
+
# Auto-complete prompt
|
74 |
+
prompt = "<s>Prompt: " + prompt + ","
|
75 |
+
extended_prompt = prompt_pipe(prompt, do_sample=True, max_length=42)[0]['generated_text']
|
76 |
+
extended_prompt = extended_prompt[10:]
|
77 |
+
print("Prompt is now: ", extended_prompt)
|
78 |
+
|
79 |
+
# Generate image
|
80 |
+
image = pipe(extended_prompt).images[0]
|
81 |
+
|
82 |
+
image.save("output.png")
|
83 |
+
image
|
84 |
+
```
|
85 |
+
|
86 |
+
## Limitations
|
87 |
+
Aesthetic scoring models have been shown to have very large biases, and one I noticed is it really likes images of women no matter the actual quality, so those were optimized for more than other things.
|
88 |
+
|
89 |
+
Also it fell into the trap of rlhf models, it gets kinda same-ey, so if you don't like the general "stable diffusion, trending on artstation" look this might not be for you.
|
90 |
+
|