amd
/

Text-to-Image
Diffusers
Safetensors
art
akasharidas commited on
Commit
caee858
·
verified ·
1 Parent(s): e362f06

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
model_index.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "EspressoDiTPipeline",
3
+ "_diffusers_version": "0.33.1",
4
+ "_name_or_path": "amd/Espresso-0.6B",
5
+ "scheduler": [
6
+ "diffusers",
7
+ "FlowMatchEulerDiscreteScheduler"
8
+ ],
9
+ "text_encoder": [
10
+ "transformers",
11
+ "LlamaForCausalLM"
12
+ ],
13
+ "tokenizer": [
14
+ "transformers",
15
+ "PreTrainedTokenizerFast"
16
+ ],
17
+ "transformer": [
18
+ "transformer",
19
+ "EspressoDiTModel"
20
+ ],
21
+ "vae": [
22
+ "diffusers",
23
+ "AutoencoderDC"
24
+ ]
25
+ }
pipeline.py ADDED
@@ -0,0 +1,749 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Modifications Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import html
17
+ import inspect
18
+ import re
19
+ import urllib.parse as ul
20
+ from typing import Callable, List, Optional, Tuple, Union
21
+
22
+ import torch
23
+ from diffusers.image_processor import PixArtImageProcessor
24
+ from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
25
+ from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import (
26
+ retrieve_timesteps,
27
+ )
28
+ from diffusers.utils import (
29
+ BACKENDS_MAPPING,
30
+ deprecate,
31
+ is_bs4_available,
32
+ is_ftfy_available,
33
+ logging,
34
+ )
35
+ from diffusers.utils.torch_utils import randn_tensor
36
+
37
+ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
38
+
39
+ if is_bs4_available():
40
+ from bs4 import BeautifulSoup
41
+
42
+ if is_ftfy_available():
43
+ import ftfy
44
+
45
+
46
+ # Modified from: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py
47
+ class EspressoDiTPipeline(DiffusionPipeline):
48
+
49
+ bad_punct_regex = re.compile(
50
+ r"["
51
+ + "#®•©™&@·º½¾¿¡§~"
52
+ + r"\)"
53
+ + r"\("
54
+ + r"\]"
55
+ + r"\["
56
+ + r"\}"
57
+ + r"\{"
58
+ + r"\|"
59
+ + "\\"
60
+ + r"\/"
61
+ + r"\*"
62
+ + r"]{1,}"
63
+ ) # noqa
64
+
65
+ _optional_components = ["tokenizer", "text_encoder"]
66
+ model_cpu_offload_seq = "text_encoder->transformer->vae"
67
+
68
+ def __init__(
69
+ self,
70
+ tokenizer,
71
+ text_encoder,
72
+ vae,
73
+ transformer,
74
+ scheduler,
75
+ ):
76
+ super().__init__()
77
+
78
+ self.register_modules(
79
+ tokenizer=tokenizer,
80
+ text_encoder=text_encoder,
81
+ vae=vae,
82
+ transformer=transformer,
83
+ scheduler=scheduler,
84
+ )
85
+
86
+ self.vae_scale_factor = 32 # TODO
87
+ self.image_processor = PixArtImageProcessor(vae_scale_factor=self.vae_scale_factor)
88
+
89
+ # Adapted from diffusers.pipelines.deepfloyd_if.pipeline_if.encode_prompt
90
+ def encode_prompt(
91
+ self,
92
+ prompt: Union[str, List[str]],
93
+ do_classifier_free_guidance: bool = True,
94
+ negative_prompt: str = "",
95
+ num_images_per_prompt: int = 1,
96
+ device: Optional[torch.device] = None,
97
+ prompt_embeds: Optional[torch.Tensor] = None,
98
+ negative_prompt_embeds: Optional[torch.Tensor] = None,
99
+ prompt_attention_mask: Optional[torch.Tensor] = None,
100
+ negative_prompt_attention_mask: Optional[torch.Tensor] = None,
101
+ clean_caption: bool = False,
102
+ max_sequence_length: int = 256,
103
+ **kwargs,
104
+ ):
105
+ r"""
106
+ Encodes the prompt into text encoder hidden states.
107
+ Args:
108
+ prompt (`str` or `List[str]`, *optional*):
109
+ prompt to be encoded
110
+ negative_prompt (`str` or `List[str]`, *optional*):
111
+ The prompt not to guide the image generation. If not defined, one has to pass `negative_prompt_embeds`
112
+ instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is less than `1`). For
113
+ PixArt-Alpha, this should be "".
114
+ do_classifier_free_guidance (`bool`, *optional*, defaults to `True`):
115
+ whether to use classifier free guidance or not
116
+ num_images_per_prompt (`int`, *optional*, defaults to 1):
117
+ number of images that should be generated per prompt
118
+ device: (`torch.device`, *optional*):
119
+ torch device to place the resulting embeddings on
120
+ prompt_embeds (`torch.Tensor`, *optional*):
121
+ Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
122
+ provided, text embeddings will be generated from `prompt` input argument.
123
+ negative_prompt_embeds (`torch.Tensor`, *optional*):
124
+ Pre-generated negative text embeddings. For PixArt-Alpha, it's should be the embeddings of the ""
125
+ string.
126
+ clean_caption (`bool`, defaults to `False`):
127
+ If `True`, the function will preprocess and clean the provided caption before encoding.
128
+ max_sequence_length (`int`, defaults to 256): Maximum sequence length to use for the prompt.
129
+ """
130
+
131
+ if "mask_feature" in kwargs:
132
+ deprecation_message = "The use of `mask_feature` is deprecated. It is no longer used in any computation and that doesn't affect the end results. It will be removed in a future version."
133
+ deprecate("mask_feature", "1.0.0", deprecation_message, standard_warn=False)
134
+
135
+ if device is None:
136
+ device = self._execution_device
137
+
138
+ if prompt is not None and isinstance(prompt, str):
139
+ batch_size = 1
140
+ elif prompt is not None and isinstance(prompt, list):
141
+ batch_size = len(prompt)
142
+ else:
143
+ batch_size = prompt_embeds.shape[0]
144
+
145
+ # See Section 3.1. of the paper.
146
+ max_length = max_sequence_length
147
+
148
+ if prompt_embeds is None:
149
+ prompt = self._text_preprocessing(prompt, clean_caption=clean_caption)
150
+ text_inputs = self.tokenizer(
151
+ prompt,
152
+ padding="max_length",
153
+ max_length=max_length,
154
+ truncation=True,
155
+ add_special_tokens=True,
156
+ return_tensors="pt",
157
+ )
158
+ text_input_ids = text_inputs.input_ids
159
+ untruncated_ids = self.tokenizer(prompt, padding="longest", return_tensors="pt").input_ids
160
+
161
+ if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(
162
+ text_input_ids, untruncated_ids
163
+ ):
164
+ removed_text = self.tokenizer.batch_decode(untruncated_ids[:, max_length - 1 : -1])
165
+ logger.warning(
166
+ "The following part of your input was truncated because T5 can only handle sequences up to"
167
+ f" {max_length} tokens: {removed_text}"
168
+ )
169
+
170
+ prompt_attention_mask = text_inputs.attention_mask
171
+ prompt_attention_mask = prompt_attention_mask.to(device)
172
+
173
+ prompt_embeds = self.text_encoder(
174
+ text_input_ids.to(device),
175
+ attention_mask=prompt_attention_mask,
176
+ output_hidden_states=True,
177
+ )["hidden_states"][-1]
178
+
179
+ if self.text_encoder is not None:
180
+ dtype = self.text_encoder.dtype
181
+ elif self.transformer is not None:
182
+ dtype = self.transformer.dtype
183
+ else:
184
+ dtype = None
185
+
186
+ prompt_embeds = prompt_embeds.to(dtype=dtype, device=device)
187
+
188
+ bs_embed, seq_len, _ = prompt_embeds.shape
189
+ # duplicate text embeddings and attention mask for each generation per prompt, using mps friendly method
190
+ prompt_embeds = prompt_embeds.repeat(1, num_images_per_prompt, 1)
191
+ prompt_embeds = prompt_embeds.view(bs_embed * num_images_per_prompt, seq_len, -1)
192
+ prompt_attention_mask = prompt_attention_mask.view(bs_embed, -1)
193
+ prompt_attention_mask = prompt_attention_mask.repeat(num_images_per_prompt, 1)
194
+
195
+ # get unconditional embeddings for classifier free guidance
196
+ if do_classifier_free_guidance and negative_prompt_embeds is None:
197
+ uncond_tokens = [negative_prompt] * batch_size if isinstance(negative_prompt, str) else negative_prompt
198
+ uncond_tokens = self._text_preprocessing(uncond_tokens, clean_caption=clean_caption)
199
+ max_length = prompt_embeds.shape[1]
200
+ uncond_input = self.tokenizer(
201
+ uncond_tokens,
202
+ padding="max_length",
203
+ max_length=max_length,
204
+ truncation=True,
205
+ return_attention_mask=True,
206
+ add_special_tokens=True,
207
+ return_tensors="pt",
208
+ )
209
+ negative_prompt_attention_mask = uncond_input.attention_mask
210
+ negative_prompt_attention_mask = negative_prompt_attention_mask.to(device)
211
+
212
+ negative_prompt_embeds = self.text_encoder(
213
+ uncond_input.input_ids.to(device),
214
+ attention_mask=negative_prompt_attention_mask,
215
+ output_hidden_states=True,
216
+ )["hidden_states"][-1]
217
+
218
+ if do_classifier_free_guidance:
219
+ # duplicate unconditional embeddings for each generation per prompt, using mps friendly method
220
+ seq_len = negative_prompt_embeds.shape[1]
221
+
222
+ negative_prompt_embeds = negative_prompt_embeds.to(dtype=dtype, device=device)
223
+
224
+ negative_prompt_embeds = negative_prompt_embeds.repeat(1, num_images_per_prompt, 1)
225
+ negative_prompt_embeds = negative_prompt_embeds.view(batch_size * num_images_per_prompt, seq_len, -1)
226
+
227
+ negative_prompt_attention_mask = negative_prompt_attention_mask.view(bs_embed, -1)
228
+ negative_prompt_attention_mask = negative_prompt_attention_mask.repeat(num_images_per_prompt, 1)
229
+ else:
230
+ negative_prompt_embeds = None
231
+ negative_prompt_attention_mask = None
232
+
233
+ return (
234
+ prompt_embeds,
235
+ prompt_attention_mask,
236
+ negative_prompt_embeds,
237
+ negative_prompt_attention_mask,
238
+ )
239
+
240
+ # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs
241
+ def prepare_extra_step_kwargs(self, generator, eta):
242
+ # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
243
+ # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
244
+ # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
245
+ # and should be between [0, 1]
246
+
247
+ accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys())
248
+ extra_step_kwargs = {}
249
+ if accepts_eta:
250
+ extra_step_kwargs["eta"] = eta
251
+
252
+ # check if the scheduler accepts generator
253
+ accepts_generator = "generator" in set(inspect.signature(self.scheduler.step).parameters.keys())
254
+ if accepts_generator:
255
+ extra_step_kwargs["generator"] = generator
256
+ return extra_step_kwargs
257
+
258
+ def check_inputs(
259
+ self,
260
+ prompt,
261
+ height,
262
+ width,
263
+ negative_prompt,
264
+ callback_steps,
265
+ prompt_embeds=None,
266
+ negative_prompt_embeds=None,
267
+ prompt_attention_mask=None,
268
+ negative_prompt_attention_mask=None,
269
+ ):
270
+ if height % 8 != 0 or width % 8 != 0:
271
+ raise ValueError(f"`height` and `width` have to be divisible by 8 but are {height} and {width}.")
272
+
273
+ if (callback_steps is None) or (
274
+ callback_steps is not None and (not isinstance(callback_steps, int) or callback_steps <= 0)
275
+ ):
276
+ raise ValueError(
277
+ f"`callback_steps` has to be a positive integer but is {callback_steps} of type"
278
+ f" {type(callback_steps)}."
279
+ )
280
+
281
+ if prompt is not None and prompt_embeds is not None:
282
+ raise ValueError(
283
+ f"Cannot forward both `prompt`: {prompt} and `prompt_embeds`: {prompt_embeds}. Please make sure to"
284
+ " only forward one of the two."
285
+ )
286
+ elif prompt is None and prompt_embeds is None:
287
+ raise ValueError(
288
+ "Provide either `prompt` or `prompt_embeds`. Cannot leave both `prompt` and `prompt_embeds` undefined."
289
+ )
290
+ elif prompt is not None and (not isinstance(prompt, str) and not isinstance(prompt, list)):
291
+ raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
292
+
293
+ if prompt is not None and negative_prompt_embeds is not None:
294
+ raise ValueError(
295
+ f"Cannot forward both `prompt`: {prompt} and `negative_prompt_embeds`:"
296
+ f" {negative_prompt_embeds}. Please make sure to only forward one of the two."
297
+ )
298
+
299
+ if negative_prompt is not None and negative_prompt_embeds is not None:
300
+ raise ValueError(
301
+ f"Cannot forward both `negative_prompt`: {negative_prompt} and `negative_prompt_embeds`:"
302
+ f" {negative_prompt_embeds}. Please make sure to only forward one of the two."
303
+ )
304
+
305
+ if prompt_embeds is not None and prompt_attention_mask is None:
306
+ raise ValueError("Must provide `prompt_attention_mask` when specifying `prompt_embeds`.")
307
+
308
+ if negative_prompt_embeds is not None and negative_prompt_attention_mask is None:
309
+ raise ValueError("Must provide `negative_prompt_attention_mask` when specifying `negative_prompt_embeds`.")
310
+
311
+ if prompt_embeds is not None and negative_prompt_embeds is not None:
312
+ if prompt_embeds.shape != negative_prompt_embeds.shape:
313
+ raise ValueError(
314
+ "`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but"
315
+ f" got: `prompt_embeds` {prompt_embeds.shape} != `negative_prompt_embeds`"
316
+ f" {negative_prompt_embeds.shape}."
317
+ )
318
+ if prompt_attention_mask.shape != negative_prompt_attention_mask.shape:
319
+ raise ValueError(
320
+ "`prompt_attention_mask` and `negative_prompt_attention_mask` must have the same shape when passed directly, but"
321
+ f" got: `prompt_attention_mask` {prompt_attention_mask.shape} != `negative_prompt_attention_mask`"
322
+ f" {negative_prompt_attention_mask.shape}."
323
+ )
324
+
325
+ # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._text_preprocessing
326
+ def _text_preprocessing(self, text, clean_caption=False):
327
+ if clean_caption and not is_bs4_available():
328
+ logger.warning(BACKENDS_MAPPING["bs4"][-1].format("Setting `clean_caption=True`"))
329
+ logger.warning("Setting `clean_caption` to False...")
330
+ clean_caption = False
331
+
332
+ if clean_caption and not is_ftfy_available():
333
+ logger.warning(BACKENDS_MAPPING["ftfy"][-1].format("Setting `clean_caption=True`"))
334
+ logger.warning("Setting `clean_caption` to False...")
335
+ clean_caption = False
336
+
337
+ if not isinstance(text, (tuple, list)):
338
+ text = [text]
339
+
340
+ def process(text: str):
341
+ if clean_caption:
342
+ text = self._clean_caption(text)
343
+ text = self._clean_caption(text)
344
+ else:
345
+ text = text.lower().strip()
346
+ return text
347
+
348
+ return [process(t) for t in text]
349
+
350
+ # Copied from diffusers.pipelines.deepfloyd_if.pipeline_if.IFPipeline._clean_caption
351
+ def _clean_caption(self, caption):
352
+ caption = str(caption)
353
+ caption = ul.unquote_plus(caption)
354
+ caption = caption.strip().lower()
355
+ caption = re.sub("<person>", "person", caption)
356
+ # urls:
357
+ caption = re.sub(
358
+ r"\b((?:https?:(?:\/{1,3}|[a-zA-Z0-9%])|[a-zA-Z0-9.\-]+[.](?:com|co|ru|net|org|edu|gov|it)[\w/-]*\b\/?(?!@)))", # noqa
359
+ "",
360
+ caption,
361
+ ) # regex for urls
362
+ caption = re.sub(
363
+ r"\b((?:www:(?:\/{1,3}|[a-zA-Z0-9%])|[a-zA-Z0-9.\-]+[.](?:com|co|ru|net|org|edu|gov|it)[\w/-]*\b\/?(?!@)))", # noqa
364
+ "",
365
+ caption,
366
+ ) # regex for urls
367
+ # html:
368
+ caption = BeautifulSoup(caption, features="html.parser").text
369
+
370
+ # @<nickname>
371
+ caption = re.sub(r"@[\w\d]+\b", "", caption)
372
+
373
+ # 31C0—31EF CJK Strokes
374
+ # 31F0—31FF Katakana Phonetic Extensions
375
+ # 3200—32FF Enclosed CJK Letters and Months
376
+ # 3300—33FF CJK Compatibility
377
+ # 3400—4DBF CJK Unified Ideographs Extension A
378
+ # 4DC0—4DFF Yijing Hexagram Symbols
379
+ # 4E00—9FFF CJK Unified Ideographs
380
+ caption = re.sub(r"[\u31c0-\u31ef]+", "", caption)
381
+ caption = re.sub(r"[\u31f0-\u31ff]+", "", caption)
382
+ caption = re.sub(r"[\u3200-\u32ff]+", "", caption)
383
+ caption = re.sub(r"[\u3300-\u33ff]+", "", caption)
384
+ caption = re.sub(r"[\u3400-\u4dbf]+", "", caption)
385
+ caption = re.sub(r"[\u4dc0-\u4dff]+", "", caption)
386
+ caption = re.sub(r"[\u4e00-\u9fff]+", "", caption)
387
+ #######################################################
388
+
389
+ # все виды тире / all types of dash --> "-"
390
+ caption = re.sub(
391
+ r"[\u002D\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D]+", # noqa
392
+ "-",
393
+ caption,
394
+ )
395
+
396
+ # кавычки к одному стандарту
397
+ caption = re.sub(r"[`´«»“”¨]", '"', caption)
398
+ caption = re.sub(r"[‘’]", "'", caption)
399
+
400
+ # &quot;
401
+ caption = re.sub(r"&quot;?", "", caption)
402
+ # &amp
403
+ caption = re.sub(r"&amp", "", caption)
404
+
405
+ # ip adresses:
406
+ caption = re.sub(r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", " ", caption)
407
+
408
+ # article ids:
409
+ caption = re.sub(r"\d:\d\d\s+$", "", caption)
410
+
411
+ # \n
412
+ caption = re.sub(r"\\n", " ", caption)
413
+
414
+ # "#123"
415
+ caption = re.sub(r"#\d{1,3}\b", "", caption)
416
+ # "#12345.."
417
+ caption = re.sub(r"#\d{5,}\b", "", caption)
418
+ # "123456.."
419
+ caption = re.sub(r"\b\d{6,}\b", "", caption)
420
+ # filenames:
421
+ caption = re.sub(r"[\S]+\.(?:png|jpg|jpeg|bmp|webp|eps|pdf|apk|mp4)", "", caption)
422
+
423
+ #
424
+ caption = re.sub(r"[\"\']{2,}", r'"', caption) # """AUSVERKAUFT"""
425
+ caption = re.sub(r"[\.]{2,}", r" ", caption) # """AUSVERKAUFT"""
426
+
427
+ caption = re.sub(self.bad_punct_regex, r" ", caption) # ***AUSVERKAUFT***, #AUSVERKAUFT
428
+ caption = re.sub(r"\s+\.\s+", r" ", caption) # " . "
429
+
430
+ # this-is-my-cute-cat / this_is_my_cute_cat
431
+ regex2 = re.compile(r"(?:\-|\_)")
432
+ if len(re.findall(regex2, caption)) > 3:
433
+ caption = re.sub(regex2, " ", caption)
434
+
435
+ caption = ftfy.fix_text(caption)
436
+ caption = html.unescape(html.unescape(caption))
437
+
438
+ caption = re.sub(r"\b[a-zA-Z]{1,3}\d{3,15}\b", "", caption) # jc6640
439
+ caption = re.sub(r"\b[a-zA-Z]+\d+[a-zA-Z]+\b", "", caption) # jc6640vc
440
+ caption = re.sub(r"\b\d+[a-zA-Z]+\d+\b", "", caption) # 6640vc231
441
+
442
+ caption = re.sub(r"(worldwide\s+)?(free\s+)?shipping", "", caption)
443
+ caption = re.sub(r"(free\s)?download(\sfree)?", "", caption)
444
+ caption = re.sub(r"\bclick\b\s(?:for|on)\s\w+", "", caption)
445
+ caption = re.sub(r"\b(?:png|jpg|jpeg|bmp|webp|eps|pdf|apk|mp4)(\simage[s]?)?", "", caption)
446
+ caption = re.sub(r"\bpage\s+\d+\b", "", caption)
447
+
448
+ caption = re.sub(r"\b\d*[a-zA-Z]+\d+[a-zA-Z]+\d+[a-zA-Z\d]*\b", r" ", caption) # j2d1a2a...
449
+
450
+ caption = re.sub(r"\b\d+\.?\d*[xх×]\d+\.?\d*\b", "", caption)
451
+
452
+ caption = re.sub(r"\b\s+\:\s+", r": ", caption)
453
+ caption = re.sub(r"(\D[,\./])\b", r"\1 ", caption)
454
+ caption = re.sub(r"\s+", " ", caption)
455
+
456
+ caption.strip()
457
+
458
+ caption = re.sub(r"^[\"\']([\w\W]+)[\"\']$", r"\1", caption)
459
+ caption = re.sub(r"^[\'\_,\-\:;]", r"", caption)
460
+ caption = re.sub(r"[\'\_,\-\:\-\+]$", r"", caption)
461
+ caption = re.sub(r"^\.\S+$", "", caption)
462
+
463
+ return caption.strip()
464
+
465
+ # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents
466
+ def prepare_latents(
467
+ self,
468
+ batch_size,
469
+ num_channels_latents,
470
+ height,
471
+ width,
472
+ dtype,
473
+ device,
474
+ generator,
475
+ latents=None,
476
+ ):
477
+ shape = (
478
+ batch_size,
479
+ num_channels_latents,
480
+ int(height) // self.vae_scale_factor,
481
+ int(width) // self.vae_scale_factor,
482
+ )
483
+ if isinstance(generator, list) and len(generator) != batch_size:
484
+ raise ValueError(
485
+ f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
486
+ f" size of {batch_size}. Make sure the batch size matches the length of the generators."
487
+ )
488
+
489
+ if latents is None:
490
+ latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
491
+ else:
492
+ latents = latents.to(device)
493
+
494
+ return latents
495
+
496
+ @torch.no_grad()
497
+ def __call__(
498
+ self,
499
+ prompt: Union[str, List[str]] = None,
500
+ negative_prompt: str = "",
501
+ num_inference_steps: int = 20,
502
+ timesteps: List[int] = None,
503
+ sigmas: List[float] = None,
504
+ guidance_scale: float = 4.5,
505
+ num_images_per_prompt: Optional[int] = 1,
506
+ height: Optional[int] = None,
507
+ width: Optional[int] = None,
508
+ eta: float = 0.0,
509
+ generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
510
+ latents: Optional[torch.Tensor] = None,
511
+ prompt_embeds: Optional[torch.Tensor] = None,
512
+ prompt_attention_mask: Optional[torch.Tensor] = None,
513
+ negative_prompt_embeds: Optional[torch.Tensor] = None,
514
+ negative_prompt_attention_mask: Optional[torch.Tensor] = None,
515
+ output_type: Optional[str] = "pil",
516
+ return_dict: bool = True,
517
+ callback: Optional[Callable[[int, int, torch.Tensor], None]] = None,
518
+ callback_steps: int = 1,
519
+ clean_caption: bool = True,
520
+ max_sequence_length: int = 256,
521
+ **kwargs,
522
+ ) -> Union[ImagePipelineOutput, Tuple]:
523
+ """
524
+ Function invoked when calling the pipeline for generation.
525
+ Args:
526
+ prompt (`str` or `List[str]`, *optional*):
527
+ The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
528
+ instead.
529
+ negative_prompt (`str` or `List[str]`, *optional*):
530
+ The prompt or prompts not to guide the image generation. If not defined, one has to pass
531
+ `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is
532
+ less than `1`).
533
+ num_inference_steps (`int`, *optional*, defaults to 100):
534
+ The number of denoising steps. More denoising steps usually lead to a higher quality image at the
535
+ expense of slower inference.
536
+ timesteps (`List[int]`, *optional*):
537
+ Custom timesteps to use for the denoising process with schedulers which support a `timesteps` argument
538
+ in their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is
539
+ passed will be used. Must be in descending order.
540
+ sigmas (`List[float]`, *optional*):
541
+ Custom sigmas to use for the denoising process with schedulers which support a `sigmas` argument in
542
+ their `set_timesteps` method. If not defined, the default behavior when `num_inference_steps` is passed
543
+ will be used.
544
+ guidance_scale (`float`, *optional*, defaults to 4.5):
545
+ Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598).
546
+ `guidance_scale` is defined as `w` of equation 2. of [Imagen
547
+ Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale >
548
+ 1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`,
549
+ usually at the expense of lower image quality.
550
+ num_images_per_prompt (`int`, *optional*, defaults to 1):
551
+ The number of images to generate per prompt.
552
+ height (`int`, *optional*, defaults to self.unet.config.sample_size):
553
+ The height in pixels of the generated image.
554
+ width (`int`, *optional*, defaults to self.unet.config.sample_size):
555
+ The width in pixels of the generated image.
556
+ eta (`float`, *optional*, defaults to 0.0):
557
+ Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
558
+ [`schedulers.DDIMScheduler`], will be ignored for others.
559
+ generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
560
+ One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html)
561
+ to make generation deterministic.
562
+ latents (`torch.Tensor`, *optional*):
563
+ Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
564
+ generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
565
+ tensor will ge generated by sampling using the supplied random `generator`.
566
+ prompt_embeds (`torch.Tensor`, *optional*):
567
+ Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not
568
+ provided, text embeddings will be generated from `prompt` input argument.
569
+ prompt_attention_mask (`torch.Tensor`, *optional*): Pre-generated attention mask for text embeddings.
570
+ negative_prompt_embeds (`torch.Tensor`, *optional*):
571
+ Pre-generated negative text embeddings. For PixArt-Alpha this negative prompt should be "". If not
572
+ provided, negative_prompt_embeds will be generated from `negative_prompt` input argument.
573
+ negative_prompt_attention_mask (`torch.Tensor`, *optional*):
574
+ Pre-generated attention mask for negative text embeddings.
575
+ output_type (`str`, *optional*, defaults to `"pil"`):
576
+ The output format of the generate image. Choose between
577
+ [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`.
578
+ return_dict (`bool`, *optional*, defaults to `True`):
579
+ Whether or not to return a [`~pipelines.stable_diffusion.IFPipelineOutput`] instead of a plain tuple.
580
+ callback (`Callable`, *optional*):
581
+ A function that will be called every `callback_steps` steps during inference. The function will be
582
+ called with the following arguments: `callback(step: int, timestep: int, latents: torch.Tensor)`.
583
+ callback_steps (`int`, *optional*, defaults to 1):
584
+ The frequency at which the `callback` function will be called. If not specified, the callback will be
585
+ called at every step.
586
+ clean_caption (`bool`, *optional*, defaults to `True`):
587
+ Whether or not to clean the caption before creating embeddings. Requires `beautifulsoup4` and `ftfy` to
588
+ be installed. If the dependencies are not installed, the embeddings will be created from the raw
589
+ prompt.
590
+ max_sequence_length (`int` defaults to 256): Maximum sequence length to use with the `prompt`.
591
+ Examples:
592
+ Returns:
593
+ [`~pipelines.ImagePipelineOutput`] or `tuple`:
594
+ If `return_dict` is `True`, [`~pipelines.ImagePipelineOutput`] is returned, otherwise a `tuple` is
595
+ returned where the first element is a list with the generated images
596
+ """
597
+ if "mask_feature" in kwargs:
598
+ deprecation_message = "The use of `mask_feature` is deprecated. It is no longer used in any computation and that doesn't affect the end results. It will be removed in a future version."
599
+ deprecate("mask_feature", "1.0.0", deprecation_message, standard_warn=False)
600
+ # 1. Check inputs. Raise error if not correct
601
+ height = height or self.transformer.config.sample_size * self.vae_scale_factor
602
+ width = width or self.transformer.config.sample_size * self.vae_scale_factor
603
+
604
+ self.check_inputs(
605
+ prompt,
606
+ height,
607
+ width,
608
+ negative_prompt,
609
+ callback_steps,
610
+ prompt_embeds,
611
+ negative_prompt_embeds,
612
+ prompt_attention_mask,
613
+ negative_prompt_attention_mask,
614
+ )
615
+
616
+ # 2. Default height and width to transformer
617
+ if prompt is not None and isinstance(prompt, str):
618
+ batch_size = 1
619
+ elif prompt is not None and isinstance(prompt, list):
620
+ batch_size = len(prompt)
621
+ else:
622
+ batch_size = prompt_embeds.shape[0]
623
+
624
+ device = self._execution_device
625
+
626
+ # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
627
+ # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
628
+ # corresponds to doing no classifier free guidance.
629
+ do_classifier_free_guidance = guidance_scale > 1.0
630
+
631
+ # 3. Encode input prompt
632
+ (
633
+ prompt_embeds,
634
+ prompt_attention_mask,
635
+ negative_prompt_embeds,
636
+ negative_prompt_attention_mask,
637
+ ) = self.encode_prompt(
638
+ prompt,
639
+ do_classifier_free_guidance,
640
+ negative_prompt=negative_prompt,
641
+ num_images_per_prompt=num_images_per_prompt,
642
+ device=device,
643
+ prompt_embeds=prompt_embeds,
644
+ negative_prompt_embeds=negative_prompt_embeds,
645
+ prompt_attention_mask=prompt_attention_mask,
646
+ negative_prompt_attention_mask=negative_prompt_attention_mask,
647
+ clean_caption=clean_caption,
648
+ max_sequence_length=max_sequence_length,
649
+ )
650
+ if do_classifier_free_guidance:
651
+ prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds], dim=0)
652
+ prompt_attention_mask = torch.cat([negative_prompt_attention_mask, prompt_attention_mask], dim=0)
653
+
654
+ # 4. Prepare timesteps
655
+ timesteps, num_inference_steps = retrieve_timesteps(
656
+ self.scheduler, num_inference_steps, device, timesteps, sigmas
657
+ )
658
+ # 5. Prepare latents.
659
+ latent_channels = self.transformer.config.in_channels
660
+ latents = self.prepare_latents(
661
+ batch_size * num_images_per_prompt,
662
+ latent_channels,
663
+ height,
664
+ width,
665
+ prompt_embeds.dtype,
666
+ device,
667
+ generator,
668
+ latents,
669
+ )
670
+
671
+ # 6. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
672
+ extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta)
673
+
674
+ # 7. Denoising loop
675
+ num_warmup_steps = max(len(timesteps) - num_inference_steps * self.scheduler.order, 0)
676
+
677
+ with self.progress_bar(total=num_inference_steps) as progress_bar:
678
+ for i, t in enumerate(timesteps):
679
+ latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents
680
+ # latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
681
+
682
+ current_timestep = t
683
+ if not torch.is_tensor(current_timestep):
684
+ # TODO: this requires sync between CPU and GPU. So try to pass timesteps as tensors if you can
685
+ # This would be a good case for the `match` statement (Python 3.10+)
686
+ is_mps = latent_model_input.device.type == "mps"
687
+ if isinstance(current_timestep, float):
688
+ dtype = torch.float32 if is_mps else torch.float64
689
+ else:
690
+ dtype = torch.int32 if is_mps else torch.int64
691
+ current_timestep = torch.tensor(
692
+ [current_timestep],
693
+ dtype=dtype,
694
+ device=latent_model_input.device,
695
+ )
696
+ elif len(current_timestep.shape) == 0:
697
+ current_timestep = current_timestep[None].to(latent_model_input.device)
698
+ # broadcast to batch dimension in a way that's compatible with ONNX/Core ML
699
+ current_timestep = current_timestep.expand(latent_model_input.shape[0])
700
+
701
+ # predict noise model_output
702
+ noise_pred = self.transformer(
703
+ latent_model_input,
704
+ encoder_hidden_states=prompt_embeds,
705
+ encoder_attention_mask=prompt_attention_mask,
706
+ timestep=current_timestep,
707
+ return_dict=False,
708
+ )[0]
709
+
710
+ # perform guidance
711
+ if do_classifier_free_guidance:
712
+ noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
713
+ noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
714
+
715
+ # learned sigma
716
+ if self.transformer.config.out_channels // 2 == latent_channels:
717
+ noise_pred = noise_pred.chunk(2, dim=1)[0]
718
+ else:
719
+ noise_pred = noise_pred
720
+
721
+ # compute previous image: x_t -> x_t-1
722
+ # if num_inference_steps == 1:
723
+ # # For DMD one step sampling: https://arxiv.org/abs/2311.18828
724
+ # latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).pred_original_sample
725
+ # else:
726
+ latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs, return_dict=False)[0]
727
+
728
+ # call the callback, if provided
729
+ if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
730
+ progress_bar.update()
731
+ if callback is not None and i % callback_steps == 0:
732
+ step_idx = i // getattr(self.scheduler, "order", 1)
733
+ callback(step_idx, t, latents)
734
+
735
+ if not output_type == "latent":
736
+ image = self.vae.decode(latents / self.vae.scaling_factor).sample
737
+ else:
738
+ image = latents
739
+
740
+ if not output_type == "latent":
741
+ image = self.image_processor.postprocess(image, output_type=output_type)
742
+
743
+ # Offload all models
744
+ self.maybe_free_model_hooks()
745
+
746
+ if not return_dict:
747
+ return (image,)
748
+
749
+ return ImagePipelineOutput(images=image)
scheduler/scheduler_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "FlowMatchEulerDiscreteScheduler",
3
+ "_diffusers_version": "0.33.1",
4
+ "base_image_seq_len": 256,
5
+ "base_shift": 0.5,
6
+ "invert_sigmas": false,
7
+ "max_image_seq_len": 4096,
8
+ "max_shift": 1.15,
9
+ "num_train_timesteps": 1000,
10
+ "shift": 3.0,
11
+ "shift_terminal": null,
12
+ "time_shift_type": "exponential",
13
+ "use_beta_sigmas": false,
14
+ "use_dynamic_shifting": false,
15
+ "use_exponential_sigmas": false,
16
+ "use_karras_sigmas": false
17
+ }
text_encoder/config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "meta-llama/Llama-3.2-1B",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "bos_token_id": 128000,
9
+ "eos_token_id": 128001,
10
+ "head_dim": 64,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2048,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 8192,
15
+ "max_position_embeddings": 131072,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 32,
19
+ "num_hidden_layers": 16,
20
+ "num_key_value_heads": 8,
21
+ "pretraining_tp": 1,
22
+ "rms_norm_eps": 1e-05,
23
+ "rope_scaling": {
24
+ "factor": 32.0,
25
+ "high_freq_factor": 4.0,
26
+ "low_freq_factor": 1.0,
27
+ "original_max_position_embeddings": 8192,
28
+ "rope_type": "llama3"
29
+ },
30
+ "rope_theta": 500000.0,
31
+ "tie_word_embeddings": true,
32
+ "torch_dtype": "bfloat16",
33
+ "transformers_version": "4.46.3",
34
+ "use_cache": true,
35
+ "vocab_size": 128256
36
+ }
text_encoder/generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 128000,
4
+ "do_sample": true,
5
+ "eos_token_id": 128001,
6
+ "temperature": 0.6,
7
+ "top_p": 0.9,
8
+ "transformers_version": "4.46.3"
9
+ }
tokenizer/special_tokens_map.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|end_of_text|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<|end_of_text|>"
17
+ }
tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b9e4e7fb171f92fd137b777cc2714bf87d11576700a1dcd7a399e7bbe39537b
3
+ size 17209920
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,2062 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "128000": {
4
+ "content": "<|begin_of_text|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "128001": {
12
+ "content": "<|end_of_text|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "128002": {
20
+ "content": "<|reserved_special_token_0|>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "128003": {
28
+ "content": "<|reserved_special_token_1|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128004": {
36
+ "content": "<|finetune_right_pad_id|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128005": {
44
+ "content": "<|reserved_special_token_2|>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "128006": {
52
+ "content": "<|start_header_id|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "128007": {
60
+ "content": "<|end_header_id|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "128008": {
68
+ "content": "<|eom_id|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "128009": {
76
+ "content": "<|eot_id|>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "128010": {
84
+ "content": "<|python_tag|>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "128011": {
92
+ "content": "<|reserved_special_token_3|>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "128012": {
100
+ "content": "<|reserved_special_token_4|>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "128013": {
108
+ "content": "<|reserved_special_token_5|>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "128014": {
116
+ "content": "<|reserved_special_token_6|>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "128015": {
124
+ "content": "<|reserved_special_token_7|>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "128016": {
132
+ "content": "<|reserved_special_token_8|>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "128017": {
140
+ "content": "<|reserved_special_token_9|>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "128018": {
148
+ "content": "<|reserved_special_token_10|>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "128019": {
156
+ "content": "<|reserved_special_token_11|>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "128020": {
164
+ "content": "<|reserved_special_token_12|>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "128021": {
172
+ "content": "<|reserved_special_token_13|>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "128022": {
180
+ "content": "<|reserved_special_token_14|>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "128023": {
188
+ "content": "<|reserved_special_token_15|>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "128024": {
196
+ "content": "<|reserved_special_token_16|>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "128025": {
204
+ "content": "<|reserved_special_token_17|>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "128026": {
212
+ "content": "<|reserved_special_token_18|>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "128027": {
220
+ "content": "<|reserved_special_token_19|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "128028": {
228
+ "content": "<|reserved_special_token_20|>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "128029": {
236
+ "content": "<|reserved_special_token_21|>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "128030": {
244
+ "content": "<|reserved_special_token_22|>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "128031": {
252
+ "content": "<|reserved_special_token_23|>",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "128032": {
260
+ "content": "<|reserved_special_token_24|>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "128033": {
268
+ "content": "<|reserved_special_token_25|>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "128034": {
276
+ "content": "<|reserved_special_token_26|>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "128035": {
284
+ "content": "<|reserved_special_token_27|>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "128036": {
292
+ "content": "<|reserved_special_token_28|>",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "128037": {
300
+ "content": "<|reserved_special_token_29|>",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "128038": {
308
+ "content": "<|reserved_special_token_30|>",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "128039": {
316
+ "content": "<|reserved_special_token_31|>",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "128040": {
324
+ "content": "<|reserved_special_token_32|>",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "128041": {
332
+ "content": "<|reserved_special_token_33|>",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "128042": {
340
+ "content": "<|reserved_special_token_34|>",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "128043": {
348
+ "content": "<|reserved_special_token_35|>",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "128044": {
356
+ "content": "<|reserved_special_token_36|>",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "128045": {
364
+ "content": "<|reserved_special_token_37|>",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "128046": {
372
+ "content": "<|reserved_special_token_38|>",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "128047": {
380
+ "content": "<|reserved_special_token_39|>",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "128048": {
388
+ "content": "<|reserved_special_token_40|>",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "128049": {
396
+ "content": "<|reserved_special_token_41|>",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "128050": {
404
+ "content": "<|reserved_special_token_42|>",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "128051": {
412
+ "content": "<|reserved_special_token_43|>",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "128052": {
420
+ "content": "<|reserved_special_token_44|>",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "128053": {
428
+ "content": "<|reserved_special_token_45|>",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "128054": {
436
+ "content": "<|reserved_special_token_46|>",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "128055": {
444
+ "content": "<|reserved_special_token_47|>",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "128056": {
452
+ "content": "<|reserved_special_token_48|>",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "128057": {
460
+ "content": "<|reserved_special_token_49|>",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "128058": {
468
+ "content": "<|reserved_special_token_50|>",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "128059": {
476
+ "content": "<|reserved_special_token_51|>",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "128060": {
484
+ "content": "<|reserved_special_token_52|>",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "128061": {
492
+ "content": "<|reserved_special_token_53|>",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "128062": {
500
+ "content": "<|reserved_special_token_54|>",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "128063": {
508
+ "content": "<|reserved_special_token_55|>",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "128064": {
516
+ "content": "<|reserved_special_token_56|>",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "128065": {
524
+ "content": "<|reserved_special_token_57|>",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "128066": {
532
+ "content": "<|reserved_special_token_58|>",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "128067": {
540
+ "content": "<|reserved_special_token_59|>",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "128068": {
548
+ "content": "<|reserved_special_token_60|>",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "128069": {
556
+ "content": "<|reserved_special_token_61|>",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "128070": {
564
+ "content": "<|reserved_special_token_62|>",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "128071": {
572
+ "content": "<|reserved_special_token_63|>",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "128072": {
580
+ "content": "<|reserved_special_token_64|>",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "128073": {
588
+ "content": "<|reserved_special_token_65|>",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "128074": {
596
+ "content": "<|reserved_special_token_66|>",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "128075": {
604
+ "content": "<|reserved_special_token_67|>",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "128076": {
612
+ "content": "<|reserved_special_token_68|>",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "128077": {
620
+ "content": "<|reserved_special_token_69|>",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "128078": {
628
+ "content": "<|reserved_special_token_70|>",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "128079": {
636
+ "content": "<|reserved_special_token_71|>",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "128080": {
644
+ "content": "<|reserved_special_token_72|>",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "128081": {
652
+ "content": "<|reserved_special_token_73|>",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "128082": {
660
+ "content": "<|reserved_special_token_74|>",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "128083": {
668
+ "content": "<|reserved_special_token_75|>",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "128084": {
676
+ "content": "<|reserved_special_token_76|>",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "128085": {
684
+ "content": "<|reserved_special_token_77|>",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "128086": {
692
+ "content": "<|reserved_special_token_78|>",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "128087": {
700
+ "content": "<|reserved_special_token_79|>",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "128088": {
708
+ "content": "<|reserved_special_token_80|>",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "128089": {
716
+ "content": "<|reserved_special_token_81|>",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "128090": {
724
+ "content": "<|reserved_special_token_82|>",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "128091": {
732
+ "content": "<|reserved_special_token_83|>",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "128092": {
740
+ "content": "<|reserved_special_token_84|>",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "128093": {
748
+ "content": "<|reserved_special_token_85|>",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "128094": {
756
+ "content": "<|reserved_special_token_86|>",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "128095": {
764
+ "content": "<|reserved_special_token_87|>",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "128096": {
772
+ "content": "<|reserved_special_token_88|>",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "128097": {
780
+ "content": "<|reserved_special_token_89|>",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "128098": {
788
+ "content": "<|reserved_special_token_90|>",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "128099": {
796
+ "content": "<|reserved_special_token_91|>",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "128100": {
804
+ "content": "<|reserved_special_token_92|>",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "128101": {
812
+ "content": "<|reserved_special_token_93|>",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "128102": {
820
+ "content": "<|reserved_special_token_94|>",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "128103": {
828
+ "content": "<|reserved_special_token_95|>",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ },
835
+ "128104": {
836
+ "content": "<|reserved_special_token_96|>",
837
+ "lstrip": false,
838
+ "normalized": false,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": true
842
+ },
843
+ "128105": {
844
+ "content": "<|reserved_special_token_97|>",
845
+ "lstrip": false,
846
+ "normalized": false,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": true
850
+ },
851
+ "128106": {
852
+ "content": "<|reserved_special_token_98|>",
853
+ "lstrip": false,
854
+ "normalized": false,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": true
858
+ },
859
+ "128107": {
860
+ "content": "<|reserved_special_token_99|>",
861
+ "lstrip": false,
862
+ "normalized": false,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": true
866
+ },
867
+ "128108": {
868
+ "content": "<|reserved_special_token_100|>",
869
+ "lstrip": false,
870
+ "normalized": false,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": true
874
+ },
875
+ "128109": {
876
+ "content": "<|reserved_special_token_101|>",
877
+ "lstrip": false,
878
+ "normalized": false,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": true
882
+ },
883
+ "128110": {
884
+ "content": "<|reserved_special_token_102|>",
885
+ "lstrip": false,
886
+ "normalized": false,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": true
890
+ },
891
+ "128111": {
892
+ "content": "<|reserved_special_token_103|>",
893
+ "lstrip": false,
894
+ "normalized": false,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": true
898
+ },
899
+ "128112": {
900
+ "content": "<|reserved_special_token_104|>",
901
+ "lstrip": false,
902
+ "normalized": false,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": true
906
+ },
907
+ "128113": {
908
+ "content": "<|reserved_special_token_105|>",
909
+ "lstrip": false,
910
+ "normalized": false,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": true
914
+ },
915
+ "128114": {
916
+ "content": "<|reserved_special_token_106|>",
917
+ "lstrip": false,
918
+ "normalized": false,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": true
922
+ },
923
+ "128115": {
924
+ "content": "<|reserved_special_token_107|>",
925
+ "lstrip": false,
926
+ "normalized": false,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": true
930
+ },
931
+ "128116": {
932
+ "content": "<|reserved_special_token_108|>",
933
+ "lstrip": false,
934
+ "normalized": false,
935
+ "rstrip": false,
936
+ "single_word": false,
937
+ "special": true
938
+ },
939
+ "128117": {
940
+ "content": "<|reserved_special_token_109|>",
941
+ "lstrip": false,
942
+ "normalized": false,
943
+ "rstrip": false,
944
+ "single_word": false,
945
+ "special": true
946
+ },
947
+ "128118": {
948
+ "content": "<|reserved_special_token_110|>",
949
+ "lstrip": false,
950
+ "normalized": false,
951
+ "rstrip": false,
952
+ "single_word": false,
953
+ "special": true
954
+ },
955
+ "128119": {
956
+ "content": "<|reserved_special_token_111|>",
957
+ "lstrip": false,
958
+ "normalized": false,
959
+ "rstrip": false,
960
+ "single_word": false,
961
+ "special": true
962
+ },
963
+ "128120": {
964
+ "content": "<|reserved_special_token_112|>",
965
+ "lstrip": false,
966
+ "normalized": false,
967
+ "rstrip": false,
968
+ "single_word": false,
969
+ "special": true
970
+ },
971
+ "128121": {
972
+ "content": "<|reserved_special_token_113|>",
973
+ "lstrip": false,
974
+ "normalized": false,
975
+ "rstrip": false,
976
+ "single_word": false,
977
+ "special": true
978
+ },
979
+ "128122": {
980
+ "content": "<|reserved_special_token_114|>",
981
+ "lstrip": false,
982
+ "normalized": false,
983
+ "rstrip": false,
984
+ "single_word": false,
985
+ "special": true
986
+ },
987
+ "128123": {
988
+ "content": "<|reserved_special_token_115|>",
989
+ "lstrip": false,
990
+ "normalized": false,
991
+ "rstrip": false,
992
+ "single_word": false,
993
+ "special": true
994
+ },
995
+ "128124": {
996
+ "content": "<|reserved_special_token_116|>",
997
+ "lstrip": false,
998
+ "normalized": false,
999
+ "rstrip": false,
1000
+ "single_word": false,
1001
+ "special": true
1002
+ },
1003
+ "128125": {
1004
+ "content": "<|reserved_special_token_117|>",
1005
+ "lstrip": false,
1006
+ "normalized": false,
1007
+ "rstrip": false,
1008
+ "single_word": false,
1009
+ "special": true
1010
+ },
1011
+ "128126": {
1012
+ "content": "<|reserved_special_token_118|>",
1013
+ "lstrip": false,
1014
+ "normalized": false,
1015
+ "rstrip": false,
1016
+ "single_word": false,
1017
+ "special": true
1018
+ },
1019
+ "128127": {
1020
+ "content": "<|reserved_special_token_119|>",
1021
+ "lstrip": false,
1022
+ "normalized": false,
1023
+ "rstrip": false,
1024
+ "single_word": false,
1025
+ "special": true
1026
+ },
1027
+ "128128": {
1028
+ "content": "<|reserved_special_token_120|>",
1029
+ "lstrip": false,
1030
+ "normalized": false,
1031
+ "rstrip": false,
1032
+ "single_word": false,
1033
+ "special": true
1034
+ },
1035
+ "128129": {
1036
+ "content": "<|reserved_special_token_121|>",
1037
+ "lstrip": false,
1038
+ "normalized": false,
1039
+ "rstrip": false,
1040
+ "single_word": false,
1041
+ "special": true
1042
+ },
1043
+ "128130": {
1044
+ "content": "<|reserved_special_token_122|>",
1045
+ "lstrip": false,
1046
+ "normalized": false,
1047
+ "rstrip": false,
1048
+ "single_word": false,
1049
+ "special": true
1050
+ },
1051
+ "128131": {
1052
+ "content": "<|reserved_special_token_123|>",
1053
+ "lstrip": false,
1054
+ "normalized": false,
1055
+ "rstrip": false,
1056
+ "single_word": false,
1057
+ "special": true
1058
+ },
1059
+ "128132": {
1060
+ "content": "<|reserved_special_token_124|>",
1061
+ "lstrip": false,
1062
+ "normalized": false,
1063
+ "rstrip": false,
1064
+ "single_word": false,
1065
+ "special": true
1066
+ },
1067
+ "128133": {
1068
+ "content": "<|reserved_special_token_125|>",
1069
+ "lstrip": false,
1070
+ "normalized": false,
1071
+ "rstrip": false,
1072
+ "single_word": false,
1073
+ "special": true
1074
+ },
1075
+ "128134": {
1076
+ "content": "<|reserved_special_token_126|>",
1077
+ "lstrip": false,
1078
+ "normalized": false,
1079
+ "rstrip": false,
1080
+ "single_word": false,
1081
+ "special": true
1082
+ },
1083
+ "128135": {
1084
+ "content": "<|reserved_special_token_127|>",
1085
+ "lstrip": false,
1086
+ "normalized": false,
1087
+ "rstrip": false,
1088
+ "single_word": false,
1089
+ "special": true
1090
+ },
1091
+ "128136": {
1092
+ "content": "<|reserved_special_token_128|>",
1093
+ "lstrip": false,
1094
+ "normalized": false,
1095
+ "rstrip": false,
1096
+ "single_word": false,
1097
+ "special": true
1098
+ },
1099
+ "128137": {
1100
+ "content": "<|reserved_special_token_129|>",
1101
+ "lstrip": false,
1102
+ "normalized": false,
1103
+ "rstrip": false,
1104
+ "single_word": false,
1105
+ "special": true
1106
+ },
1107
+ "128138": {
1108
+ "content": "<|reserved_special_token_130|>",
1109
+ "lstrip": false,
1110
+ "normalized": false,
1111
+ "rstrip": false,
1112
+ "single_word": false,
1113
+ "special": true
1114
+ },
1115
+ "128139": {
1116
+ "content": "<|reserved_special_token_131|>",
1117
+ "lstrip": false,
1118
+ "normalized": false,
1119
+ "rstrip": false,
1120
+ "single_word": false,
1121
+ "special": true
1122
+ },
1123
+ "128140": {
1124
+ "content": "<|reserved_special_token_132|>",
1125
+ "lstrip": false,
1126
+ "normalized": false,
1127
+ "rstrip": false,
1128
+ "single_word": false,
1129
+ "special": true
1130
+ },
1131
+ "128141": {
1132
+ "content": "<|reserved_special_token_133|>",
1133
+ "lstrip": false,
1134
+ "normalized": false,
1135
+ "rstrip": false,
1136
+ "single_word": false,
1137
+ "special": true
1138
+ },
1139
+ "128142": {
1140
+ "content": "<|reserved_special_token_134|>",
1141
+ "lstrip": false,
1142
+ "normalized": false,
1143
+ "rstrip": false,
1144
+ "single_word": false,
1145
+ "special": true
1146
+ },
1147
+ "128143": {
1148
+ "content": "<|reserved_special_token_135|>",
1149
+ "lstrip": false,
1150
+ "normalized": false,
1151
+ "rstrip": false,
1152
+ "single_word": false,
1153
+ "special": true
1154
+ },
1155
+ "128144": {
1156
+ "content": "<|reserved_special_token_136|>",
1157
+ "lstrip": false,
1158
+ "normalized": false,
1159
+ "rstrip": false,
1160
+ "single_word": false,
1161
+ "special": true
1162
+ },
1163
+ "128145": {
1164
+ "content": "<|reserved_special_token_137|>",
1165
+ "lstrip": false,
1166
+ "normalized": false,
1167
+ "rstrip": false,
1168
+ "single_word": false,
1169
+ "special": true
1170
+ },
1171
+ "128146": {
1172
+ "content": "<|reserved_special_token_138|>",
1173
+ "lstrip": false,
1174
+ "normalized": false,
1175
+ "rstrip": false,
1176
+ "single_word": false,
1177
+ "special": true
1178
+ },
1179
+ "128147": {
1180
+ "content": "<|reserved_special_token_139|>",
1181
+ "lstrip": false,
1182
+ "normalized": false,
1183
+ "rstrip": false,
1184
+ "single_word": false,
1185
+ "special": true
1186
+ },
1187
+ "128148": {
1188
+ "content": "<|reserved_special_token_140|>",
1189
+ "lstrip": false,
1190
+ "normalized": false,
1191
+ "rstrip": false,
1192
+ "single_word": false,
1193
+ "special": true
1194
+ },
1195
+ "128149": {
1196
+ "content": "<|reserved_special_token_141|>",
1197
+ "lstrip": false,
1198
+ "normalized": false,
1199
+ "rstrip": false,
1200
+ "single_word": false,
1201
+ "special": true
1202
+ },
1203
+ "128150": {
1204
+ "content": "<|reserved_special_token_142|>",
1205
+ "lstrip": false,
1206
+ "normalized": false,
1207
+ "rstrip": false,
1208
+ "single_word": false,
1209
+ "special": true
1210
+ },
1211
+ "128151": {
1212
+ "content": "<|reserved_special_token_143|>",
1213
+ "lstrip": false,
1214
+ "normalized": false,
1215
+ "rstrip": false,
1216
+ "single_word": false,
1217
+ "special": true
1218
+ },
1219
+ "128152": {
1220
+ "content": "<|reserved_special_token_144|>",
1221
+ "lstrip": false,
1222
+ "normalized": false,
1223
+ "rstrip": false,
1224
+ "single_word": false,
1225
+ "special": true
1226
+ },
1227
+ "128153": {
1228
+ "content": "<|reserved_special_token_145|>",
1229
+ "lstrip": false,
1230
+ "normalized": false,
1231
+ "rstrip": false,
1232
+ "single_word": false,
1233
+ "special": true
1234
+ },
1235
+ "128154": {
1236
+ "content": "<|reserved_special_token_146|>",
1237
+ "lstrip": false,
1238
+ "normalized": false,
1239
+ "rstrip": false,
1240
+ "single_word": false,
1241
+ "special": true
1242
+ },
1243
+ "128155": {
1244
+ "content": "<|reserved_special_token_147|>",
1245
+ "lstrip": false,
1246
+ "normalized": false,
1247
+ "rstrip": false,
1248
+ "single_word": false,
1249
+ "special": true
1250
+ },
1251
+ "128156": {
1252
+ "content": "<|reserved_special_token_148|>",
1253
+ "lstrip": false,
1254
+ "normalized": false,
1255
+ "rstrip": false,
1256
+ "single_word": false,
1257
+ "special": true
1258
+ },
1259
+ "128157": {
1260
+ "content": "<|reserved_special_token_149|>",
1261
+ "lstrip": false,
1262
+ "normalized": false,
1263
+ "rstrip": false,
1264
+ "single_word": false,
1265
+ "special": true
1266
+ },
1267
+ "128158": {
1268
+ "content": "<|reserved_special_token_150|>",
1269
+ "lstrip": false,
1270
+ "normalized": false,
1271
+ "rstrip": false,
1272
+ "single_word": false,
1273
+ "special": true
1274
+ },
1275
+ "128159": {
1276
+ "content": "<|reserved_special_token_151|>",
1277
+ "lstrip": false,
1278
+ "normalized": false,
1279
+ "rstrip": false,
1280
+ "single_word": false,
1281
+ "special": true
1282
+ },
1283
+ "128160": {
1284
+ "content": "<|reserved_special_token_152|>",
1285
+ "lstrip": false,
1286
+ "normalized": false,
1287
+ "rstrip": false,
1288
+ "single_word": false,
1289
+ "special": true
1290
+ },
1291
+ "128161": {
1292
+ "content": "<|reserved_special_token_153|>",
1293
+ "lstrip": false,
1294
+ "normalized": false,
1295
+ "rstrip": false,
1296
+ "single_word": false,
1297
+ "special": true
1298
+ },
1299
+ "128162": {
1300
+ "content": "<|reserved_special_token_154|>",
1301
+ "lstrip": false,
1302
+ "normalized": false,
1303
+ "rstrip": false,
1304
+ "single_word": false,
1305
+ "special": true
1306
+ },
1307
+ "128163": {
1308
+ "content": "<|reserved_special_token_155|>",
1309
+ "lstrip": false,
1310
+ "normalized": false,
1311
+ "rstrip": false,
1312
+ "single_word": false,
1313
+ "special": true
1314
+ },
1315
+ "128164": {
1316
+ "content": "<|reserved_special_token_156|>",
1317
+ "lstrip": false,
1318
+ "normalized": false,
1319
+ "rstrip": false,
1320
+ "single_word": false,
1321
+ "special": true
1322
+ },
1323
+ "128165": {
1324
+ "content": "<|reserved_special_token_157|>",
1325
+ "lstrip": false,
1326
+ "normalized": false,
1327
+ "rstrip": false,
1328
+ "single_word": false,
1329
+ "special": true
1330
+ },
1331
+ "128166": {
1332
+ "content": "<|reserved_special_token_158|>",
1333
+ "lstrip": false,
1334
+ "normalized": false,
1335
+ "rstrip": false,
1336
+ "single_word": false,
1337
+ "special": true
1338
+ },
1339
+ "128167": {
1340
+ "content": "<|reserved_special_token_159|>",
1341
+ "lstrip": false,
1342
+ "normalized": false,
1343
+ "rstrip": false,
1344
+ "single_word": false,
1345
+ "special": true
1346
+ },
1347
+ "128168": {
1348
+ "content": "<|reserved_special_token_160|>",
1349
+ "lstrip": false,
1350
+ "normalized": false,
1351
+ "rstrip": false,
1352
+ "single_word": false,
1353
+ "special": true
1354
+ },
1355
+ "128169": {
1356
+ "content": "<|reserved_special_token_161|>",
1357
+ "lstrip": false,
1358
+ "normalized": false,
1359
+ "rstrip": false,
1360
+ "single_word": false,
1361
+ "special": true
1362
+ },
1363
+ "128170": {
1364
+ "content": "<|reserved_special_token_162|>",
1365
+ "lstrip": false,
1366
+ "normalized": false,
1367
+ "rstrip": false,
1368
+ "single_word": false,
1369
+ "special": true
1370
+ },
1371
+ "128171": {
1372
+ "content": "<|reserved_special_token_163|>",
1373
+ "lstrip": false,
1374
+ "normalized": false,
1375
+ "rstrip": false,
1376
+ "single_word": false,
1377
+ "special": true
1378
+ },
1379
+ "128172": {
1380
+ "content": "<|reserved_special_token_164|>",
1381
+ "lstrip": false,
1382
+ "normalized": false,
1383
+ "rstrip": false,
1384
+ "single_word": false,
1385
+ "special": true
1386
+ },
1387
+ "128173": {
1388
+ "content": "<|reserved_special_token_165|>",
1389
+ "lstrip": false,
1390
+ "normalized": false,
1391
+ "rstrip": false,
1392
+ "single_word": false,
1393
+ "special": true
1394
+ },
1395
+ "128174": {
1396
+ "content": "<|reserved_special_token_166|>",
1397
+ "lstrip": false,
1398
+ "normalized": false,
1399
+ "rstrip": false,
1400
+ "single_word": false,
1401
+ "special": true
1402
+ },
1403
+ "128175": {
1404
+ "content": "<|reserved_special_token_167|>",
1405
+ "lstrip": false,
1406
+ "normalized": false,
1407
+ "rstrip": false,
1408
+ "single_word": false,
1409
+ "special": true
1410
+ },
1411
+ "128176": {
1412
+ "content": "<|reserved_special_token_168|>",
1413
+ "lstrip": false,
1414
+ "normalized": false,
1415
+ "rstrip": false,
1416
+ "single_word": false,
1417
+ "special": true
1418
+ },
1419
+ "128177": {
1420
+ "content": "<|reserved_special_token_169|>",
1421
+ "lstrip": false,
1422
+ "normalized": false,
1423
+ "rstrip": false,
1424
+ "single_word": false,
1425
+ "special": true
1426
+ },
1427
+ "128178": {
1428
+ "content": "<|reserved_special_token_170|>",
1429
+ "lstrip": false,
1430
+ "normalized": false,
1431
+ "rstrip": false,
1432
+ "single_word": false,
1433
+ "special": true
1434
+ },
1435
+ "128179": {
1436
+ "content": "<|reserved_special_token_171|>",
1437
+ "lstrip": false,
1438
+ "normalized": false,
1439
+ "rstrip": false,
1440
+ "single_word": false,
1441
+ "special": true
1442
+ },
1443
+ "128180": {
1444
+ "content": "<|reserved_special_token_172|>",
1445
+ "lstrip": false,
1446
+ "normalized": false,
1447
+ "rstrip": false,
1448
+ "single_word": false,
1449
+ "special": true
1450
+ },
1451
+ "128181": {
1452
+ "content": "<|reserved_special_token_173|>",
1453
+ "lstrip": false,
1454
+ "normalized": false,
1455
+ "rstrip": false,
1456
+ "single_word": false,
1457
+ "special": true
1458
+ },
1459
+ "128182": {
1460
+ "content": "<|reserved_special_token_174|>",
1461
+ "lstrip": false,
1462
+ "normalized": false,
1463
+ "rstrip": false,
1464
+ "single_word": false,
1465
+ "special": true
1466
+ },
1467
+ "128183": {
1468
+ "content": "<|reserved_special_token_175|>",
1469
+ "lstrip": false,
1470
+ "normalized": false,
1471
+ "rstrip": false,
1472
+ "single_word": false,
1473
+ "special": true
1474
+ },
1475
+ "128184": {
1476
+ "content": "<|reserved_special_token_176|>",
1477
+ "lstrip": false,
1478
+ "normalized": false,
1479
+ "rstrip": false,
1480
+ "single_word": false,
1481
+ "special": true
1482
+ },
1483
+ "128185": {
1484
+ "content": "<|reserved_special_token_177|>",
1485
+ "lstrip": false,
1486
+ "normalized": false,
1487
+ "rstrip": false,
1488
+ "single_word": false,
1489
+ "special": true
1490
+ },
1491
+ "128186": {
1492
+ "content": "<|reserved_special_token_178|>",
1493
+ "lstrip": false,
1494
+ "normalized": false,
1495
+ "rstrip": false,
1496
+ "single_word": false,
1497
+ "special": true
1498
+ },
1499
+ "128187": {
1500
+ "content": "<|reserved_special_token_179|>",
1501
+ "lstrip": false,
1502
+ "normalized": false,
1503
+ "rstrip": false,
1504
+ "single_word": false,
1505
+ "special": true
1506
+ },
1507
+ "128188": {
1508
+ "content": "<|reserved_special_token_180|>",
1509
+ "lstrip": false,
1510
+ "normalized": false,
1511
+ "rstrip": false,
1512
+ "single_word": false,
1513
+ "special": true
1514
+ },
1515
+ "128189": {
1516
+ "content": "<|reserved_special_token_181|>",
1517
+ "lstrip": false,
1518
+ "normalized": false,
1519
+ "rstrip": false,
1520
+ "single_word": false,
1521
+ "special": true
1522
+ },
1523
+ "128190": {
1524
+ "content": "<|reserved_special_token_182|>",
1525
+ "lstrip": false,
1526
+ "normalized": false,
1527
+ "rstrip": false,
1528
+ "single_word": false,
1529
+ "special": true
1530
+ },
1531
+ "128191": {
1532
+ "content": "<|reserved_special_token_183|>",
1533
+ "lstrip": false,
1534
+ "normalized": false,
1535
+ "rstrip": false,
1536
+ "single_word": false,
1537
+ "special": true
1538
+ },
1539
+ "128192": {
1540
+ "content": "<|reserved_special_token_184|>",
1541
+ "lstrip": false,
1542
+ "normalized": false,
1543
+ "rstrip": false,
1544
+ "single_word": false,
1545
+ "special": true
1546
+ },
1547
+ "128193": {
1548
+ "content": "<|reserved_special_token_185|>",
1549
+ "lstrip": false,
1550
+ "normalized": false,
1551
+ "rstrip": false,
1552
+ "single_word": false,
1553
+ "special": true
1554
+ },
1555
+ "128194": {
1556
+ "content": "<|reserved_special_token_186|>",
1557
+ "lstrip": false,
1558
+ "normalized": false,
1559
+ "rstrip": false,
1560
+ "single_word": false,
1561
+ "special": true
1562
+ },
1563
+ "128195": {
1564
+ "content": "<|reserved_special_token_187|>",
1565
+ "lstrip": false,
1566
+ "normalized": false,
1567
+ "rstrip": false,
1568
+ "single_word": false,
1569
+ "special": true
1570
+ },
1571
+ "128196": {
1572
+ "content": "<|reserved_special_token_188|>",
1573
+ "lstrip": false,
1574
+ "normalized": false,
1575
+ "rstrip": false,
1576
+ "single_word": false,
1577
+ "special": true
1578
+ },
1579
+ "128197": {
1580
+ "content": "<|reserved_special_token_189|>",
1581
+ "lstrip": false,
1582
+ "normalized": false,
1583
+ "rstrip": false,
1584
+ "single_word": false,
1585
+ "special": true
1586
+ },
1587
+ "128198": {
1588
+ "content": "<|reserved_special_token_190|>",
1589
+ "lstrip": false,
1590
+ "normalized": false,
1591
+ "rstrip": false,
1592
+ "single_word": false,
1593
+ "special": true
1594
+ },
1595
+ "128199": {
1596
+ "content": "<|reserved_special_token_191|>",
1597
+ "lstrip": false,
1598
+ "normalized": false,
1599
+ "rstrip": false,
1600
+ "single_word": false,
1601
+ "special": true
1602
+ },
1603
+ "128200": {
1604
+ "content": "<|reserved_special_token_192|>",
1605
+ "lstrip": false,
1606
+ "normalized": false,
1607
+ "rstrip": false,
1608
+ "single_word": false,
1609
+ "special": true
1610
+ },
1611
+ "128201": {
1612
+ "content": "<|reserved_special_token_193|>",
1613
+ "lstrip": false,
1614
+ "normalized": false,
1615
+ "rstrip": false,
1616
+ "single_word": false,
1617
+ "special": true
1618
+ },
1619
+ "128202": {
1620
+ "content": "<|reserved_special_token_194|>",
1621
+ "lstrip": false,
1622
+ "normalized": false,
1623
+ "rstrip": false,
1624
+ "single_word": false,
1625
+ "special": true
1626
+ },
1627
+ "128203": {
1628
+ "content": "<|reserved_special_token_195|>",
1629
+ "lstrip": false,
1630
+ "normalized": false,
1631
+ "rstrip": false,
1632
+ "single_word": false,
1633
+ "special": true
1634
+ },
1635
+ "128204": {
1636
+ "content": "<|reserved_special_token_196|>",
1637
+ "lstrip": false,
1638
+ "normalized": false,
1639
+ "rstrip": false,
1640
+ "single_word": false,
1641
+ "special": true
1642
+ },
1643
+ "128205": {
1644
+ "content": "<|reserved_special_token_197|>",
1645
+ "lstrip": false,
1646
+ "normalized": false,
1647
+ "rstrip": false,
1648
+ "single_word": false,
1649
+ "special": true
1650
+ },
1651
+ "128206": {
1652
+ "content": "<|reserved_special_token_198|>",
1653
+ "lstrip": false,
1654
+ "normalized": false,
1655
+ "rstrip": false,
1656
+ "single_word": false,
1657
+ "special": true
1658
+ },
1659
+ "128207": {
1660
+ "content": "<|reserved_special_token_199|>",
1661
+ "lstrip": false,
1662
+ "normalized": false,
1663
+ "rstrip": false,
1664
+ "single_word": false,
1665
+ "special": true
1666
+ },
1667
+ "128208": {
1668
+ "content": "<|reserved_special_token_200|>",
1669
+ "lstrip": false,
1670
+ "normalized": false,
1671
+ "rstrip": false,
1672
+ "single_word": false,
1673
+ "special": true
1674
+ },
1675
+ "128209": {
1676
+ "content": "<|reserved_special_token_201|>",
1677
+ "lstrip": false,
1678
+ "normalized": false,
1679
+ "rstrip": false,
1680
+ "single_word": false,
1681
+ "special": true
1682
+ },
1683
+ "128210": {
1684
+ "content": "<|reserved_special_token_202|>",
1685
+ "lstrip": false,
1686
+ "normalized": false,
1687
+ "rstrip": false,
1688
+ "single_word": false,
1689
+ "special": true
1690
+ },
1691
+ "128211": {
1692
+ "content": "<|reserved_special_token_203|>",
1693
+ "lstrip": false,
1694
+ "normalized": false,
1695
+ "rstrip": false,
1696
+ "single_word": false,
1697
+ "special": true
1698
+ },
1699
+ "128212": {
1700
+ "content": "<|reserved_special_token_204|>",
1701
+ "lstrip": false,
1702
+ "normalized": false,
1703
+ "rstrip": false,
1704
+ "single_word": false,
1705
+ "special": true
1706
+ },
1707
+ "128213": {
1708
+ "content": "<|reserved_special_token_205|>",
1709
+ "lstrip": false,
1710
+ "normalized": false,
1711
+ "rstrip": false,
1712
+ "single_word": false,
1713
+ "special": true
1714
+ },
1715
+ "128214": {
1716
+ "content": "<|reserved_special_token_206|>",
1717
+ "lstrip": false,
1718
+ "normalized": false,
1719
+ "rstrip": false,
1720
+ "single_word": false,
1721
+ "special": true
1722
+ },
1723
+ "128215": {
1724
+ "content": "<|reserved_special_token_207|>",
1725
+ "lstrip": false,
1726
+ "normalized": false,
1727
+ "rstrip": false,
1728
+ "single_word": false,
1729
+ "special": true
1730
+ },
1731
+ "128216": {
1732
+ "content": "<|reserved_special_token_208|>",
1733
+ "lstrip": false,
1734
+ "normalized": false,
1735
+ "rstrip": false,
1736
+ "single_word": false,
1737
+ "special": true
1738
+ },
1739
+ "128217": {
1740
+ "content": "<|reserved_special_token_209|>",
1741
+ "lstrip": false,
1742
+ "normalized": false,
1743
+ "rstrip": false,
1744
+ "single_word": false,
1745
+ "special": true
1746
+ },
1747
+ "128218": {
1748
+ "content": "<|reserved_special_token_210|>",
1749
+ "lstrip": false,
1750
+ "normalized": false,
1751
+ "rstrip": false,
1752
+ "single_word": false,
1753
+ "special": true
1754
+ },
1755
+ "128219": {
1756
+ "content": "<|reserved_special_token_211|>",
1757
+ "lstrip": false,
1758
+ "normalized": false,
1759
+ "rstrip": false,
1760
+ "single_word": false,
1761
+ "special": true
1762
+ },
1763
+ "128220": {
1764
+ "content": "<|reserved_special_token_212|>",
1765
+ "lstrip": false,
1766
+ "normalized": false,
1767
+ "rstrip": false,
1768
+ "single_word": false,
1769
+ "special": true
1770
+ },
1771
+ "128221": {
1772
+ "content": "<|reserved_special_token_213|>",
1773
+ "lstrip": false,
1774
+ "normalized": false,
1775
+ "rstrip": false,
1776
+ "single_word": false,
1777
+ "special": true
1778
+ },
1779
+ "128222": {
1780
+ "content": "<|reserved_special_token_214|>",
1781
+ "lstrip": false,
1782
+ "normalized": false,
1783
+ "rstrip": false,
1784
+ "single_word": false,
1785
+ "special": true
1786
+ },
1787
+ "128223": {
1788
+ "content": "<|reserved_special_token_215|>",
1789
+ "lstrip": false,
1790
+ "normalized": false,
1791
+ "rstrip": false,
1792
+ "single_word": false,
1793
+ "special": true
1794
+ },
1795
+ "128224": {
1796
+ "content": "<|reserved_special_token_216|>",
1797
+ "lstrip": false,
1798
+ "normalized": false,
1799
+ "rstrip": false,
1800
+ "single_word": false,
1801
+ "special": true
1802
+ },
1803
+ "128225": {
1804
+ "content": "<|reserved_special_token_217|>",
1805
+ "lstrip": false,
1806
+ "normalized": false,
1807
+ "rstrip": false,
1808
+ "single_word": false,
1809
+ "special": true
1810
+ },
1811
+ "128226": {
1812
+ "content": "<|reserved_special_token_218|>",
1813
+ "lstrip": false,
1814
+ "normalized": false,
1815
+ "rstrip": false,
1816
+ "single_word": false,
1817
+ "special": true
1818
+ },
1819
+ "128227": {
1820
+ "content": "<|reserved_special_token_219|>",
1821
+ "lstrip": false,
1822
+ "normalized": false,
1823
+ "rstrip": false,
1824
+ "single_word": false,
1825
+ "special": true
1826
+ },
1827
+ "128228": {
1828
+ "content": "<|reserved_special_token_220|>",
1829
+ "lstrip": false,
1830
+ "normalized": false,
1831
+ "rstrip": false,
1832
+ "single_word": false,
1833
+ "special": true
1834
+ },
1835
+ "128229": {
1836
+ "content": "<|reserved_special_token_221|>",
1837
+ "lstrip": false,
1838
+ "normalized": false,
1839
+ "rstrip": false,
1840
+ "single_word": false,
1841
+ "special": true
1842
+ },
1843
+ "128230": {
1844
+ "content": "<|reserved_special_token_222|>",
1845
+ "lstrip": false,
1846
+ "normalized": false,
1847
+ "rstrip": false,
1848
+ "single_word": false,
1849
+ "special": true
1850
+ },
1851
+ "128231": {
1852
+ "content": "<|reserved_special_token_223|>",
1853
+ "lstrip": false,
1854
+ "normalized": false,
1855
+ "rstrip": false,
1856
+ "single_word": false,
1857
+ "special": true
1858
+ },
1859
+ "128232": {
1860
+ "content": "<|reserved_special_token_224|>",
1861
+ "lstrip": false,
1862
+ "normalized": false,
1863
+ "rstrip": false,
1864
+ "single_word": false,
1865
+ "special": true
1866
+ },
1867
+ "128233": {
1868
+ "content": "<|reserved_special_token_225|>",
1869
+ "lstrip": false,
1870
+ "normalized": false,
1871
+ "rstrip": false,
1872
+ "single_word": false,
1873
+ "special": true
1874
+ },
1875
+ "128234": {
1876
+ "content": "<|reserved_special_token_226|>",
1877
+ "lstrip": false,
1878
+ "normalized": false,
1879
+ "rstrip": false,
1880
+ "single_word": false,
1881
+ "special": true
1882
+ },
1883
+ "128235": {
1884
+ "content": "<|reserved_special_token_227|>",
1885
+ "lstrip": false,
1886
+ "normalized": false,
1887
+ "rstrip": false,
1888
+ "single_word": false,
1889
+ "special": true
1890
+ },
1891
+ "128236": {
1892
+ "content": "<|reserved_special_token_228|>",
1893
+ "lstrip": false,
1894
+ "normalized": false,
1895
+ "rstrip": false,
1896
+ "single_word": false,
1897
+ "special": true
1898
+ },
1899
+ "128237": {
1900
+ "content": "<|reserved_special_token_229|>",
1901
+ "lstrip": false,
1902
+ "normalized": false,
1903
+ "rstrip": false,
1904
+ "single_word": false,
1905
+ "special": true
1906
+ },
1907
+ "128238": {
1908
+ "content": "<|reserved_special_token_230|>",
1909
+ "lstrip": false,
1910
+ "normalized": false,
1911
+ "rstrip": false,
1912
+ "single_word": false,
1913
+ "special": true
1914
+ },
1915
+ "128239": {
1916
+ "content": "<|reserved_special_token_231|>",
1917
+ "lstrip": false,
1918
+ "normalized": false,
1919
+ "rstrip": false,
1920
+ "single_word": false,
1921
+ "special": true
1922
+ },
1923
+ "128240": {
1924
+ "content": "<|reserved_special_token_232|>",
1925
+ "lstrip": false,
1926
+ "normalized": false,
1927
+ "rstrip": false,
1928
+ "single_word": false,
1929
+ "special": true
1930
+ },
1931
+ "128241": {
1932
+ "content": "<|reserved_special_token_233|>",
1933
+ "lstrip": false,
1934
+ "normalized": false,
1935
+ "rstrip": false,
1936
+ "single_word": false,
1937
+ "special": true
1938
+ },
1939
+ "128242": {
1940
+ "content": "<|reserved_special_token_234|>",
1941
+ "lstrip": false,
1942
+ "normalized": false,
1943
+ "rstrip": false,
1944
+ "single_word": false,
1945
+ "special": true
1946
+ },
1947
+ "128243": {
1948
+ "content": "<|reserved_special_token_235|>",
1949
+ "lstrip": false,
1950
+ "normalized": false,
1951
+ "rstrip": false,
1952
+ "single_word": false,
1953
+ "special": true
1954
+ },
1955
+ "128244": {
1956
+ "content": "<|reserved_special_token_236|>",
1957
+ "lstrip": false,
1958
+ "normalized": false,
1959
+ "rstrip": false,
1960
+ "single_word": false,
1961
+ "special": true
1962
+ },
1963
+ "128245": {
1964
+ "content": "<|reserved_special_token_237|>",
1965
+ "lstrip": false,
1966
+ "normalized": false,
1967
+ "rstrip": false,
1968
+ "single_word": false,
1969
+ "special": true
1970
+ },
1971
+ "128246": {
1972
+ "content": "<|reserved_special_token_238|>",
1973
+ "lstrip": false,
1974
+ "normalized": false,
1975
+ "rstrip": false,
1976
+ "single_word": false,
1977
+ "special": true
1978
+ },
1979
+ "128247": {
1980
+ "content": "<|reserved_special_token_239|>",
1981
+ "lstrip": false,
1982
+ "normalized": false,
1983
+ "rstrip": false,
1984
+ "single_word": false,
1985
+ "special": true
1986
+ },
1987
+ "128248": {
1988
+ "content": "<|reserved_special_token_240|>",
1989
+ "lstrip": false,
1990
+ "normalized": false,
1991
+ "rstrip": false,
1992
+ "single_word": false,
1993
+ "special": true
1994
+ },
1995
+ "128249": {
1996
+ "content": "<|reserved_special_token_241|>",
1997
+ "lstrip": false,
1998
+ "normalized": false,
1999
+ "rstrip": false,
2000
+ "single_word": false,
2001
+ "special": true
2002
+ },
2003
+ "128250": {
2004
+ "content": "<|reserved_special_token_242|>",
2005
+ "lstrip": false,
2006
+ "normalized": false,
2007
+ "rstrip": false,
2008
+ "single_word": false,
2009
+ "special": true
2010
+ },
2011
+ "128251": {
2012
+ "content": "<|reserved_special_token_243|>",
2013
+ "lstrip": false,
2014
+ "normalized": false,
2015
+ "rstrip": false,
2016
+ "single_word": false,
2017
+ "special": true
2018
+ },
2019
+ "128252": {
2020
+ "content": "<|reserved_special_token_244|>",
2021
+ "lstrip": false,
2022
+ "normalized": false,
2023
+ "rstrip": false,
2024
+ "single_word": false,
2025
+ "special": true
2026
+ },
2027
+ "128253": {
2028
+ "content": "<|reserved_special_token_245|>",
2029
+ "lstrip": false,
2030
+ "normalized": false,
2031
+ "rstrip": false,
2032
+ "single_word": false,
2033
+ "special": true
2034
+ },
2035
+ "128254": {
2036
+ "content": "<|reserved_special_token_246|>",
2037
+ "lstrip": false,
2038
+ "normalized": false,
2039
+ "rstrip": false,
2040
+ "single_word": false,
2041
+ "special": true
2042
+ },
2043
+ "128255": {
2044
+ "content": "<|reserved_special_token_247|>",
2045
+ "lstrip": false,
2046
+ "normalized": false,
2047
+ "rstrip": false,
2048
+ "single_word": false,
2049
+ "special": true
2050
+ }
2051
+ },
2052
+ "bos_token": "<|begin_of_text|>",
2053
+ "clean_up_tokenization_spaces": true,
2054
+ "eos_token": "<|end_of_text|>",
2055
+ "model_input_names": [
2056
+ "input_ids",
2057
+ "attention_mask"
2058
+ ],
2059
+ "model_max_length": 131072,
2060
+ "pad_token": "<|end_of_text|>",
2061
+ "tokenizer_class": "PreTrainedTokenizerFast"
2062
+ }
transformer/config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "EspressoDiTModel",
3
+ "_diffusers_version": "0.33.1",
4
+ "activation_fn": "gelu-approximate",
5
+ "attention_bias": true,
6
+ "attention_head_dim": 72,
7
+ "attention_type": "default",
8
+ "caption_channels": 2048,
9
+ "cross_attention_dim": 1152,
10
+ "dropout": 0.0,
11
+ "in_channels": 32,
12
+ "interpolation_scale": 2,
13
+ "norm_elementwise_affine": false,
14
+ "norm_eps": 1e-06,
15
+ "norm_num_groups": 32,
16
+ "norm_type": "ada_norm_single",
17
+ "num_attention_heads": 16,
18
+ "num_embeds_ada_norm": 1000,
19
+ "num_layers": 28,
20
+ "out_channels": 32,
21
+ "patch_size": 1,
22
+ "projector_dim": 2048,
23
+ "repa_depth": -1,
24
+ "sample_size": 32,
25
+ "upcast_attention": false,
26
+ "z_dims": [
27
+ 768
28
+ ]
29
+ }
transformer/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7944fadbbaf35ec7c0fe3392f9f3f49302f2613ad6b19f8d56870779b6df6568
3
+ size 1217101024
transformer/transformer.py ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Modifications Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ from typing import Any, Dict, Optional
17
+ import torch
18
+ import torch.nn as nn
19
+ from diffusers.models.modeling_outputs import Transformer2DModelOutput
20
+ from diffusers import PixArtTransformer2DModel as PixArtTransformer2DModelOriginal
21
+ from diffusers.configuration_utils import ConfigMixin, register_to_config
22
+ from diffusers.models.attention import BasicTransformerBlock
23
+ from diffusers.models.embeddings import PatchEmbed, PixArtAlphaTextProjection
24
+ from diffusers.models.modeling_utils import ModelMixin
25
+ from diffusers.models.normalization import AdaLayerNormSingle
26
+ from diffusers.utils import is_torch_version
27
+
28
+
29
+ def random_masking(x, mask_ratio):
30
+ """
31
+ Perform per-sample random masking by per-sample shuffling.
32
+ Per-sample shuffling is done by argsort random noise.
33
+ x: [N, L, D], sequence
34
+ """
35
+ N, L, D = x.shape # batch, length, dim
36
+ len_keep = int(L * (1 - mask_ratio))
37
+
38
+ noise = torch.rand(N, L, device=x.device) # noise in [0, 1]
39
+
40
+ ids_keep = torch.argsort(noise, dim=1)[:, :len_keep]
41
+ ids_keep, _ = torch.sort(ids_keep, dim=1)
42
+ x_masked = torch.gather(x, dim=1, index=ids_keep.unsqueeze(-1).repeat(1, 1, D))
43
+ return x_masked, ids_keep, len_keep
44
+
45
+
46
+ def build_projector(hidden_size, projector_dim, z_dim):
47
+ return nn.Sequential(
48
+ nn.Linear(hidden_size, projector_dim),
49
+ nn.SiLU(),
50
+ nn.Linear(projector_dim, projector_dim),
51
+ nn.SiLU(),
52
+ nn.Linear(projector_dim, z_dim),
53
+ )
54
+
55
+
56
+ # Source: https://github.com/NVlabs/Sana/blob/70459f414474c10c509e8b58f3f9442738f85577/diffusion/model/norms.py#L183
57
+ class RMSNorm(torch.nn.Module):
58
+ def __init__(self, dim: int, scale_factor=1.0, eps: float = 1e-6):
59
+ """
60
+ Initialize the RMSNorm normalization layer.
61
+
62
+ Args:
63
+ dim (int): The dimension of the input tensor.
64
+ eps (float, optional): A small value added to the denominator for numerical stability. Default is 1e-6.
65
+
66
+ Attributes:
67
+ eps (float): A small value added to the denominator for numerical stability.
68
+ weight (nn.Parameter): Learnable scaling parameter.
69
+
70
+ """
71
+ super().__init__()
72
+ self.eps = eps
73
+ self.weight = torch.nn.Parameter(torch.ones(dim) * scale_factor)
74
+
75
+ def _norm(self, x):
76
+ """
77
+ Apply the RMSNorm normalization to the input tensor.
78
+
79
+ Args:
80
+ x (torch.Tensor): The input tensor.
81
+
82
+ Returns:
83
+ torch.Tensor: The normalized tensor.
84
+
85
+ """
86
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
87
+
88
+ def forward(self, x):
89
+ """
90
+ Forward pass through the RMSNorm layer.
91
+
92
+ Args:
93
+ x (torch.Tensor): The input tensor.
94
+
95
+ Returns:
96
+ torch.Tensor: The output tensor after applying RMSNorm.
97
+
98
+ """
99
+ return (self.weight * self._norm(x.float())).type_as(x)
100
+
101
+
102
+ # Modified from: https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/pixart_transformer_2d.py
103
+ class EspressoDiTModel(ModelMixin, ConfigMixin):
104
+ _supports_gradient_checkpointing = True
105
+ _no_split_modules = ["BasicTransformerBlock", "PatchEmbed"]
106
+
107
+ @register_to_config
108
+ def __init__(
109
+ self,
110
+ num_attention_heads: int = 16,
111
+ attention_head_dim: int = 72,
112
+ in_channels: int = 4,
113
+ out_channels: Optional[int] = 8,
114
+ num_layers: int = 28,
115
+ dropout: float = 0.0,
116
+ norm_num_groups: int = 32,
117
+ cross_attention_dim: Optional[int] = 1152,
118
+ attention_bias: bool = True,
119
+ sample_size: int = 128,
120
+ patch_size: int = 2,
121
+ activation_fn: str = "gelu-approximate",
122
+ num_embeds_ada_norm: Optional[int] = 1000,
123
+ upcast_attention: bool = False,
124
+ norm_type: str = "ada_norm_single",
125
+ norm_elementwise_affine: bool = False,
126
+ norm_eps: float = 1e-6,
127
+ interpolation_scale: Optional[int] = None,
128
+ caption_channels: Optional[int] = None,
129
+ attention_type: Optional[str] = "default",
130
+ repa_depth=-1,
131
+ projector_dim=2048,
132
+ z_dims=[768],
133
+ ):
134
+ super().__init__()
135
+ # copy over some functions to avoid duplicating the code
136
+ _tmp_original_model = PixArtTransformer2DModelOriginal()
137
+ self.fuse_qkv_projections = _tmp_original_model.fuse_qkv_projections
138
+ self.unfuse_qkv_projections = _tmp_original_model.unfuse_qkv_projections
139
+ self.set_default_attn_processor = _tmp_original_model.set_default_attn_processor
140
+ self.set_attn_processor = _tmp_original_model.set_attn_processor
141
+ self.attn_processors = _tmp_original_model.attn_processors
142
+ del _tmp_original_model
143
+
144
+ self.patch_mixer_depth = None # initially no masking applied
145
+ self.mask_ratio = 0
146
+
147
+ if repa_depth != -1:
148
+ self.projectors = nn.ModuleList(
149
+ [build_projector(cross_attention_dim, projector_dim, z_dim) for z_dim in z_dims]
150
+ )
151
+ assert repa_depth >= 0 and repa_depth < num_layers
152
+ self.repa_depth = repa_depth
153
+
154
+ # Validate inputs.
155
+ if norm_type != "ada_norm_single":
156
+ raise NotImplementedError(
157
+ f"Forward pass is not implemented when `patch_size` is not None and `norm_type` is '{norm_type}'."
158
+ )
159
+ elif norm_type == "ada_norm_single" and num_embeds_ada_norm is None:
160
+ raise ValueError(
161
+ f"When using a `patch_size` and this `norm_type` ({norm_type}), `num_embeds_ada_norm` cannot be None."
162
+ )
163
+
164
+ # Set some common variables used across the board.
165
+ self.attention_head_dim = attention_head_dim
166
+ self.inner_dim = self.config.num_attention_heads * self.config.attention_head_dim
167
+ self.out_channels = in_channels if out_channels is None else out_channels
168
+
169
+ self.gradient_checkpointing = False
170
+
171
+ # 2. Initialize the position embedding and transformer blocks.
172
+ self.height = self.config.sample_size
173
+ self.width = self.config.sample_size
174
+
175
+ interpolation_scale = (
176
+ self.config.interpolation_scale
177
+ if self.config.interpolation_scale is not None
178
+ else max(self.config.sample_size // 64, 1)
179
+ )
180
+
181
+ self.pos_embed = PatchEmbed(
182
+ height=self.config.sample_size,
183
+ width=self.config.sample_size,
184
+ patch_size=self.config.patch_size,
185
+ in_channels=self.config.in_channels,
186
+ embed_dim=self.inner_dim,
187
+ interpolation_scale=interpolation_scale,
188
+ )
189
+
190
+ self.transformer_blocks = nn.ModuleList(
191
+ [
192
+ BasicTransformerBlock(
193
+ self.inner_dim,
194
+ self.config.num_attention_heads,
195
+ self.config.attention_head_dim,
196
+ dropout=self.config.dropout,
197
+ cross_attention_dim=self.config.cross_attention_dim,
198
+ activation_fn=self.config.activation_fn,
199
+ num_embeds_ada_norm=self.config.num_embeds_ada_norm,
200
+ attention_bias=self.config.attention_bias,
201
+ upcast_attention=self.config.upcast_attention,
202
+ norm_type=norm_type,
203
+ norm_elementwise_affine=self.config.norm_elementwise_affine,
204
+ norm_eps=self.config.norm_eps,
205
+ attention_type=self.config.attention_type,
206
+ )
207
+ for _ in range(self.config.num_layers)
208
+ ]
209
+ )
210
+
211
+ # 3. Output blocks.
212
+ self.norm_out = nn.LayerNorm(self.inner_dim, elementwise_affine=False, eps=1e-6)
213
+ self.scale_shift_table = nn.Parameter(torch.randn(2, self.inner_dim) / self.inner_dim**0.5)
214
+ self.proj_out = nn.Linear(
215
+ self.inner_dim,
216
+ self.config.patch_size * self.config.patch_size * self.out_channels,
217
+ )
218
+
219
+ self.adaln_single = AdaLayerNormSingle(self.inner_dim, use_additional_conditions=False)
220
+ self.caption_projection = None
221
+ if self.config.caption_channels is not None:
222
+ self.caption_projection = PixArtAlphaTextProjection(
223
+ in_features=self.config.caption_channels, hidden_size=self.inner_dim
224
+ )
225
+
226
+ self.text_embedding_norm = RMSNorm(
227
+ self.inner_dim if self.caption_projection else self.config.caption_channels,
228
+ scale_factor=0.01,
229
+ eps=1e-5,
230
+ )
231
+
232
+ def _set_gradient_checkpointing(self, module, value=False):
233
+ if hasattr(module, "gradient_checkpointing"):
234
+ module.gradient_checkpointing = value
235
+
236
+ def forward(
237
+ self,
238
+ hidden_states: torch.Tensor,
239
+ encoder_hidden_states: Optional[torch.Tensor] = None,
240
+ timestep: Optional[torch.LongTensor] = None,
241
+ cross_attention_kwargs: Dict[str, Any] = None,
242
+ attention_mask: Optional[torch.Tensor] = None,
243
+ encoder_attention_mask: Optional[torch.Tensor] = None,
244
+ return_dict: bool = True,
245
+ ):
246
+ """
247
+ Args:
248
+ hidden_states (`torch.FloatTensor` of shape `(batch size, channel, height, width)`):
249
+ Input `hidden_states`.
250
+ encoder_hidden_states (`torch.FloatTensor` of shape `(batch size, sequence len, embed dims)`, *optional*):
251
+ Conditional embeddings for cross attention layer. If not given, cross-attention defaults to
252
+ self-attention.
253
+ timestep (`torch.LongTensor`, *optional*):
254
+ Used to indicate denoising step. Optional timestep to be applied as an embedding in `AdaLayerNorm`.
255
+ cross_attention_kwargs ( `Dict[str, Any]`, *optional*):
256
+ A kwargs dictionary that if specified is passed along to the `AttentionProcessor` as defined under
257
+ `self.processor` in
258
+ [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
259
+ attention_mask ( `torch.Tensor`, *optional*):
260
+ An attention mask of shape `(batch, key_tokens)` is applied to `encoder_hidden_states`. If `1` the mask
261
+ is kept, otherwise if `0` it is discarded. Mask will be converted into a bias, which adds large
262
+ negative values to the attention scores corresponding to "discard" tokens.
263
+ encoder_attention_mask ( `torch.Tensor`, *optional*):
264
+ Cross-attention mask applied to `encoder_hidden_states`. Two formats supported:
265
+
266
+ * Mask `(batch, sequence_length)` True = keep, False = discard.
267
+ * Bias `(batch, 1, sequence_length)` 0 = keep, -10000 = discard.
268
+
269
+ If `ndim == 2`: will be interpreted as a mask, then converted into a bias consistent with the format
270
+ above. This bias will be added to the cross-attention scores.
271
+ return_dict (`bool`, *optional*, defaults to `True`):
272
+ Whether or not to return a [`~models.unets.unet_2d_condition.UNet2DConditionOutput`] instead of a plain
273
+ tuple.
274
+
275
+ Returns:
276
+ If `return_dict` is True, an [`~models.transformer_2d.Transformer2DModelOutput`] is returned, otherwise a
277
+ `tuple` where the first element is the sample tensor.
278
+ """
279
+
280
+ # ensure attention_mask is a bias, and give it a singleton query_tokens dimension.
281
+ # we may have done this conversion already, e.g. if we came here via UNet2DConditionModel#forward.
282
+ # we can tell by counting dims; if ndim == 2: it's a mask rather than a bias.
283
+ # expects mask of shape:
284
+ # [batch, key_tokens]
285
+ # adds singleton query_tokens dimension:
286
+ # [batch, 1, key_tokens]
287
+ # this helps to broadcast it as a bias over attention scores, which will be in one of the following shapes:
288
+ # [batch, heads, query_tokens, key_tokens] (e.g. torch sdp attn)
289
+ # [batch * heads, query_tokens, key_tokens] (e.g. xformers or classic attn)
290
+ if attention_mask is not None and attention_mask.ndim == 2:
291
+ # assume that mask is expressed as:
292
+ # (1 = keep, 0 = discard)
293
+ # convert mask into a bias that can be added to attention scores:
294
+ # (keep = +0, discard = -10000.0)
295
+ attention_mask = (1 - attention_mask.to(hidden_states.dtype)) * -10000.0
296
+ attention_mask = attention_mask.unsqueeze(1)
297
+
298
+ # convert encoder_attention_mask to a bias the same way we do for attention_mask
299
+ if encoder_attention_mask is not None and encoder_attention_mask.ndim == 2:
300
+ encoder_attention_mask = (1 - encoder_attention_mask.to(hidden_states.dtype)) * -10000.0
301
+ encoder_attention_mask = encoder_attention_mask.unsqueeze(1)
302
+
303
+ # 1. Input
304
+ batch_size = hidden_states.shape[0]
305
+ height, width = (
306
+ hidden_states.shape[-2] // self.config.patch_size,
307
+ hidden_states.shape[-1] // self.config.patch_size,
308
+ )
309
+ hidden_states = self.pos_embed(hidden_states)
310
+
311
+ timestep, embedded_timestep = self.adaln_single(
312
+ timestep,
313
+ batch_size=batch_size,
314
+ hidden_dtype=hidden_states.dtype,
315
+ )
316
+
317
+ if self.caption_projection is not None:
318
+ encoder_hidden_states = self.caption_projection(encoder_hidden_states)
319
+ encoder_hidden_states = encoder_hidden_states.view(batch_size, -1, hidden_states.shape[-1])
320
+
321
+ encoder_hidden_states = self.text_embedding_norm(encoder_hidden_states)
322
+
323
+ ids_keep = None
324
+ len_keep = hidden_states.shape[1]
325
+ zs = None
326
+ # 2. Blocks
327
+ for blk_ind, block in enumerate(self.transformer_blocks):
328
+ if self.training and self.gradient_checkpointing and block.gradient_checkpointing:
329
+
330
+ def create_custom_forward(module, return_dict=None):
331
+ def custom_forward(*inputs):
332
+ if return_dict is not None:
333
+ return module(*inputs, return_dict=return_dict)
334
+ else:
335
+ return module(*inputs)
336
+
337
+ return custom_forward
338
+
339
+ ckpt_kwargs: Dict[str, Any] = {"use_reentrant": False} if is_torch_version(">=", "1.11.0") else {}
340
+ hidden_states = torch.utils.checkpoint.checkpoint(
341
+ create_custom_forward(block),
342
+ hidden_states,
343
+ attention_mask,
344
+ encoder_hidden_states,
345
+ encoder_attention_mask,
346
+ timestep,
347
+ cross_attention_kwargs,
348
+ None,
349
+ **ckpt_kwargs,
350
+ )
351
+ else:
352
+ hidden_states = block(
353
+ hidden_states,
354
+ attention_mask=attention_mask,
355
+ encoder_hidden_states=encoder_hidden_states,
356
+ encoder_attention_mask=encoder_attention_mask,
357
+ timestep=timestep,
358
+ cross_attention_kwargs=cross_attention_kwargs,
359
+ class_labels=None,
360
+ )
361
+
362
+ # patch masking
363
+ if self.training and (self.patch_mixer_depth != -1) and (self.patch_mixer_depth == blk_ind):
364
+ hidden_states, ids_keep, len_keep = random_masking(hidden_states, self.mask_ratio)
365
+
366
+ # REPA
367
+ if self.training and (self.repa_depth != -1) and (self.repa_depth == blk_ind):
368
+ N, T, D = hidden_states.shape
369
+ zs = [projector(hidden_states.reshape(-1, D)).reshape(N, len_keep, -1) for projector in self.projectors]
370
+
371
+ # 3. Output
372
+ shift, scale = (
373
+ self.scale_shift_table[None] + embedded_timestep[:, None].to(self.scale_shift_table.device)
374
+ ).chunk(2, dim=1)
375
+ hidden_states = self.norm_out(hidden_states)
376
+ # Modulation
377
+ hidden_states = hidden_states * (1 + scale.to(hidden_states.device)) + shift.to(hidden_states.device)
378
+ hidden_states = self.proj_out(hidden_states)
379
+ hidden_states = hidden_states.squeeze(1)
380
+
381
+ # if inference, return the unpatchified output as usual
382
+ # if training, return the patch sequence
383
+ if not self.training:
384
+ hidden_states = hidden_states.reshape(
385
+ shape=(
386
+ -1,
387
+ height,
388
+ width,
389
+ self.config.patch_size,
390
+ self.config.patch_size,
391
+ self.out_channels,
392
+ )
393
+ )
394
+ hidden_states = torch.einsum("nhwpqc->nchpwq", hidden_states)
395
+ output = hidden_states.reshape(
396
+ shape=(
397
+ -1,
398
+ self.out_channels,
399
+ height * self.config.patch_size,
400
+ width * self.config.patch_size,
401
+ )
402
+ )
403
+
404
+ if not return_dict:
405
+ return (output,)
406
+
407
+ return Transformer2DModelOutput(sample=output)
408
+ else:
409
+ return hidden_states, ids_keep, zs
410
+
411
+ def enable_masking(self, depth, mask_ratio):
412
+ # depth: apply masking after block_[depth]. should be [0, nblks-1]
413
+ assert depth >= 0 and depth < len(self.transformer_blocks)
414
+ self.patch_mixer_depth = depth
415
+ assert mask_ratio >= 0 and mask_ratio <= 1
416
+ self.mask_ratio = mask_ratio
417
+
418
+ def disable_masking(self):
419
+ self.patch_mixer_depth = None
420
+
421
+ def enable_gradient_checkpointing(self, nblocks_to_apply_grad_checkpointing):
422
+ N = len(self.transformer_blocks)
423
+
424
+ if nblocks_to_apply_grad_checkpointing == -1:
425
+ nblocks_to_apply_grad_checkpointing = N
426
+ nblocks_to_apply_grad_checkpointing = min(N, nblocks_to_apply_grad_checkpointing)
427
+
428
+ # Apply to blocks evenly spaced out
429
+ step = N / nblocks_to_apply_grad_checkpointing if nblocks_to_apply_grad_checkpointing > 0 else 0
430
+ indices = [int((i + 0.5) * step) for i in range(nblocks_to_apply_grad_checkpointing)]
431
+
432
+ self.gradient_checkpointing = True
433
+ for blk_ind, block in enumerate(self.transformer_blocks):
434
+ block.gradient_checkpointing = blk_ind in indices
435
+ print(f"Block {blk_ind} grad checkpointing set to {block.gradient_checkpointing}")
vae/config.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "AutoencoderDC",
3
+ "_diffusers_version": "0.33.1",
4
+ "_name_or_path": "mit-han-lab/dc-ae-f32c32-sana-1.0-diffusers",
5
+ "attention_head_dim": 32,
6
+ "decoder_act_fns": "silu",
7
+ "decoder_block_out_channels": [
8
+ 128,
9
+ 256,
10
+ 512,
11
+ 512,
12
+ 1024,
13
+ 1024
14
+ ],
15
+ "decoder_block_types": [
16
+ "ResBlock",
17
+ "ResBlock",
18
+ "ResBlock",
19
+ "EfficientViTBlock",
20
+ "EfficientViTBlock",
21
+ "EfficientViTBlock"
22
+ ],
23
+ "decoder_layers_per_block": [
24
+ 3,
25
+ 3,
26
+ 3,
27
+ 3,
28
+ 3,
29
+ 3
30
+ ],
31
+ "decoder_norm_types": "rms_norm",
32
+ "decoder_qkv_multiscales": [
33
+ [],
34
+ [],
35
+ [],
36
+ [
37
+ 5
38
+ ],
39
+ [
40
+ 5
41
+ ],
42
+ [
43
+ 5
44
+ ]
45
+ ],
46
+ "downsample_block_type": "Conv",
47
+ "encoder_block_out_channels": [
48
+ 128,
49
+ 256,
50
+ 512,
51
+ 512,
52
+ 1024,
53
+ 1024
54
+ ],
55
+ "encoder_block_types": [
56
+ "ResBlock",
57
+ "ResBlock",
58
+ "ResBlock",
59
+ "EfficientViTBlock",
60
+ "EfficientViTBlock",
61
+ "EfficientViTBlock"
62
+ ],
63
+ "encoder_layers_per_block": [
64
+ 2,
65
+ 2,
66
+ 2,
67
+ 3,
68
+ 3,
69
+ 3
70
+ ],
71
+ "encoder_qkv_multiscales": [
72
+ [],
73
+ [],
74
+ [],
75
+ [
76
+ 5
77
+ ],
78
+ [
79
+ 5
80
+ ],
81
+ [
82
+ 5
83
+ ]
84
+ ],
85
+ "in_channels": 3,
86
+ "latent_channels": 32,
87
+ "scaling_factor": 0.41407,
88
+ "upsample_block_type": "interpolate"
89
+ }
vae/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:124bbf5ed3c731b41243c49141480c92b3428d132d3bdfa690c8a1d92b45f16c
3
+ size 624544454