Update README.md
Browse files
README.md
CHANGED
@@ -1,198 +1,96 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
99 |
-
|
100 |
-
[More Information Needed]
|
101 |
-
|
102 |
-
## Evaluation
|
103 |
-
|
104 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
105 |
-
|
106 |
-
### Testing Data, Factors & Metrics
|
107 |
-
|
108 |
-
#### Testing Data
|
109 |
-
|
110 |
-
<!-- This should link to a Dataset Card if possible. -->
|
111 |
-
|
112 |
-
[More Information Needed]
|
113 |
-
|
114 |
-
#### Factors
|
115 |
-
|
116 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
117 |
-
|
118 |
-
[More Information Needed]
|
119 |
-
|
120 |
-
#### Metrics
|
121 |
-
|
122 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
123 |
-
|
124 |
-
[More Information Needed]
|
125 |
-
|
126 |
-
### Results
|
127 |
-
|
128 |
-
[More Information Needed]
|
129 |
-
|
130 |
-
#### Summary
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
## Model Examination [optional]
|
135 |
-
|
136 |
-
<!-- Relevant interpretability work for the model goes here -->
|
137 |
-
|
138 |
-
[More Information Needed]
|
139 |
-
|
140 |
-
## Environmental Impact
|
141 |
-
|
142 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
143 |
-
|
144 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
145 |
-
|
146 |
-
- **Hardware Type:** [More Information Needed]
|
147 |
-
- **Hours used:** [More Information Needed]
|
148 |
-
- **Cloud Provider:** [More Information Needed]
|
149 |
-
- **Compute Region:** [More Information Needed]
|
150 |
-
- **Carbon Emitted:** [More Information Needed]
|
151 |
-
|
152 |
-
## Technical Specifications [optional]
|
153 |
-
|
154 |
-
### Model Architecture and Objective
|
155 |
-
|
156 |
-
[More Information Needed]
|
157 |
-
|
158 |
-
### Compute Infrastructure
|
159 |
-
|
160 |
-
[More Information Needed]
|
161 |
-
|
162 |
-
#### Hardware
|
163 |
-
|
164 |
-
[More Information Needed]
|
165 |
-
|
166 |
-
#### Software
|
167 |
-
|
168 |
-
[More Information Needed]
|
169 |
-
|
170 |
-
## Citation [optional]
|
171 |
-
|
172 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
173 |
-
|
174 |
-
**BibTeX:**
|
175 |
-
|
176 |
-
[More Information Needed]
|
177 |
-
|
178 |
-
**APA:**
|
179 |
-
|
180 |
-
[More Information Needed]
|
181 |
-
|
182 |
-
## Glossary [optional]
|
183 |
-
|
184 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
185 |
-
|
186 |
-
[More Information Needed]
|
187 |
-
|
188 |
-
## More Information [optional]
|
189 |
-
|
190 |
-
[More Information Needed]
|
191 |
-
|
192 |
-
## Model Card Authors [optional]
|
193 |
-
|
194 |
-
[More Information Needed]
|
195 |
-
|
196 |
-
## Model Card Contact
|
197 |
-
|
198 |
-
[More Information Needed]
|
|
|
1 |
+
created using the following code based on https://github.com/huggingface/diffusers/blob/main/tests/pipelines/hidream/test_pipeline_hidream.py
|
2 |
+
|
3 |
+
```python
|
4 |
+
import numpy as np
|
5 |
+
import torch
|
6 |
+
from transformers import (
|
7 |
+
AutoTokenizer,
|
8 |
+
CLIPTextConfig,
|
9 |
+
CLIPTextModelWithProjection,
|
10 |
+
CLIPTokenizer,
|
11 |
+
LlamaForCausalLM,
|
12 |
+
T5EncoderModel,
|
13 |
+
)
|
14 |
+
|
15 |
+
from diffusers import (
|
16 |
+
AutoencoderKL,
|
17 |
+
FlowMatchEulerDiscreteScheduler,
|
18 |
+
HiDreamImagePipeline,
|
19 |
+
HiDreamImageTransformer2DModel,
|
20 |
+
)
|
21 |
+
def get_dummy_components():
|
22 |
+
torch.manual_seed(0)
|
23 |
+
transformer = HiDreamImageTransformer2DModel(
|
24 |
+
patch_size=2,
|
25 |
+
in_channels=4,
|
26 |
+
out_channels=4,
|
27 |
+
num_layers=1,
|
28 |
+
num_single_layers=1,
|
29 |
+
attention_head_dim=8,
|
30 |
+
num_attention_heads=4,
|
31 |
+
caption_channels=[32, 16],
|
32 |
+
text_emb_dim=64,
|
33 |
+
num_routed_experts=4,
|
34 |
+
num_activated_experts=2,
|
35 |
+
axes_dims_rope=(4, 2, 2),
|
36 |
+
max_resolution=(32, 32),
|
37 |
+
llama_layers=(0, 1),
|
38 |
+
).eval()
|
39 |
+
torch.manual_seed(0)
|
40 |
+
vae = AutoencoderKL(scaling_factor=0.3611, shift_factor=0.1159)
|
41 |
+
clip_text_encoder_config = CLIPTextConfig(
|
42 |
+
bos_token_id=0,
|
43 |
+
eos_token_id=2,
|
44 |
+
hidden_size=32,
|
45 |
+
intermediate_size=37,
|
46 |
+
layer_norm_eps=1e-05,
|
47 |
+
num_attention_heads=4,
|
48 |
+
num_hidden_layers=5,
|
49 |
+
pad_token_id=1,
|
50 |
+
vocab_size=1000,
|
51 |
+
hidden_act="gelu",
|
52 |
+
projection_dim=32,
|
53 |
+
max_position_embeddings=128,
|
54 |
+
)
|
55 |
+
|
56 |
+
torch.manual_seed(0)
|
57 |
+
text_encoder = CLIPTextModelWithProjection(clip_text_encoder_config)
|
58 |
+
|
59 |
+
torch.manual_seed(0)
|
60 |
+
text_encoder_2 = CLIPTextModelWithProjection(clip_text_encoder_config)
|
61 |
+
|
62 |
+
torch.manual_seed(0)
|
63 |
+
text_encoder_3 = T5EncoderModel.from_pretrained("hf-internal-testing/tiny-random-t5")
|
64 |
+
|
65 |
+
torch.manual_seed(0)
|
66 |
+
text_encoder_4 = LlamaForCausalLM.from_pretrained("hf-internal-testing/tiny-random-LlamaForCausalLM")
|
67 |
+
text_encoder_4.generation_config.pad_token_id = 1
|
68 |
+
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
|
69 |
+
tokenizer_2 = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
|
70 |
+
tokenizer_3 = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")
|
71 |
+
tokenizer_4 = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-LlamaForCausalLM")
|
72 |
+
|
73 |
+
scheduler = FlowMatchEulerDiscreteScheduler()
|
74 |
+
|
75 |
+
components = {
|
76 |
+
"scheduler": scheduler,
|
77 |
+
"vae": vae,
|
78 |
+
"text_encoder": text_encoder,
|
79 |
+
"tokenizer": tokenizer,
|
80 |
+
"text_encoder_2": text_encoder_2,
|
81 |
+
"tokenizer_2": tokenizer_2,
|
82 |
+
"text_encoder_3": text_encoder_3,
|
83 |
+
"tokenizer_3": tokenizer_3,
|
84 |
+
"text_encoder_4": text_encoder_4,
|
85 |
+
"tokenizer_4": tokenizer_4,
|
86 |
+
"transformer": transformer,
|
87 |
+
}
|
88 |
+
return components
|
89 |
+
|
90 |
+
|
91 |
+
if __name__ == "__main__":
|
92 |
+
components = get_dummy_components()
|
93 |
+
pipeline = HiDreamImagePipeline(**components)
|
94 |
+
pipeline.push_to_hub("hf-internal-testing/tiny-hidream-i1-pipe")
|
95 |
+
|
96 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|