Spaces:
Runtime error
Runtime error
add large file local
Browse files- pretrained_models/blip2-opt-2.7b/.gitattributes +34 -0
- pretrained_models/blip2-opt-2.7b/README.md +163 -0
- pretrained_models/blip2-opt-2.7b/config.json +255 -0
- pretrained_models/blip2-opt-2.7b/merges.txt +0 -0
- pretrained_models/blip2-opt-2.7b/preprocessor_config.json +24 -0
- pretrained_models/blip2-opt-2.7b/pytorch_model-00001-of-00002.bin +3 -0
- pretrained_models/blip2-opt-2.7b/pytorch_model-00002-of-00002.bin +3 -0
- pretrained_models/blip2-opt-2.7b/pytorch_model.bin.index.json +0 -0
- pretrained_models/blip2-opt-2.7b/special_tokens_map.json +30 -0
- pretrained_models/blip2-opt-2.7b/tokenizer.json +0 -0
- pretrained_models/blip2-opt-2.7b/tokenizer_config.json +41 -0
- pretrained_models/blip2-opt-2.7b/vocab.json +0 -0
- pretrained_models/stable-diffusion-v1-5/.gitattributes +35 -0
- pretrained_models/stable-diffusion-v1-5/README.md +207 -0
- pretrained_models/stable-diffusion-v1-5/feature_extractor/preprocessor_config.json +20 -0
- pretrained_models/stable-diffusion-v1-5/model_index.json +32 -0
- pretrained_models/stable-diffusion-v1-5/safety_checker/config.json +175 -0
- pretrained_models/stable-diffusion-v1-5/safety_checker/model.safetensors +3 -0
- pretrained_models/stable-diffusion-v1-5/safety_checker/pytorch_model.bin +3 -0
- pretrained_models/stable-diffusion-v1-5/scheduler/scheduler_config.json +13 -0
- pretrained_models/stable-diffusion-v1-5/text_encoder/config.json +25 -0
- pretrained_models/stable-diffusion-v1-5/text_encoder/model.safetensors +3 -0
- pretrained_models/stable-diffusion-v1-5/text_encoder/pytorch_model.bin +3 -0
- pretrained_models/stable-diffusion-v1-5/tokenizer/merges.txt +0 -0
- pretrained_models/stable-diffusion-v1-5/tokenizer/special_tokens_map.json +24 -0
- pretrained_models/stable-diffusion-v1-5/tokenizer/tokenizer_config.json +34 -0
- pretrained_models/stable-diffusion-v1-5/tokenizer/vocab.json +0 -0
- pretrained_models/stable-diffusion-v1-5/unet/config.json +36 -0
- pretrained_models/stable-diffusion-v1-5/unet/diffusion_pytorch_model.bin +3 -0
- pretrained_models/stable-diffusion-v1-5/unet/diffusion_pytorch_model.safetensors +3 -0
- pretrained_models/stable-diffusion-v1-5/v1-5-pruned-emaonly.ckpt +3 -0
- pretrained_models/stable-diffusion-v1-5/v1-5-pruned-emaonly.safetensors +3 -0
- pretrained_models/stable-diffusion-v1-5/v1-5-pruned.ckpt +3 -0
- pretrained_models/stable-diffusion-v1-5/v1-5-pruned.safetensors +3 -0
- pretrained_models/stable-diffusion-v1-5/v1-inference.yaml +70 -0
- pretrained_models/stable-diffusion-v1-5/vae/config.json +29 -0
- pretrained_models/stable-diffusion-v1-5/vae/diffusion_pytorch_model.bin +3 -0
- pretrained_models/stable-diffusion-v1-5/vae/diffusion_pytorch_model.safetensors +3 -0
pretrained_models/blip2-opt-2.7b/.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
pretrained_models/blip2-opt-2.7b/README.md
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- vision
|
6 |
+
- image-to-text
|
7 |
+
- image-captioning
|
8 |
+
- visual-question-answering
|
9 |
+
pipeline_tag: image-to-text
|
10 |
+
---
|
11 |
+
|
12 |
+
# BLIP-2, OPT-2.7b, pre-trained only
|
13 |
+
|
14 |
+
BLIP-2 model, leveraging [OPT-2.7b](https://huggingface.co/facebook/opt-2.7b) (a large language model with 2.7 billion parameters).
|
15 |
+
It was introduced in the paper [BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models](https://arxiv.org/abs/2301.12597) by Li et al. and first released in [this repository](https://github.com/salesforce/LAVIS/tree/main/projects/blip2).
|
16 |
+
|
17 |
+
Disclaimer: The team releasing BLIP-2 did not write a model card for this model so this model card has been written by the Hugging Face team.
|
18 |
+
|
19 |
+
## Model description
|
20 |
+
|
21 |
+
BLIP-2 consists of 3 models: a CLIP-like image encoder, a Querying Transformer (Q-Former) and a large language model.
|
22 |
+
|
23 |
+
The authors initialize the weights of the image encoder and large language model from pre-trained checkpoints and keep them frozen
|
24 |
+
while training the Querying Transformer, which is a BERT-like Transformer encoder that maps a set of "query tokens" to query embeddings,
|
25 |
+
which bridge the gap between the embedding space of the image encoder and the large language model.
|
26 |
+
|
27 |
+
The goal for the model is simply to predict the next text token, giving the query embeddings and the previous text.
|
28 |
+
|
29 |
+
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/blip2_architecture.jpg"
|
30 |
+
alt="drawing" width="600"/>
|
31 |
+
|
32 |
+
This allows the model to be used for tasks like:
|
33 |
+
|
34 |
+
- image captioning
|
35 |
+
- visual question answering (VQA)
|
36 |
+
- chat-like conversations by feeding the image and the previous conversation as prompt to the model
|
37 |
+
|
38 |
+
## Direct Use and Downstream Use
|
39 |
+
|
40 |
+
You can use the raw model for conditional text generation given an image and optional text. See the [model hub](https://huggingface.co/models?search=Salesforce/blip) to look for
|
41 |
+
fine-tuned versions on a task that interests you.
|
42 |
+
|
43 |
+
## Bias, Risks, Limitations, and Ethical Considerations
|
44 |
+
|
45 |
+
BLIP2-OPT uses off-the-shelf OPT as the language model. It inherits the same risks and limitations as mentioned in Meta's model card.
|
46 |
+
|
47 |
+
> Like other large language models for which the diversity (or lack thereof) of training
|
48 |
+
> data induces downstream impact on the quality of our model, OPT-175B has limitations in terms
|
49 |
+
> of bias and safety. OPT-175B can also have quality issues in terms of generation diversity and
|
50 |
+
> hallucination. In general, OPT-175B is not immune from the plethora of issues that plague modern
|
51 |
+
> large language models.
|
52 |
+
>
|
53 |
+
BLIP2 is fine-tuned on image-text datasets (e.g. [LAION](https://laion.ai/blog/laion-400-open-dataset/) ) collected from the internet. As a result the model itself is potentially vulnerable to generating equivalently inappropriate content or replicating inherent biases in the underlying data.
|
54 |
+
|
55 |
+
BLIP2 has not been tested in real world applications. It should not be directly deployed in any applications. Researchers should first carefully assess the safety and fairness of the model in relation to the specific context theyβre being deployed within.
|
56 |
+
|
57 |
+
|
58 |
+
### How to use
|
59 |
+
|
60 |
+
For code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/blip-2#transformers.Blip2ForConditionalGeneration.forward.example).
|
61 |
+
|
62 |
+
#### Running the model on CPU
|
63 |
+
|
64 |
+
<details>
|
65 |
+
<summary> Click to expand </summary>
|
66 |
+
|
67 |
+
```python
|
68 |
+
import requests
|
69 |
+
from PIL import Image
|
70 |
+
from transformers import BlipProcessor, Blip2ForConditionalGeneration
|
71 |
+
|
72 |
+
processor = BlipProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
73 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b")
|
74 |
+
|
75 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
76 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
77 |
+
|
78 |
+
question = "how many dogs are in the picture?"
|
79 |
+
inputs = processor(raw_image, question, return_tensors="pt")
|
80 |
+
|
81 |
+
out = model.generate(**inputs)
|
82 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
83 |
+
```
|
84 |
+
</details>
|
85 |
+
|
86 |
+
#### Running the model on GPU
|
87 |
+
|
88 |
+
##### In full precision
|
89 |
+
|
90 |
+
<details>
|
91 |
+
<summary> Click to expand </summary>
|
92 |
+
|
93 |
+
```python
|
94 |
+
# pip install accelerate
|
95 |
+
import requests
|
96 |
+
from PIL import Image
|
97 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
98 |
+
|
99 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
100 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", device_map="auto")
|
101 |
+
|
102 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
103 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
104 |
+
|
105 |
+
question = "how many dogs are in the picture?"
|
106 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda")
|
107 |
+
|
108 |
+
out = model.generate(**inputs)
|
109 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
110 |
+
```
|
111 |
+
</details>
|
112 |
+
|
113 |
+
##### In half precision (`float16`)
|
114 |
+
|
115 |
+
<details>
|
116 |
+
<summary> Click to expand </summary>
|
117 |
+
|
118 |
+
```python
|
119 |
+
# pip install accelerate
|
120 |
+
import torch
|
121 |
+
import requests
|
122 |
+
from PIL import Image
|
123 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
124 |
+
|
125 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
126 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", torch_dtype=torch.float16, device_map="auto")
|
127 |
+
|
128 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
129 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
130 |
+
|
131 |
+
question = "how many dogs are in the picture?"
|
132 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
|
133 |
+
|
134 |
+
out = model.generate(**inputs)
|
135 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
136 |
+
```
|
137 |
+
</details>
|
138 |
+
|
139 |
+
##### In 8-bit precision (`int8`)
|
140 |
+
|
141 |
+
<details>
|
142 |
+
<summary> Click to expand </summary>
|
143 |
+
|
144 |
+
```python
|
145 |
+
# pip install accelerate bitsandbytes
|
146 |
+
import torch
|
147 |
+
import requests
|
148 |
+
from PIL import Image
|
149 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
150 |
+
|
151 |
+
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
152 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map="auto")
|
153 |
+
|
154 |
+
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
|
155 |
+
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
|
156 |
+
|
157 |
+
question = "how many dogs are in the picture?"
|
158 |
+
inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
|
159 |
+
|
160 |
+
out = model.generate(**inputs)
|
161 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
162 |
+
```
|
163 |
+
</details>
|
pretrained_models/blip2-opt-2.7b/config.json
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_commit_hash": null,
|
3 |
+
"architectures": [
|
4 |
+
"Blip2ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"initializer_factor": 1.0,
|
7 |
+
"initializer_range": 0.02,
|
8 |
+
"model_type": "blip-2",
|
9 |
+
"num_query_tokens": 32,
|
10 |
+
"qformer_config": {
|
11 |
+
"_name_or_path": "",
|
12 |
+
"add_cross_attention": false,
|
13 |
+
"architectures": null,
|
14 |
+
"attention_probs_dropout_prob": 0.1,
|
15 |
+
"bad_words_ids": null,
|
16 |
+
"begin_suppress_tokens": null,
|
17 |
+
"bos_token_id": null,
|
18 |
+
"chunk_size_feed_forward": 0,
|
19 |
+
"classifier_dropout": null,
|
20 |
+
"cross_attention_frequency": 2,
|
21 |
+
"cross_attention_hidden_size": null,
|
22 |
+
"decoder_start_token_id": null,
|
23 |
+
"diversity_penalty": 0.0,
|
24 |
+
"do_sample": false,
|
25 |
+
"early_stopping": false,
|
26 |
+
"encoder_hidden_size": 1408,
|
27 |
+
"encoder_no_repeat_ngram_size": 0,
|
28 |
+
"eos_token_id": null,
|
29 |
+
"exponential_decay_length_penalty": null,
|
30 |
+
"finetuning_task": null,
|
31 |
+
"forced_bos_token_id": null,
|
32 |
+
"forced_eos_token_id": null,
|
33 |
+
"hidden_act": "gelu",
|
34 |
+
"hidden_dropout_prob": 0.1,
|
35 |
+
"hidden_size": 768,
|
36 |
+
"id2label": {
|
37 |
+
"0": "LABEL_0",
|
38 |
+
"1": "LABEL_1"
|
39 |
+
},
|
40 |
+
"initializer_range": 0.02,
|
41 |
+
"intermediate_size": 3072,
|
42 |
+
"is_decoder": false,
|
43 |
+
"is_encoder_decoder": false,
|
44 |
+
"label2id": {
|
45 |
+
"LABEL_0": 0,
|
46 |
+
"LABEL_1": 1
|
47 |
+
},
|
48 |
+
"layer_norm_eps": 1e-12,
|
49 |
+
"length_penalty": 1.0,
|
50 |
+
"max_length": 20,
|
51 |
+
"max_position_embeddings": 512,
|
52 |
+
"min_length": 0,
|
53 |
+
"model_type": "blip_2_qformer",
|
54 |
+
"no_repeat_ngram_size": 0,
|
55 |
+
"num_attention_heads": 12,
|
56 |
+
"num_beam_groups": 1,
|
57 |
+
"num_beams": 1,
|
58 |
+
"num_hidden_layers": 12,
|
59 |
+
"num_return_sequences": 1,
|
60 |
+
"output_attentions": false,
|
61 |
+
"output_hidden_states": false,
|
62 |
+
"output_scores": false,
|
63 |
+
"pad_token_id": 0,
|
64 |
+
"position_embedding_type": "absolute",
|
65 |
+
"prefix": null,
|
66 |
+
"problem_type": null,
|
67 |
+
"pruned_heads": {},
|
68 |
+
"remove_invalid_values": false,
|
69 |
+
"repetition_penalty": 1.0,
|
70 |
+
"return_dict": true,
|
71 |
+
"return_dict_in_generate": false,
|
72 |
+
"sep_token_id": null,
|
73 |
+
"suppress_tokens": null,
|
74 |
+
"task_specific_params": null,
|
75 |
+
"temperature": 1.0,
|
76 |
+
"tf_legacy_loss": false,
|
77 |
+
"tie_encoder_decoder": false,
|
78 |
+
"tie_word_embeddings": true,
|
79 |
+
"tokenizer_class": null,
|
80 |
+
"top_k": 50,
|
81 |
+
"top_p": 1.0,
|
82 |
+
"torch_dtype": null,
|
83 |
+
"torchscript": false,
|
84 |
+
"transformers_version": "4.27.0.dev0",
|
85 |
+
"typical_p": 1.0,
|
86 |
+
"use_bfloat16": false,
|
87 |
+
"vocab_size": 30522
|
88 |
+
},
|
89 |
+
"text_config": {
|
90 |
+
"_name_or_path": "facebook/opt-2.7b",
|
91 |
+
"_remove_final_layer_norm": false,
|
92 |
+
"activation_dropout": 0.0,
|
93 |
+
"activation_function": "relu",
|
94 |
+
"add_cross_attention": false,
|
95 |
+
"architectures": [
|
96 |
+
"OPTForCausalLM"
|
97 |
+
],
|
98 |
+
"attention_dropout": 0.0,
|
99 |
+
"bad_words_ids": null,
|
100 |
+
"begin_suppress_tokens": null,
|
101 |
+
"bos_token_id": 2,
|
102 |
+
"chunk_size_feed_forward": 0,
|
103 |
+
"cross_attention_hidden_size": null,
|
104 |
+
"decoder_start_token_id": null,
|
105 |
+
"diversity_penalty": 0.0,
|
106 |
+
"do_layer_norm_before": true,
|
107 |
+
"do_sample": false,
|
108 |
+
"dropout": 0.1,
|
109 |
+
"early_stopping": false,
|
110 |
+
"enable_bias": true,
|
111 |
+
"encoder_no_repeat_ngram_size": 0,
|
112 |
+
"eos_token_id": 50118,
|
113 |
+
"exponential_decay_length_penalty": null,
|
114 |
+
"ffn_dim": 10240,
|
115 |
+
"finetuning_task": null,
|
116 |
+
"forced_bos_token_id": null,
|
117 |
+
"forced_eos_token_id": null,
|
118 |
+
"hidden_size": 2560,
|
119 |
+
"id2label": {
|
120 |
+
"0": "LABEL_0",
|
121 |
+
"1": "LABEL_1"
|
122 |
+
},
|
123 |
+
"init_std": 0.02,
|
124 |
+
"is_decoder": false,
|
125 |
+
"is_encoder_decoder": false,
|
126 |
+
"label2id": {
|
127 |
+
"LABEL_0": 0,
|
128 |
+
"LABEL_1": 1
|
129 |
+
},
|
130 |
+
"layer_norm_elementwise_affine": true,
|
131 |
+
"layerdrop": 0.0,
|
132 |
+
"length_penalty": 1.0,
|
133 |
+
"max_length": 20,
|
134 |
+
"max_position_embeddings": 2048,
|
135 |
+
"min_length": 0,
|
136 |
+
"model_type": "opt",
|
137 |
+
"no_repeat_ngram_size": 0,
|
138 |
+
"num_attention_heads": 32,
|
139 |
+
"num_beam_groups": 1,
|
140 |
+
"num_beams": 1,
|
141 |
+
"num_hidden_layers": 32,
|
142 |
+
"num_return_sequences": 1,
|
143 |
+
"output_attentions": false,
|
144 |
+
"output_hidden_states": false,
|
145 |
+
"output_scores": false,
|
146 |
+
"pad_token_id": 1,
|
147 |
+
"prefix": "</s>",
|
148 |
+
"problem_type": null,
|
149 |
+
"pruned_heads": {},
|
150 |
+
"remove_invalid_values": false,
|
151 |
+
"repetition_penalty": 1.0,
|
152 |
+
"return_dict": true,
|
153 |
+
"return_dict_in_generate": false,
|
154 |
+
"sep_token_id": null,
|
155 |
+
"suppress_tokens": null,
|
156 |
+
"task_specific_params": null,
|
157 |
+
"temperature": 1.0,
|
158 |
+
"tf_legacy_loss": false,
|
159 |
+
"tie_encoder_decoder": false,
|
160 |
+
"tie_word_embeddings": true,
|
161 |
+
"tokenizer_class": null,
|
162 |
+
"top_k": 50,
|
163 |
+
"top_p": 1.0,
|
164 |
+
"torch_dtype": "float16",
|
165 |
+
"torchscript": false,
|
166 |
+
"transformers_version": "4.27.0.dev0",
|
167 |
+
"typical_p": 1.0,
|
168 |
+
"use_bfloat16": false,
|
169 |
+
"use_cache": true,
|
170 |
+
"vocab_size": 50272,
|
171 |
+
"word_embed_proj_dim": 2560
|
172 |
+
},
|
173 |
+
"torch_dtype": "float32",
|
174 |
+
"transformers_version": null,
|
175 |
+
"use_decoder_only_language_model": true,
|
176 |
+
"vision_config": {
|
177 |
+
"_name_or_path": "",
|
178 |
+
"add_cross_attention": false,
|
179 |
+
"architectures": null,
|
180 |
+
"attention_dropout": 0.0,
|
181 |
+
"bad_words_ids": null,
|
182 |
+
"begin_suppress_tokens": null,
|
183 |
+
"bos_token_id": null,
|
184 |
+
"chunk_size_feed_forward": 0,
|
185 |
+
"cross_attention_hidden_size": null,
|
186 |
+
"decoder_start_token_id": null,
|
187 |
+
"diversity_penalty": 0.0,
|
188 |
+
"do_sample": false,
|
189 |
+
"dropout": 0.0,
|
190 |
+
"early_stopping": false,
|
191 |
+
"encoder_no_repeat_ngram_size": 0,
|
192 |
+
"eos_token_id": null,
|
193 |
+
"exponential_decay_length_penalty": null,
|
194 |
+
"finetuning_task": null,
|
195 |
+
"forced_bos_token_id": null,
|
196 |
+
"forced_eos_token_id": null,
|
197 |
+
"hidden_act": "gelu",
|
198 |
+
"hidden_size": 1408,
|
199 |
+
"id2label": {
|
200 |
+
"0": "LABEL_0",
|
201 |
+
"1": "LABEL_1"
|
202 |
+
},
|
203 |
+
"image_size": 224,
|
204 |
+
"initializer_factor": 1.0,
|
205 |
+
"initializer_range": 1e-10,
|
206 |
+
"intermediate_size": 6144,
|
207 |
+
"is_decoder": false,
|
208 |
+
"is_encoder_decoder": false,
|
209 |
+
"label2id": {
|
210 |
+
"LABEL_0": 0,
|
211 |
+
"LABEL_1": 1
|
212 |
+
},
|
213 |
+
"layer_norm_eps": 1e-05,
|
214 |
+
"length_penalty": 1.0,
|
215 |
+
"max_length": 20,
|
216 |
+
"min_length": 0,
|
217 |
+
"model_type": "blip_2_vision_model",
|
218 |
+
"no_repeat_ngram_size": 0,
|
219 |
+
"num_attention_heads": 16,
|
220 |
+
"num_beam_groups": 1,
|
221 |
+
"num_beams": 1,
|
222 |
+
"num_channels": 3,
|
223 |
+
"num_hidden_layers": 39,
|
224 |
+
"num_return_sequences": 1,
|
225 |
+
"output_attentions": false,
|
226 |
+
"output_hidden_states": false,
|
227 |
+
"output_scores": false,
|
228 |
+
"pad_token_id": null,
|
229 |
+
"patch_size": 14,
|
230 |
+
"prefix": null,
|
231 |
+
"problem_type": null,
|
232 |
+
"projection_dim": 512,
|
233 |
+
"pruned_heads": {},
|
234 |
+
"qkv_bias": true,
|
235 |
+
"remove_invalid_values": false,
|
236 |
+
"repetition_penalty": 1.0,
|
237 |
+
"return_dict": true,
|
238 |
+
"return_dict_in_generate": false,
|
239 |
+
"sep_token_id": null,
|
240 |
+
"suppress_tokens": null,
|
241 |
+
"task_specific_params": null,
|
242 |
+
"temperature": 1.0,
|
243 |
+
"tf_legacy_loss": false,
|
244 |
+
"tie_encoder_decoder": false,
|
245 |
+
"tie_word_embeddings": true,
|
246 |
+
"tokenizer_class": null,
|
247 |
+
"top_k": 50,
|
248 |
+
"top_p": 1.0,
|
249 |
+
"torch_dtype": null,
|
250 |
+
"torchscript": false,
|
251 |
+
"transformers_version": "4.27.0.dev0",
|
252 |
+
"typical_p": 1.0,
|
253 |
+
"use_bfloat16": false
|
254 |
+
}
|
255 |
+
}
|
pretrained_models/blip2-opt-2.7b/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/blip2-opt-2.7b/preprocessor_config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_convert_rgb": true,
|
3 |
+
"do_normalize": true,
|
4 |
+
"do_rescale": true,
|
5 |
+
"do_resize": true,
|
6 |
+
"image_mean": [
|
7 |
+
0.48145466,
|
8 |
+
0.4578275,
|
9 |
+
0.40821073
|
10 |
+
],
|
11 |
+
"image_processor_type": "BlipImageProcessor",
|
12 |
+
"image_std": [
|
13 |
+
0.26862954,
|
14 |
+
0.26130258,
|
15 |
+
0.27577711
|
16 |
+
],
|
17 |
+
"processor_class": "Blip2Processor",
|
18 |
+
"resample": 3,
|
19 |
+
"rescale_factor": 0.00392156862745098,
|
20 |
+
"size": {
|
21 |
+
"height": 224,
|
22 |
+
"width": 224
|
23 |
+
}
|
24 |
+
}
|
pretrained_models/blip2-opt-2.7b/pytorch_model-00001-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83f4604e9f2c81dace48cbbb245cbe9acadddce7471c17eedc10cd675bf9af62
|
3 |
+
size 9996239804
|
pretrained_models/blip2-opt-2.7b/pytorch_model-00002-of-00002.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b224ac0c148bf3aa0a211e5d043d38918ef57c2d3b714771a7c4b124129dbd48
|
3 |
+
size 5497724774
|
pretrained_models/blip2-opt-2.7b/pytorch_model.bin.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/blip2-opt-2.7b/special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "</s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<pad>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"unk_token": {
|
24 |
+
"content": "</s>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": true,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
}
|
30 |
+
}
|
pretrained_models/blip2-opt-2.7b/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/blip2-opt-2.7b/tokenizer_config.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"bos_token": {
|
5 |
+
"__type": "AddedToken",
|
6 |
+
"content": "</s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"eos_token": {
|
13 |
+
"__type": "AddedToken",
|
14 |
+
"content": "</s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": true,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
},
|
20 |
+
"errors": "replace",
|
21 |
+
"model_max_length": 1000000000000000019884624838656,
|
22 |
+
"pad_token": {
|
23 |
+
"__type": "AddedToken",
|
24 |
+
"content": "<pad>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": true,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"processor_class": "Blip2Processor",
|
31 |
+
"special_tokens_map_file": null,
|
32 |
+
"tokenizer_class": "GPT2Tokenizer",
|
33 |
+
"unk_token": {
|
34 |
+
"__type": "AddedToken",
|
35 |
+
"content": "</s>",
|
36 |
+
"lstrip": false,
|
37 |
+
"normalized": true,
|
38 |
+
"rstrip": false,
|
39 |
+
"single_word": false
|
40 |
+
}
|
41 |
+
}
|
pretrained_models/blip2-opt-2.7b/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/stable-diffusion-v1-5/.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
25 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
+
v1-5-pruned-emaonly.ckpt filter=lfs diff=lfs merge=lfs -text
|
35 |
+
v1-5-pruned.ckpt filter=lfs diff=lfs merge=lfs -text
|
pretrained_models/stable-diffusion-v1-5/README.md
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: creativeml-openrail-m
|
3 |
+
tags:
|
4 |
+
- stable-diffusion
|
5 |
+
- stable-diffusion-diffusers
|
6 |
+
- text-to-image
|
7 |
+
inference: true
|
8 |
+
extra_gated_prompt: |-
|
9 |
+
This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
|
10 |
+
The CreativeML OpenRAIL License specifies:
|
11 |
+
|
12 |
+
1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
|
13 |
+
2. CompVis claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
|
14 |
+
3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
|
15 |
+
Please read the full license carefully here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
|
16 |
+
|
17 |
+
extra_gated_heading: Please read the LICENSE to access this model
|
18 |
+
---
|
19 |
+
|
20 |
+
# Stable Diffusion v1-5 Model Card
|
21 |
+
|
22 |
+
Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input.
|
23 |
+
For more information about how Stable Diffusion functions, please have a look at [π€'s Stable Diffusion blog](https://huggingface.co/blog/stable_diffusion).
|
24 |
+
|
25 |
+
The **Stable-Diffusion-v1-5** checkpoint was initialized with the weights of the [Stable-Diffusion-v1-2](https:/steps/huggingface.co/CompVis/stable-diffusion-v1-2)
|
26 |
+
checkpoint and subsequently fine-tuned on 595k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
|
27 |
+
|
28 |
+
You can use this both with the [π§¨Diffusers library](https://github.com/huggingface/diffusers) and the [RunwayML GitHub repository](https://github.com/runwayml/stable-diffusion).
|
29 |
+
|
30 |
+
### Diffusers
|
31 |
+
```py
|
32 |
+
from diffusers import StableDiffusionPipeline
|
33 |
+
import torch
|
34 |
+
|
35 |
+
model_id = "runwayml/stable-diffusion-v1-5"
|
36 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
37 |
+
pipe = pipe.to("cuda")
|
38 |
+
|
39 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
40 |
+
image = pipe(prompt).images[0]
|
41 |
+
|
42 |
+
image.save("astronaut_rides_horse.png")
|
43 |
+
```
|
44 |
+
For more detailed instructions, use-cases and examples in JAX follow the instructions [here](https://github.com/huggingface/diffusers#text-to-image-generation-with-stable-diffusion)
|
45 |
+
|
46 |
+
### Original GitHub Repository
|
47 |
+
|
48 |
+
1. Download the weights
|
49 |
+
- [v1-5-pruned-emaonly.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt) - 4.27GB, ema-only weight. uses less VRAM - suitable for inference
|
50 |
+
- [v1-5-pruned.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.ckpt) - 7.7GB, ema+non-ema weights. uses more VRAM - suitable for fine-tuning
|
51 |
+
|
52 |
+
2. Follow instructions [here](https://github.com/runwayml/stable-diffusion).
|
53 |
+
|
54 |
+
## Model Details
|
55 |
+
- **Developed by:** Robin Rombach, Patrick Esser
|
56 |
+
- **Model type:** Diffusion-based text-to-image generation model
|
57 |
+
- **Language(s):** English
|
58 |
+
- **License:** [The CreativeML OpenRAIL M license](https://huggingface.co/spaces/CompVis/stable-diffusion-license) is an [Open RAIL M license](https://www.licenses.ai/blog/2022/8/18/naming-convention-of-responsible-ai-licenses), adapted from the work that [BigScience](https://bigscience.huggingface.co/) and [the RAIL Initiative](https://www.licenses.ai/) are jointly carrying in the area of responsible AI licensing. See also [the article about the BLOOM Open RAIL license](https://bigscience.huggingface.co/blog/the-bigscience-rail-license) on which our license is based.
|
59 |
+
- **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a [Latent Diffusion Model](https://arxiv.org/abs/2112.10752) that uses a fixed, pretrained text encoder ([CLIP ViT-L/14](https://arxiv.org/abs/2103.00020)) as suggested in the [Imagen paper](https://arxiv.org/abs/2205.11487).
|
60 |
+
- **Resources for more information:** [GitHub Repository](https://github.com/CompVis/stable-diffusion), [Paper](https://arxiv.org/abs/2112.10752).
|
61 |
+
- **Cite as:**
|
62 |
+
|
63 |
+
@InProceedings{Rombach_2022_CVPR,
|
64 |
+
author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
|
65 |
+
title = {High-Resolution Image Synthesis With Latent Diffusion Models},
|
66 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
67 |
+
month = {June},
|
68 |
+
year = {2022},
|
69 |
+
pages = {10684-10695}
|
70 |
+
}
|
71 |
+
|
72 |
+
# Uses
|
73 |
+
|
74 |
+
## Direct Use
|
75 |
+
The model is intended for research purposes only. Possible research areas and
|
76 |
+
tasks include
|
77 |
+
|
78 |
+
- Safe deployment of models which have the potential to generate harmful content.
|
79 |
+
- Probing and understanding the limitations and biases of generative models.
|
80 |
+
- Generation of artworks and use in design and other artistic processes.
|
81 |
+
- Applications in educational or creative tools.
|
82 |
+
- Research on generative models.
|
83 |
+
|
84 |
+
Excluded uses are described below.
|
85 |
+
|
86 |
+
### Misuse, Malicious Use, and Out-of-Scope Use
|
87 |
+
_Note: This section is taken from the [DALLE-MINI model card](https://huggingface.co/dalle-mini/dalle-mini), but applies in the same way to Stable Diffusion v1_.
|
88 |
+
|
89 |
+
|
90 |
+
The model should not be used to intentionally create or disseminate images that create hostile or alienating environments for people. This includes generating images that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.
|
91 |
+
|
92 |
+
#### Out-of-Scope Use
|
93 |
+
The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
|
94 |
+
|
95 |
+
#### Misuse and Malicious Use
|
96 |
+
Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
|
97 |
+
|
98 |
+
- Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
|
99 |
+
- Intentionally promoting or propagating discriminatory content or harmful stereotypes.
|
100 |
+
- Impersonating individuals without their consent.
|
101 |
+
- Sexual content without consent of the people who might see it.
|
102 |
+
- Mis- and disinformation
|
103 |
+
- Representations of egregious violence and gore
|
104 |
+
- Sharing of copyrighted or licensed material in violation of its terms of use.
|
105 |
+
- Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
|
106 |
+
|
107 |
+
## Limitations and Bias
|
108 |
+
|
109 |
+
### Limitations
|
110 |
+
|
111 |
+
- The model does not achieve perfect photorealism
|
112 |
+
- The model cannot render legible text
|
113 |
+
- The model does not perform well on more difficult tasks which involve compositionality, such as rendering an image corresponding to βA red cube on top of a blue sphereβ
|
114 |
+
- Faces and people in general may not be generated properly.
|
115 |
+
- The model was trained mainly with English captions and will not work as well in other languages.
|
116 |
+
- The autoencoding part of the model is lossy
|
117 |
+
- The model was trained on a large-scale dataset
|
118 |
+
[LAION-5B](https://laion.ai/blog/laion-5b/) which contains adult material
|
119 |
+
and is not fit for product use without additional safety mechanisms and
|
120 |
+
considerations.
|
121 |
+
- No additional measures were used to deduplicate the dataset. As a result, we observe some degree of memorization for images that are duplicated in the training data.
|
122 |
+
The training data can be searched at [https://rom1504.github.io/clip-retrieval/](https://rom1504.github.io/clip-retrieval/) to possibly assist in the detection of memorized images.
|
123 |
+
|
124 |
+
### Bias
|
125 |
+
|
126 |
+
While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
|
127 |
+
Stable Diffusion v1 was trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),
|
128 |
+
which consists of images that are primarily limited to English descriptions.
|
129 |
+
Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.
|
130 |
+
This affects the overall output of the model, as white and western cultures are often set as the default. Further, the
|
131 |
+
ability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.
|
132 |
+
|
133 |
+
### Safety Module
|
134 |
+
|
135 |
+
The intended use of this model is with the [Safety Checker](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py) in Diffusers.
|
136 |
+
This checker works by checking model outputs against known hard-coded NSFW concepts.
|
137 |
+
The concepts are intentionally hidden to reduce the likelihood of reverse-engineering this filter.
|
138 |
+
Specifically, the checker compares the class probability of harmful concepts in the embedding space of the `CLIPTextModel` *after generation* of the images.
|
139 |
+
The concepts are passed into the model with the generated image and compared to a hand-engineered weight for each NSFW concept.
|
140 |
+
|
141 |
+
|
142 |
+
## Training
|
143 |
+
|
144 |
+
**Training Data**
|
145 |
+
The model developers used the following dataset for training the model:
|
146 |
+
|
147 |
+
- LAION-2B (en) and subsets thereof (see next section)
|
148 |
+
|
149 |
+
**Training Procedure**
|
150 |
+
Stable Diffusion v1-5 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,
|
151 |
+
|
152 |
+
- Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4
|
153 |
+
- Text prompts are encoded through a ViT-L/14 text-encoder.
|
154 |
+
- The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
|
155 |
+
- The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.
|
156 |
+
|
157 |
+
Currently six Stable Diffusion checkpoints are provided, which were trained as follows.
|
158 |
+
- [`stable-diffusion-v1-1`](https://huggingface.co/CompVis/stable-diffusion-v1-1): 237,000 steps at resolution `256x256` on [laion2B-en](https://huggingface.co/datasets/laion/laion2B-en).
|
159 |
+
194,000 steps at resolution `512x512` on [laion-high-resolution](https://huggingface.co/datasets/laion/laion-high-resolution) (170M examples from LAION-5B with resolution `>= 1024x1024`).
|
160 |
+
- [`stable-diffusion-v1-2`](https://huggingface.co/CompVis/stable-diffusion-v1-2): Resumed from `stable-diffusion-v1-1`.
|
161 |
+
515,000 steps at resolution `512x512` on "laion-improved-aesthetics" (a subset of laion2B-en,
|
162 |
+
filtered to images with an original size `>= 512x512`, estimated aesthetics score `> 5.0`, and an estimated watermark probability `< 0.5`. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an [improved aesthetics estimator](https://github.com/christophschuhmann/improved-aesthetic-predictor)).
|
163 |
+
- [`stable-diffusion-v1-3`](https://huggingface.co/CompVis/stable-diffusion-v1-3): Resumed from `stable-diffusion-v1-2` - 195,000 steps at resolution `512x512` on "laion-improved-aesthetics" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
|
164 |
+
- [`stable-diffusion-v1-4`](https://huggingface.co/CompVis/stable-diffusion-v1-4) Resumed from `stable-diffusion-v1-2` - 225,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
|
165 |
+
- [`stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5) Resumed from `stable-diffusion-v1-2` - 595,000 steps at resolution `512x512` on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to improve [classifier-free guidance sampling](https://arxiv.org/abs/2207.12598).
|
166 |
+
- [`stable-diffusion-inpainting`](https://huggingface.co/runwayml/stable-diffusion-inpainting) Resumed from `stable-diffusion-v1-5` - then 440,000 steps of inpainting training at resolution 512x512 on βlaion-aesthetics v2 5+β and 10% dropping of the text-conditioning. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask itself) whose weights were zero-initialized after restoring the non-inpainting checkpoint. During training, we generate synthetic masks and in 25% mask everything.
|
167 |
+
|
168 |
+
- **Hardware:** 32 x 8 x A100 GPUs
|
169 |
+
- **Optimizer:** AdamW
|
170 |
+
- **Gradient Accumulations**: 2
|
171 |
+
- **Batch:** 32 x 8 x 2 x 4 = 2048
|
172 |
+
- **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant
|
173 |
+
|
174 |
+
## Evaluation Results
|
175 |
+
Evaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,
|
176 |
+
5.0, 6.0, 7.0, 8.0) and 50 PNDM/PLMS sampling
|
177 |
+
steps show the relative improvements of the checkpoints:
|
178 |
+
|
179 |
+
![pareto](https://huggingface.co/CompVis/stable-diffusion/resolve/main/v1-1-to-v1-5.png)
|
180 |
+
|
181 |
+
Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.
|
182 |
+
## Environmental Impact
|
183 |
+
|
184 |
+
**Stable Diffusion v1** **Estimated Emissions**
|
185 |
+
Based on that information, we estimate the following CO2 emissions using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.
|
186 |
+
|
187 |
+
- **Hardware Type:** A100 PCIe 40GB
|
188 |
+
- **Hours used:** 150000
|
189 |
+
- **Cloud Provider:** AWS
|
190 |
+
- **Compute Region:** US-east
|
191 |
+
- **Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid):** 11250 kg CO2 eq.
|
192 |
+
|
193 |
+
|
194 |
+
## Citation
|
195 |
+
|
196 |
+
```bibtex
|
197 |
+
@InProceedings{Rombach_2022_CVPR,
|
198 |
+
author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
|
199 |
+
title = {High-Resolution Image Synthesis With Latent Diffusion Models},
|
200 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
201 |
+
month = {June},
|
202 |
+
year = {2022},
|
203 |
+
pages = {10684-10695}
|
204 |
+
}
|
205 |
+
```
|
206 |
+
|
207 |
+
*This model card was written by: Robin Rombach and Patrick Esser and is based on the [DALL-E Mini model card](https://huggingface.co/dalle-mini/dalle-mini).*
|
pretrained_models/stable-diffusion-v1-5/feature_extractor/preprocessor_config.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"crop_size": 224,
|
3 |
+
"do_center_crop": true,
|
4 |
+
"do_convert_rgb": true,
|
5 |
+
"do_normalize": true,
|
6 |
+
"do_resize": true,
|
7 |
+
"feature_extractor_type": "CLIPFeatureExtractor",
|
8 |
+
"image_mean": [
|
9 |
+
0.48145466,
|
10 |
+
0.4578275,
|
11 |
+
0.40821073
|
12 |
+
],
|
13 |
+
"image_std": [
|
14 |
+
0.26862954,
|
15 |
+
0.26130258,
|
16 |
+
0.27577711
|
17 |
+
],
|
18 |
+
"resample": 3,
|
19 |
+
"size": 224
|
20 |
+
}
|
pretrained_models/stable-diffusion-v1-5/model_index.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "StableDiffusionPipeline",
|
3 |
+
"_diffusers_version": "0.6.0",
|
4 |
+
"feature_extractor": [
|
5 |
+
"transformers",
|
6 |
+
"CLIPFeatureExtractor"
|
7 |
+
],
|
8 |
+
"safety_checker": [
|
9 |
+
"stable_diffusion",
|
10 |
+
"StableDiffusionSafetyChecker"
|
11 |
+
],
|
12 |
+
"scheduler": [
|
13 |
+
"diffusers",
|
14 |
+
"PNDMScheduler"
|
15 |
+
],
|
16 |
+
"text_encoder": [
|
17 |
+
"transformers",
|
18 |
+
"CLIPTextModel"
|
19 |
+
],
|
20 |
+
"tokenizer": [
|
21 |
+
"transformers",
|
22 |
+
"CLIPTokenizer"
|
23 |
+
],
|
24 |
+
"unet": [
|
25 |
+
"diffusers",
|
26 |
+
"UNet2DConditionModel"
|
27 |
+
],
|
28 |
+
"vae": [
|
29 |
+
"diffusers",
|
30 |
+
"AutoencoderKL"
|
31 |
+
]
|
32 |
+
}
|
pretrained_models/stable-diffusion-v1-5/safety_checker/config.json
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_commit_hash": "4bb648a606ef040e7685bde262611766a5fdd67b",
|
3 |
+
"_name_or_path": "CompVis/stable-diffusion-safety-checker",
|
4 |
+
"architectures": [
|
5 |
+
"StableDiffusionSafetyChecker"
|
6 |
+
],
|
7 |
+
"initializer_factor": 1.0,
|
8 |
+
"logit_scale_init_value": 2.6592,
|
9 |
+
"model_type": "clip",
|
10 |
+
"projection_dim": 768,
|
11 |
+
"text_config": {
|
12 |
+
"_name_or_path": "",
|
13 |
+
"add_cross_attention": false,
|
14 |
+
"architectures": null,
|
15 |
+
"attention_dropout": 0.0,
|
16 |
+
"bad_words_ids": null,
|
17 |
+
"bos_token_id": 0,
|
18 |
+
"chunk_size_feed_forward": 0,
|
19 |
+
"cross_attention_hidden_size": null,
|
20 |
+
"decoder_start_token_id": null,
|
21 |
+
"diversity_penalty": 0.0,
|
22 |
+
"do_sample": false,
|
23 |
+
"dropout": 0.0,
|
24 |
+
"early_stopping": false,
|
25 |
+
"encoder_no_repeat_ngram_size": 0,
|
26 |
+
"eos_token_id": 2,
|
27 |
+
"exponential_decay_length_penalty": null,
|
28 |
+
"finetuning_task": null,
|
29 |
+
"forced_bos_token_id": null,
|
30 |
+
"forced_eos_token_id": null,
|
31 |
+
"hidden_act": "quick_gelu",
|
32 |
+
"hidden_size": 768,
|
33 |
+
"id2label": {
|
34 |
+
"0": "LABEL_0",
|
35 |
+
"1": "LABEL_1"
|
36 |
+
},
|
37 |
+
"initializer_factor": 1.0,
|
38 |
+
"initializer_range": 0.02,
|
39 |
+
"intermediate_size": 3072,
|
40 |
+
"is_decoder": false,
|
41 |
+
"is_encoder_decoder": false,
|
42 |
+
"label2id": {
|
43 |
+
"LABEL_0": 0,
|
44 |
+
"LABEL_1": 1
|
45 |
+
},
|
46 |
+
"layer_norm_eps": 1e-05,
|
47 |
+
"length_penalty": 1.0,
|
48 |
+
"max_length": 20,
|
49 |
+
"max_position_embeddings": 77,
|
50 |
+
"min_length": 0,
|
51 |
+
"model_type": "clip_text_model",
|
52 |
+
"no_repeat_ngram_size": 0,
|
53 |
+
"num_attention_heads": 12,
|
54 |
+
"num_beam_groups": 1,
|
55 |
+
"num_beams": 1,
|
56 |
+
"num_hidden_layers": 12,
|
57 |
+
"num_return_sequences": 1,
|
58 |
+
"output_attentions": false,
|
59 |
+
"output_hidden_states": false,
|
60 |
+
"output_scores": false,
|
61 |
+
"pad_token_id": 1,
|
62 |
+
"prefix": null,
|
63 |
+
"problem_type": null,
|
64 |
+
"pruned_heads": {},
|
65 |
+
"remove_invalid_values": false,
|
66 |
+
"repetition_penalty": 1.0,
|
67 |
+
"return_dict": true,
|
68 |
+
"return_dict_in_generate": false,
|
69 |
+
"sep_token_id": null,
|
70 |
+
"task_specific_params": null,
|
71 |
+
"temperature": 1.0,
|
72 |
+
"tf_legacy_loss": false,
|
73 |
+
"tie_encoder_decoder": false,
|
74 |
+
"tie_word_embeddings": true,
|
75 |
+
"tokenizer_class": null,
|
76 |
+
"top_k": 50,
|
77 |
+
"top_p": 1.0,
|
78 |
+
"torch_dtype": null,
|
79 |
+
"torchscript": false,
|
80 |
+
"transformers_version": "4.22.0.dev0",
|
81 |
+
"typical_p": 1.0,
|
82 |
+
"use_bfloat16": false,
|
83 |
+
"vocab_size": 49408
|
84 |
+
},
|
85 |
+
"text_config_dict": {
|
86 |
+
"hidden_size": 768,
|
87 |
+
"intermediate_size": 3072,
|
88 |
+
"num_attention_heads": 12,
|
89 |
+
"num_hidden_layers": 12
|
90 |
+
},
|
91 |
+
"torch_dtype": "float32",
|
92 |
+
"transformers_version": null,
|
93 |
+
"vision_config": {
|
94 |
+
"_name_or_path": "",
|
95 |
+
"add_cross_attention": false,
|
96 |
+
"architectures": null,
|
97 |
+
"attention_dropout": 0.0,
|
98 |
+
"bad_words_ids": null,
|
99 |
+
"bos_token_id": null,
|
100 |
+
"chunk_size_feed_forward": 0,
|
101 |
+
"cross_attention_hidden_size": null,
|
102 |
+
"decoder_start_token_id": null,
|
103 |
+
"diversity_penalty": 0.0,
|
104 |
+
"do_sample": false,
|
105 |
+
"dropout": 0.0,
|
106 |
+
"early_stopping": false,
|
107 |
+
"encoder_no_repeat_ngram_size": 0,
|
108 |
+
"eos_token_id": null,
|
109 |
+
"exponential_decay_length_penalty": null,
|
110 |
+
"finetuning_task": null,
|
111 |
+
"forced_bos_token_id": null,
|
112 |
+
"forced_eos_token_id": null,
|
113 |
+
"hidden_act": "quick_gelu",
|
114 |
+
"hidden_size": 1024,
|
115 |
+
"id2label": {
|
116 |
+
"0": "LABEL_0",
|
117 |
+
"1": "LABEL_1"
|
118 |
+
},
|
119 |
+
"image_size": 224,
|
120 |
+
"initializer_factor": 1.0,
|
121 |
+
"initializer_range": 0.02,
|
122 |
+
"intermediate_size": 4096,
|
123 |
+
"is_decoder": false,
|
124 |
+
"is_encoder_decoder": false,
|
125 |
+
"label2id": {
|
126 |
+
"LABEL_0": 0,
|
127 |
+
"LABEL_1": 1
|
128 |
+
},
|
129 |
+
"layer_norm_eps": 1e-05,
|
130 |
+
"length_penalty": 1.0,
|
131 |
+
"max_length": 20,
|
132 |
+
"min_length": 0,
|
133 |
+
"model_type": "clip_vision_model",
|
134 |
+
"no_repeat_ngram_size": 0,
|
135 |
+
"num_attention_heads": 16,
|
136 |
+
"num_beam_groups": 1,
|
137 |
+
"num_beams": 1,
|
138 |
+
"num_channels": 3,
|
139 |
+
"num_hidden_layers": 24,
|
140 |
+
"num_return_sequences": 1,
|
141 |
+
"output_attentions": false,
|
142 |
+
"output_hidden_states": false,
|
143 |
+
"output_scores": false,
|
144 |
+
"pad_token_id": null,
|
145 |
+
"patch_size": 14,
|
146 |
+
"prefix": null,
|
147 |
+
"problem_type": null,
|
148 |
+
"pruned_heads": {},
|
149 |
+
"remove_invalid_values": false,
|
150 |
+
"repetition_penalty": 1.0,
|
151 |
+
"return_dict": true,
|
152 |
+
"return_dict_in_generate": false,
|
153 |
+
"sep_token_id": null,
|
154 |
+
"task_specific_params": null,
|
155 |
+
"temperature": 1.0,
|
156 |
+
"tf_legacy_loss": false,
|
157 |
+
"tie_encoder_decoder": false,
|
158 |
+
"tie_word_embeddings": true,
|
159 |
+
"tokenizer_class": null,
|
160 |
+
"top_k": 50,
|
161 |
+
"top_p": 1.0,
|
162 |
+
"torch_dtype": null,
|
163 |
+
"torchscript": false,
|
164 |
+
"transformers_version": "4.22.0.dev0",
|
165 |
+
"typical_p": 1.0,
|
166 |
+
"use_bfloat16": false
|
167 |
+
},
|
168 |
+
"vision_config_dict": {
|
169 |
+
"hidden_size": 1024,
|
170 |
+
"intermediate_size": 4096,
|
171 |
+
"num_attention_heads": 16,
|
172 |
+
"num_hidden_layers": 24,
|
173 |
+
"patch_size": 14
|
174 |
+
}
|
175 |
+
}
|
pretrained_models/stable-diffusion-v1-5/safety_checker/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d6a233ff6fd5ccb9f76fd99618d73369c52dd3d8222376384d0e601911089e8
|
3 |
+
size 1215981830
|
pretrained_models/stable-diffusion-v1-5/safety_checker/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:193490b58ef62739077262e833bf091c66c29488058681ac25cf7df3d8190974
|
3 |
+
size 1216061799
|
pretrained_models/stable-diffusion-v1-5/scheduler/scheduler_config.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "PNDMScheduler",
|
3 |
+
"_diffusers_version": "0.6.0",
|
4 |
+
"beta_end": 0.012,
|
5 |
+
"beta_schedule": "scaled_linear",
|
6 |
+
"beta_start": 0.00085,
|
7 |
+
"num_train_timesteps": 1000,
|
8 |
+
"set_alpha_to_one": false,
|
9 |
+
"skip_prk_steps": true,
|
10 |
+
"steps_offset": 1,
|
11 |
+
"trained_betas": null,
|
12 |
+
"clip_sample": false
|
13 |
+
}
|
pretrained_models/stable-diffusion-v1-5/text_encoder/config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "openai/clip-vit-large-patch14",
|
3 |
+
"architectures": [
|
4 |
+
"CLIPTextModel"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"dropout": 0.0,
|
9 |
+
"eos_token_id": 2,
|
10 |
+
"hidden_act": "quick_gelu",
|
11 |
+
"hidden_size": 768,
|
12 |
+
"initializer_factor": 1.0,
|
13 |
+
"initializer_range": 0.02,
|
14 |
+
"intermediate_size": 3072,
|
15 |
+
"layer_norm_eps": 1e-05,
|
16 |
+
"max_position_embeddings": 77,
|
17 |
+
"model_type": "clip_text_model",
|
18 |
+
"num_attention_heads": 12,
|
19 |
+
"num_hidden_layers": 12,
|
20 |
+
"pad_token_id": 1,
|
21 |
+
"projection_dim": 768,
|
22 |
+
"torch_dtype": "float32",
|
23 |
+
"transformers_version": "4.22.0.dev0",
|
24 |
+
"vocab_size": 49408
|
25 |
+
}
|
pretrained_models/stable-diffusion-v1-5/text_encoder/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d008943c017f0092921106440254dbbe00b6a285f7883ec8ba160c3faad88334
|
3 |
+
size 492265874
|
pretrained_models/stable-diffusion-v1-5/text_encoder/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:770a47a9ffdcfda0b05506a7888ed714d06131d60267e6cf52765d61cf59fd67
|
3 |
+
size 492305335
|
pretrained_models/stable-diffusion-v1-5/tokenizer/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/stable-diffusion-v1-5/tokenizer/special_tokens_map.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|startoftext|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|endoftext|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": "<|endoftext|>",
|
17 |
+
"unk_token": {
|
18 |
+
"content": "<|endoftext|>",
|
19 |
+
"lstrip": false,
|
20 |
+
"normalized": true,
|
21 |
+
"rstrip": false,
|
22 |
+
"single_word": false
|
23 |
+
}
|
24 |
+
}
|
pretrained_models/stable-diffusion-v1-5/tokenizer/tokenizer_config.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"bos_token": {
|
4 |
+
"__type": "AddedToken",
|
5 |
+
"content": "<|startoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": true,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false
|
10 |
+
},
|
11 |
+
"do_lower_case": true,
|
12 |
+
"eos_token": {
|
13 |
+
"__type": "AddedToken",
|
14 |
+
"content": "<|endoftext|>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": true,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
},
|
20 |
+
"errors": "replace",
|
21 |
+
"model_max_length": 77,
|
22 |
+
"name_or_path": "openai/clip-vit-large-patch14",
|
23 |
+
"pad_token": "<|endoftext|>",
|
24 |
+
"special_tokens_map_file": "./special_tokens_map.json",
|
25 |
+
"tokenizer_class": "CLIPTokenizer",
|
26 |
+
"unk_token": {
|
27 |
+
"__type": "AddedToken",
|
28 |
+
"content": "<|endoftext|>",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": true,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false
|
33 |
+
}
|
34 |
+
}
|
pretrained_models/stable-diffusion-v1-5/tokenizer/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pretrained_models/stable-diffusion-v1-5/unet/config.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "UNet2DConditionModel",
|
3 |
+
"_diffusers_version": "0.6.0",
|
4 |
+
"act_fn": "silu",
|
5 |
+
"attention_head_dim": 8,
|
6 |
+
"block_out_channels": [
|
7 |
+
320,
|
8 |
+
640,
|
9 |
+
1280,
|
10 |
+
1280
|
11 |
+
],
|
12 |
+
"center_input_sample": false,
|
13 |
+
"cross_attention_dim": 768,
|
14 |
+
"down_block_types": [
|
15 |
+
"CrossAttnDownBlock2D",
|
16 |
+
"CrossAttnDownBlock2D",
|
17 |
+
"CrossAttnDownBlock2D",
|
18 |
+
"DownBlock2D"
|
19 |
+
],
|
20 |
+
"downsample_padding": 1,
|
21 |
+
"flip_sin_to_cos": true,
|
22 |
+
"freq_shift": 0,
|
23 |
+
"in_channels": 4,
|
24 |
+
"layers_per_block": 2,
|
25 |
+
"mid_block_scale_factor": 1,
|
26 |
+
"norm_eps": 1e-05,
|
27 |
+
"norm_num_groups": 32,
|
28 |
+
"out_channels": 4,
|
29 |
+
"sample_size": 64,
|
30 |
+
"up_block_types": [
|
31 |
+
"UpBlock2D",
|
32 |
+
"CrossAttnUpBlock2D",
|
33 |
+
"CrossAttnUpBlock2D",
|
34 |
+
"CrossAttnUpBlock2D"
|
35 |
+
]
|
36 |
+
}
|
pretrained_models/stable-diffusion-v1-5/unet/diffusion_pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c7da0e21ba7ea50637bee26e81c220844defdf01aafca02b2c42ecdadb813de4
|
3 |
+
size 3438354725
|
pretrained_models/stable-diffusion-v1-5/unet/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:19da7aaa4b880e59d56843f1fcb4dd9b599c28a1d9d9af7c1143057c8ffae9f1
|
3 |
+
size 3438167540
|
pretrained_models/stable-diffusion-v1-5/v1-5-pruned-emaonly.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cc6cb27103417325ff94f52b7a5d2dde45a7515b25c255d8e396c90014281516
|
3 |
+
size 4265380512
|
pretrained_models/stable-diffusion-v1-5/v1-5-pruned-emaonly.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
|
3 |
+
size 4265146304
|
pretrained_models/stable-diffusion-v1-5/v1-5-pruned.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e1441589a6f3c5a53f5f54d0975a18a7feb7cdf0b0dee276dfc3331ae376a053
|
3 |
+
size 7703807346
|
pretrained_models/stable-diffusion-v1-5/v1-5-pruned.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1a189f0be69d6106a48548e7626207dddd7042a418dbf372cefd05e0cdba61b6
|
3 |
+
size 7703324286
|
pretrained_models/stable-diffusion-v1-5/v1-inference.yaml
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
model:
|
2 |
+
base_learning_rate: 1.0e-04
|
3 |
+
target: ldm.models.diffusion.ddpm.LatentDiffusion
|
4 |
+
params:
|
5 |
+
linear_start: 0.00085
|
6 |
+
linear_end: 0.0120
|
7 |
+
num_timesteps_cond: 1
|
8 |
+
log_every_t: 200
|
9 |
+
timesteps: 1000
|
10 |
+
first_stage_key: "jpg"
|
11 |
+
cond_stage_key: "txt"
|
12 |
+
image_size: 64
|
13 |
+
channels: 4
|
14 |
+
cond_stage_trainable: false # Note: different from the one we trained before
|
15 |
+
conditioning_key: crossattn
|
16 |
+
monitor: val/loss_simple_ema
|
17 |
+
scale_factor: 0.18215
|
18 |
+
use_ema: False
|
19 |
+
|
20 |
+
scheduler_config: # 10000 warmup steps
|
21 |
+
target: ldm.lr_scheduler.LambdaLinearScheduler
|
22 |
+
params:
|
23 |
+
warm_up_steps: [ 10000 ]
|
24 |
+
cycle_lengths: [ 10000000000000 ] # incredibly large number to prevent corner cases
|
25 |
+
f_start: [ 1.e-6 ]
|
26 |
+
f_max: [ 1. ]
|
27 |
+
f_min: [ 1. ]
|
28 |
+
|
29 |
+
unet_config:
|
30 |
+
target: ldm.modules.diffusionmodules.openaimodel.UNetModel
|
31 |
+
params:
|
32 |
+
image_size: 32 # unused
|
33 |
+
in_channels: 4
|
34 |
+
out_channels: 4
|
35 |
+
model_channels: 320
|
36 |
+
attention_resolutions: [ 4, 2, 1 ]
|
37 |
+
num_res_blocks: 2
|
38 |
+
channel_mult: [ 1, 2, 4, 4 ]
|
39 |
+
num_heads: 8
|
40 |
+
use_spatial_transformer: True
|
41 |
+
transformer_depth: 1
|
42 |
+
context_dim: 768
|
43 |
+
use_checkpoint: True
|
44 |
+
legacy: False
|
45 |
+
|
46 |
+
first_stage_config:
|
47 |
+
target: ldm.models.autoencoder.AutoencoderKL
|
48 |
+
params:
|
49 |
+
embed_dim: 4
|
50 |
+
monitor: val/rec_loss
|
51 |
+
ddconfig:
|
52 |
+
double_z: true
|
53 |
+
z_channels: 4
|
54 |
+
resolution: 256
|
55 |
+
in_channels: 3
|
56 |
+
out_ch: 3
|
57 |
+
ch: 128
|
58 |
+
ch_mult:
|
59 |
+
- 1
|
60 |
+
- 2
|
61 |
+
- 4
|
62 |
+
- 4
|
63 |
+
num_res_blocks: 2
|
64 |
+
attn_resolutions: []
|
65 |
+
dropout: 0.0
|
66 |
+
lossconfig:
|
67 |
+
target: torch.nn.Identity
|
68 |
+
|
69 |
+
cond_stage_config:
|
70 |
+
target: ldm.modules.encoders.modules.FrozenCLIPEmbedder
|
pretrained_models/stable-diffusion-v1-5/vae/config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "AutoencoderKL",
|
3 |
+
"_diffusers_version": "0.6.0",
|
4 |
+
"act_fn": "silu",
|
5 |
+
"block_out_channels": [
|
6 |
+
128,
|
7 |
+
256,
|
8 |
+
512,
|
9 |
+
512
|
10 |
+
],
|
11 |
+
"down_block_types": [
|
12 |
+
"DownEncoderBlock2D",
|
13 |
+
"DownEncoderBlock2D",
|
14 |
+
"DownEncoderBlock2D",
|
15 |
+
"DownEncoderBlock2D"
|
16 |
+
],
|
17 |
+
"in_channels": 3,
|
18 |
+
"latent_channels": 4,
|
19 |
+
"layers_per_block": 2,
|
20 |
+
"norm_num_groups": 32,
|
21 |
+
"out_channels": 3,
|
22 |
+
"sample_size": 512,
|
23 |
+
"up_block_types": [
|
24 |
+
"UpDecoderBlock2D",
|
25 |
+
"UpDecoderBlock2D",
|
26 |
+
"UpDecoderBlock2D",
|
27 |
+
"UpDecoderBlock2D"
|
28 |
+
]
|
29 |
+
}
|
pretrained_models/stable-diffusion-v1-5/vae/diffusion_pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1b134cded8eb78b184aefb8805b6b572f36fa77b255c483665dda931fa0130c5
|
3 |
+
size 334707217
|
pretrained_models/stable-diffusion-v1-5/vae/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a2b5134f4dbc140d9c11f11cba3233099e00af40f262f136c691fb7d38d2194c
|
3 |
+
size 334643276
|