gurgutan commited on
Commit
64ab343
·
verified ·
1 Parent(s): 1639c79

Upload 9 files

Browse files

---
license: mit
language:
- ru
- en
pipeline_tag: feature-extraction
tags:
- MTEB
- transformers
library_name: sentence-transformers
---
## Giga-Embeddings-instruct-bnb-4bit

Модель создана путем квантизации Giga-Embeddings-instruct модулем BitsAndBytes в формат 4 бит.

- Base Decoder-only LLM: GigaChat-3b
- Pooling Type: Latent-Attention
- Embedding Dimension: 2048

Для получения более подробной информации о технических деталях, пожалуйста, обратитесь к нашей [статье](https://aclanthology.org/2025.bsnlp-1.3/).

## Использование

Ниже приведен пример кодирования запросов и текстов.

### Requirements

```bash
pip install -q transformers==4.51.0 sentence-transformers==5.1.1 flash-attn langchain_community langchain_huggingface langchain_gigachat
```

### Transformers

```python
import torch
import torch.nn.functional as F

from torch import Tensor
from transformers import AutoTokenizer, AutoModel


def get_detailed_instruct(task_description: str, query: str) -> str:
return f'Instruct: {task_description}\nQuery: {query}'

# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'

queries = [
get_detailed_instruct(task, 'What is the capital of Russia?'),
get_detailed_instruct(task, 'Explain gravity')
]
# No need to add instruction for retrieval documents
documents = [
"The capital of Russia is Moscow.",
"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]
input_texts = queries + documents

# We recommend enabling flash_attention_2 for better acceleration and memory saving.
tokenizer = AutoTokenizer.from_pretrained(
'ai-sage/Giga-Embeddings-instruct',
trust_remote_code=True
)
model = AutoModel.from_pretrained(
'ai-sage/Giga-Embeddings-instruct',
attn_implementation="flash_attention_2",
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
model.eval()
model.cuda()

max_length = 4096

# Tokenize the input texts
batch_dict = tokenizer(
input_texts,
padding=True,
truncation=True,
max_length=max_length,
return_tensors="pt",
)
batch_dict.to(model.device)
embeddings = model(**batch_dict, return_embeddings=True)

scores = (embeddings[:2] @ embeddings[2:].T)
print(scores.tolist())
# [[0.58203125, 0.0712890625], [0.06884765625, 0.62109375]]
```

### Sentence Transformers

```python
import torch

from sentence_transformers import SentenceTransformer

# Load the model
# We recommend enabling flash_attention_2 for better acceleration and memory saving
model = SentenceTransformer(
"ai-sage/Giga-Embeddings-instruct",
model_kwargs={
"attn_implementation": "flash_attention_2",
"torch_dtype": torch.bfloat16,
"trust_remote_code": "True"
},
config_kwargs={
"trust_remote_code": "True"
}
)
model.max_seq_length = 4096

# The queries and documents to embed
queries = [
'What is the capital of Russia?',
'Explain gravity'
]
# No need to add instruction for retrieval documents
documents = [
"The capital of Russia is Moscow.",
"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]

# Encode the queries and documents. Note that queries benefit from using a prompt
query_embeddings = model.encode(queries, prompt='Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery: ')
document_embeddings = model.encode(documents)

# Compute the (cosine) similarity between the query and document embeddings
similarity = model.similarity(query_embeddings, document_embeddings)
print(similarity)
# tensor([[0.5846, 0.0702],
# [0.0691, 0.6207]])
```

### LangChain

```python
import torch

from langchain_huggingface import HuggingFaceEmbeddings

# Load model
embeddings = HuggingFaceEmbeddings(
model_name='ai-sage/Giga-Embeddings-instruct',
encode_kwargs={},
model_kwargs={
'device': 'cuda',
'trust_remote_code': True,
'model_kwargs': {'torch_dtype': torch.bfloat16},
'prompts': {'query': 'Instruct: Given a question, retrieve passages that answer the question\nQuery: '}
}
)

# Tokenizer
embeddings._client.tokenizer.tokenize("Hello world! I am GigaChat")

# Query embeddings
query_embeddings = embeddings.embed_query("Hello world!")
print(f"Your embeddings: {query_embeddings[0:20]}...")
print(f"Vector size: {len(query_embeddings)}")

# Document embeddings
documents = ["foo bar", "bar foo"]
documents_embeddings = embeddings.embed_documents(documents)
print(f"Vector size: {len(documents_embeddings)} x {len(documents_embeddings[0])}")
```

## Инструктивность

**Использование инструкций для улучшения качества эмбеддингов**

Для достижения более точных результатов при работе с эмбеддингами, особенно в задачах поиска и извлечения информации (retrieval), рекомендуется добавлять инструкцию на естественном языке перед текстовым запросом (query). Это помогает модели лучше понять контекст и цель запроса, что положительно сказывается на качестве результатов. Важно отметить, что инструкцию нужно добавлять только перед запросом, а не перед документом.

Для **симметричных задач**, таких как классификация (classification) или семантическое сравнение текстов (semantic text similarity), инструкцию необходимо добавлять перед каждым запросом. Это связано с тем, что такие задачи требуют одинакового контекста для всех входных данных, чтобы модель могла корректно сравнивать или классифицировать их.

**Примеры инструкций для симметричных задач:**
- `"Retrieve semantically similar text"`
- `"Given a text, retrieve semantically similar text"`
- `"Дано предложение, необходимо найти его парафраз"`
- `"Классифицируй отзыв на товар как положительный, отрицательный или нейтральный"`
- `"Классифицируй чувствительную тему по запросу"`

Для **retrieval-задач** (например, поиск ответа в тексте) можно использовать инструкцию:
`'Дан вопрос, необходимо найти абзац текста с ответом'`.

Такой подход особенно эффективен для задач поиска и извлечения информации, таких как поиск релевантных документов или извлечение ответов из текста.

**Примеры инструкций для retrieval-задач:**
- `'Дан вопрос, необходимо найти абзац текста с ответом'`
- `'Given the question, find a paragraph with the answer'`

Инструкции необходимо оборачивать в шаблон: `f'Instruct: {task_description}\nQuery: {query}'`. Использование инструкций позволяет значительно улучшить качество поиска и релевантность результатов, что подтверждается тестами на бенчмарках, таких как RuBQ, MIRACL. Для симметричных задач добавление инструкции перед каждым запросом обеспечивает согласованность и повышает точность модели.

## Поддерживаемые языки

Эта модель инициализирована pretrain моделью GigaChat и дополнительно обучена на смеси английских и русских данных.

## FAQ

1. Нужно ли добавлять инструкции к запросу?

Да, именно так модель обучалась, иначе вы увидите снижение качества. Определение задачи должно быть инструкцией в одном предложении, которая описывает задачу. Это способ настройки текстовых эмбеддингов для разных сценариев с помощью инструкций на естественном языке.

С другой стороны, добавлять инструкции на сторону документа не требуется.

2. Почему мои воспроизведённые результаты немного отличаются от указанных в карточке модели?

Разные версии библиотек transformers и pytorch могут вызывать незначительные, но ненулевые различия в результатах.


## Ограничения

Использование этой модели для входных данных, содержащих более 4096 токенов, невозможно.

.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.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {%- for message in messages -%}{{ message['content'] }}{%- if not loop.last -%}{{ ' ' }}{%- endif -%}{%- endfor -%}
config.json ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_non_freeze_layers_idxs": null,
3
+ "activation_checkpoint_layers_num": null,
4
+ "add_eos": true,
5
+ "add_pad_token": true,
6
+ "apply_torch_compile_to_projections": true,
7
+ "architectures": [
8
+ "GigarEmbedModel"
9
+ ],
10
+ "auto_map": {
11
+ "AutoConfig": "configuration_gigarembed.GigarEmbedConfig",
12
+ "AutoModel": "modeling_gigarembed.GigarEmbedModel"
13
+ },
14
+ "hidden_size": 2048,
15
+ "is_mask_instruction": true,
16
+ "latent_attention_config": {
17
+ "_name_or_path": "",
18
+ "add_cross_attention": false,
19
+ "architectures": null,
20
+ "bad_words_ids": null,
21
+ "begin_suppress_tokens": null,
22
+ "bos_token_id": null,
23
+ "chunk_size_feed_forward": 0,
24
+ "cross_attention_hidden_size": null,
25
+ "cross_dim_head": 2048,
26
+ "decoder_start_token_id": null,
27
+ "diversity_penalty": 0.0,
28
+ "do_sample": false,
29
+ "early_stopping": false,
30
+ "encoder_no_repeat_ngram_size": 0,
31
+ "eos_token_id": null,
32
+ "exponential_decay_length_penalty": null,
33
+ "finetuning_task": null,
34
+ "forced_bos_token_id": null,
35
+ "forced_eos_token_id": null,
36
+ "hidden_dim": 2048,
37
+ "id2label": {
38
+ "0": "LABEL_0",
39
+ "1": "LABEL_1"
40
+ },
41
+ "is_decoder": false,
42
+ "is_encoder_decoder": false,
43
+ "label2id": {
44
+ "LABEL_0": 0,
45
+ "LABEL_1": 1
46
+ },
47
+ "latent_dim": 2048,
48
+ "length_penalty": 1.0,
49
+ "max_length": 20,
50
+ "min_length": 0,
51
+ "model_type": "latent_attention",
52
+ "mult": 4,
53
+ "no_repeat_ngram_size": 0,
54
+ "num_beam_groups": 1,
55
+ "num_beams": 1,
56
+ "num_cross_heads": 8,
57
+ "num_latents_value": 512,
58
+ "num_return_sequences": 1,
59
+ "output_attentions": false,
60
+ "output_hidden_states": false,
61
+ "output_scores": false,
62
+ "pad_token_id": null,
63
+ "prefix": null,
64
+ "problem_type": null,
65
+ "pruned_heads": {},
66
+ "remove_invalid_values": false,
67
+ "repetition_penalty": 1.0,
68
+ "return_dict": true,
69
+ "return_dict_in_generate": false,
70
+ "sep_token_id": null,
71
+ "suppress_tokens": null,
72
+ "task_specific_params": null,
73
+ "temperature": 1.0,
74
+ "tf_legacy_loss": false,
75
+ "tie_encoder_decoder": false,
76
+ "tie_word_embeddings": true,
77
+ "tokenizer_class": null,
78
+ "top_k": 50,
79
+ "top_p": 1.0,
80
+ "torch_dtype": null,
81
+ "torchscript": false,
82
+ "typical_p": 1.0,
83
+ "use_bfloat16": false
84
+ },
85
+ "mask_type": "b",
86
+ "model_type": "gigarembed",
87
+ "padding_side": "right",
88
+ "quantization_config": {
89
+ "_load_in_4bit": true,
90
+ "_load_in_8bit": false,
91
+ "bnb_4bit_compute_dtype": "bfloat16",
92
+ "bnb_4bit_quant_storage": "uint8",
93
+ "bnb_4bit_quant_type": "nf4",
94
+ "bnb_4bit_use_double_quant": true,
95
+ "llm_int8_enable_fp32_cpu_offload": false,
96
+ "llm_int8_has_fp16_weight": false,
97
+ "llm_int8_skip_modules": null,
98
+ "llm_int8_threshold": 6.0,
99
+ "load_in_4bit": true,
100
+ "load_in_8bit": false,
101
+ "quant_method": "bitsandbytes"
102
+ },
103
+ "text_config": {
104
+ "_name_or_path": "ai-sage/Giga-Embeddings-instruct",
105
+ "add_cross_attention": false,
106
+ "apply_qk_norm": true,
107
+ "architectures": null,
108
+ "attention_bias": false,
109
+ "attention_dropout": 0.0,
110
+ "attention_hidden_size": null,
111
+ "attention_type": "LlamaLatentAttention",
112
+ "bad_words_ids": null,
113
+ "begin_suppress_tokens": null,
114
+ "bos_token_id": 1,
115
+ "chunk_size_feed_forward": 0,
116
+ "cross_attention_hidden_size": null,
117
+ "decoder_start_token_id": null,
118
+ "delete_logits": true,
119
+ "deterministic_attention": false,
120
+ "diversity_penalty": 0.0,
121
+ "do_sample": false,
122
+ "early_stopping": false,
123
+ "enable_async_tp": false,
124
+ "encoder_no_repeat_ngram_size": 0,
125
+ "eos_token_id": 2,
126
+ "exponential_decay_length_penalty": null,
127
+ "finetuning_task": null,
128
+ "forced_bos_token_id": null,
129
+ "forced_eos_token_id": null,
130
+ "freeze_non_embed": false,
131
+ "fused_mlp": true,
132
+ "fused_mlp_checkpoint_lvl": 3,
133
+ "head_dim": 64,
134
+ "hidden_act": "silu",
135
+ "hidden_size": 2048,
136
+ "id2label": {
137
+ "0": "LABEL_0",
138
+ "1": "LABEL_1"
139
+ },
140
+ "ignore_index": -100,
141
+ "init_device": "meta",
142
+ "initializer_range": 0.02,
143
+ "intermediate_size": 11008,
144
+ "is_decoder": false,
145
+ "is_encoder_decoder": false,
146
+ "kv_lora_rank": 1024,
147
+ "label2id": {
148
+ "LABEL_0": 0,
149
+ "LABEL_1": 1
150
+ },
151
+ "length_penalty": 1.0,
152
+ "lora_alpha": null,
153
+ "lora_r": null,
154
+ "loss_inplace_backward": false,
155
+ "max_length": 20,
156
+ "max_position_embeddings": 4096,
157
+ "max_window_layers": 36,
158
+ "min_length": 0,
159
+ "mla_config": {
160
+ "kv_lora_rank": 1024,
161
+ "q_lora_rank": 0,
162
+ "qk_nope_head_dim": 64,
163
+ "qk_rope_head_dim": 64,
164
+ "v_head_dim": 128
165
+ },
166
+ "mlp_bias": false,
167
+ "model_type": "gigar",
168
+ "mtp_loss_weight": 0.1,
169
+ "mtp_predictor_num": 1,
170
+ "no_repeat_ngram_size": 0,
171
+ "norm_type": "LlamaRMSNorm",
172
+ "num_attention_heads": 16,
173
+ "num_beam_groups": 1,
174
+ "num_beams": 1,
175
+ "num_hidden_layers": 36,
176
+ "num_key_value_heads": 16,
177
+ "num_return_sequences": 1,
178
+ "output_attentions": false,
179
+ "output_hidden_states": false,
180
+ "output_scores": false,
181
+ "pad_token_id": 2,
182
+ "parallel_embedding_type": "EmbeddingParallelEmbedding",
183
+ "prefix": null,
184
+ "pretraining_tp": 1,
185
+ "problem_type": null,
186
+ "pruned_heads": {},
187
+ "q_lora_rank": 0,
188
+ "qk_nope_head_dim": 64,
189
+ "qk_rope_head_dim": 64,
190
+ "remove_invalid_values": false,
191
+ "repetition_penalty": 1.0,
192
+ "return_dict": true,
193
+ "return_dict_in_generate": false,
194
+ "rms_norm_eps": 1e-06,
195
+ "rope_scaling": null,
196
+ "rope_theta": 100000.0,
197
+ "sep_token_id": null,
198
+ "skip_init_tp_modules": true,
199
+ "sliding_window": null,
200
+ "sp_split_type": "equal",
201
+ "suppress_tokens": null,
202
+ "task_specific_params": null,
203
+ "temperature": 1.0,
204
+ "tf_legacy_loss": false,
205
+ "tie_encoder_decoder": false,
206
+ "tie_word_embeddings": false,
207
+ "tokenizer_class": null,
208
+ "top_k": 50,
209
+ "top_p": 1.0,
210
+ "torch_dtype": null,
211
+ "torchscript": false,
212
+ "tp_group": null,
213
+ "tp_size": 1,
214
+ "typical_p": 1.0,
215
+ "unk_token_id": 0,
216
+ "use_bfloat16": false,
217
+ "use_cache": false,
218
+ "use_cache_force": false,
219
+ "use_custom_rotary_kernel": false,
220
+ "use_liger": false,
221
+ "use_mrope": false,
222
+ "use_mtp": true,
223
+ "use_sliding_window": false,
224
+ "v_head_dim": 128,
225
+ "varlen_input": true,
226
+ "vocab_size": 128256,
227
+ "z_loss_eps": 5e-05
228
+ },
229
+ "torch_dtype": "float16",
230
+ "transformers_version": "4.53.2"
231
+ }
configuration_gigarembed.py ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+
3
+ from typing import Literal
4
+ from transformers import AutoConfig
5
+ from transformers.models.auto import CONFIG_MAPPING
6
+ from transformers.configuration_utils import PretrainedConfig
7
+ from transformers.modeling_rope_utils import rope_config_validation
8
+
9
+ GIGAREMBED_TYPE = "gigarembed"
10
+ LATENT_ATTENTION_TYPE = "latent_attention"
11
+
12
+
13
+ class GigarConfig(PretrainedConfig):
14
+ r"""
15
+ This is the configuration class to store the configuration of a [`GigarModel`]. It is used to instantiate an Gigar
16
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
17
+ defaults will yield a similar configuration to that of the Gigar-7B.
18
+
19
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
20
+ documentation from [`PretrainedConfig`] for more information.
21
+
22
+
23
+ Args:
24
+ vocab_size (`int`, *optional*, defaults to 32000):
25
+ Vocabulary size of the Gigar model. Defines the number of different tokens that can be represented by the
26
+ `inputs_ids` passed when calling [`GigarModel`]
27
+ hidden_size (`int`, *optional*, defaults to 4096):
28
+ Dimension of the hidden representations.
29
+ intermediate_size (`int`, *optional*, defaults to 11008):
30
+ Dimension of the MLP representations.
31
+ num_hidden_layers (`int`, *optional*, defaults to 32):
32
+ Number of hidden layers in the Transformer decoder.
33
+ num_attention_heads (`int`, *optional*, defaults to 32):
34
+ Number of attention heads for each attention layer in the Transformer decoder.
35
+ num_key_value_heads (`int`, *optional*):
36
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
37
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
38
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
39
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
40
+ by meanpooling all the original heads within that group. For more details checkout [this
41
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
42
+ `num_attention_heads`.
43
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
44
+ The non-linear activation function (function or string) in the decoder.
45
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
46
+ The maximum sequence length that this model might ever be used with. Gigar 1 supports up to 2048 tokens,
47
+ Gigar 2 up to 4096, CodeLlama up to 16384.
48
+ initializer_range (`float`, *optional*, defaults to 0.02):
49
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
50
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
51
+ The epsilon used by the rms normalization layers.
52
+ use_cache (`bool`, *optional*, defaults to `True`):
53
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
54
+ relevant if `config.is_decoder=True`.
55
+ pad_token_id (`int`, *optional*):
56
+ Padding token id.
57
+ bos_token_id (`int`, *optional*, defaults to 1):
58
+ Beginning of stream token id.
59
+ eos_token_id (`int`, *optional*, defaults to 2):
60
+ End of stream token id.
61
+ pretraining_tp (`int`, *optional*, defaults to 1):
62
+ Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
63
+ document](https://huggingface.co/docs/transformers/main/perf_train_gpu_many#tensor-parallelism) to
64
+ understand more about it. This value is necessary to ensure exact reproducibility of the pretraining
65
+ results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232).
66
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
67
+ Whether to tie weight embeddings
68
+ rope_theta (`float`, *optional*, defaults to 10000.0):
69
+ The base period of the RoPE embeddings.
70
+ rope_scaling (`Dict`, *optional*):
71
+ Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
72
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
73
+ accordingly.
74
+ Expected contents:
75
+ `rope_type` (`str`):
76
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
77
+ 'gigar3'], with 'default' being the original RoPE implementation.
78
+ `factor` (`float`, *optional*):
79
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
80
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
81
+ original maximum pre-trained length.
82
+ `original_max_position_embeddings` (`int`, *optional*):
83
+ Used with 'dynamic', 'longrope' and 'gigar3'. The original max position embeddings used during
84
+ pretraining.
85
+ `attention_factor` (`float`, *optional*):
86
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
87
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
88
+ `factor` field to infer the suggested value.
89
+ `beta_fast` (`float`, *optional*):
90
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
91
+ ramp function. If unspecified, it defaults to 32.
92
+ `beta_slow` (`float`, *optional*):
93
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
94
+ ramp function. If unspecified, it defaults to 1.
95
+ `short_factor` (`List[float]`, *optional*):
96
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
97
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
98
+ size divided by the number of attention heads divided by 2
99
+ `long_factor` (`List[float]`, *optional*):
100
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
101
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
102
+ size divided by the number of attention heads divided by 2
103
+ `low_freq_factor` (`float`, *optional*):
104
+ Only used with 'gigar3'. Scaling factor applied to low frequency components of the RoPE
105
+ `high_freq_factor` (`float`, *optional*):
106
+ Only used with 'gigar3'. Scaling factor applied to high frequency components of the RoPE
107
+ attention_bias (`bool`, *optional*, defaults to `False`):
108
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
109
+ attention_dropout (`float`, *optional*, defaults to 0.0):
110
+ The dropout ratio for the attention probabilities.
111
+ mlp_bias (`bool`, *optional*, defaults to `False`):
112
+ Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers.
113
+ head_dim (`int`, *optional*):
114
+ The attention head dimension. If None, it will default to hidden_size // num_attention_heads
115
+
116
+ ```python
117
+ >>> from transformers import GigarModel, GigarConfig
118
+
119
+ >>> # Initializing a Gigar gigar-7b style configuration
120
+ >>> configuration = GigarConfig()
121
+
122
+ >>> # Initializing a model from the gigar-7b style configuration
123
+ >>> model = GigarModel(configuration)
124
+
125
+ >>> # Accessing the model configuration
126
+ >>> configuration = model.config
127
+ ```"""
128
+
129
+ model_type = "gigar"
130
+ keys_to_ignore_at_inference = ["past_key_values"]
131
+ # Default tensor parallel plan for base model `GigarModel`
132
+ base_model_tp_plan = {
133
+ "layers.*.self_attn.q_proj": "colwise",
134
+ "layers.*.self_attn.k_proj": "colwise",
135
+ "layers.*.self_attn.v_proj": "colwise",
136
+ "layers.*.self_attn.o_proj": "rowwise",
137
+ "layers.*.mlp.gate_proj": "colwise",
138
+ "layers.*.mlp.up_proj": "colwise",
139
+ "layers.*.mlp.down_proj": "rowwise",
140
+ }
141
+
142
+ def __init__(
143
+ self,
144
+ vocab_size=32000,
145
+ hidden_size=4096,
146
+ intermediate_size=11008,
147
+ num_hidden_layers=32,
148
+ num_attention_heads=32,
149
+ num_key_value_heads=None,
150
+ hidden_act="silu",
151
+ max_position_embeddings=2048,
152
+ initializer_range=0.02,
153
+ rms_norm_eps=1e-6,
154
+ use_cache=True,
155
+ pad_token_id=None,
156
+ bos_token_id=1,
157
+ eos_token_id=2,
158
+ pretraining_tp=1,
159
+ tie_word_embeddings=False,
160
+ rope_theta=10000.0,
161
+ rope_scaling=None,
162
+ attention_bias=False,
163
+ attention_dropout=0.0,
164
+ mlp_bias=False,
165
+ head_dim=None,
166
+ apply_qk_norm=False,
167
+ mla_config=None,
168
+ **kwargs,
169
+ ):
170
+ super().__init__(
171
+ pad_token_id=pad_token_id,
172
+ bos_token_id=bos_token_id,
173
+ eos_token_id=eos_token_id,
174
+ tie_word_embeddings=tie_word_embeddings,
175
+ **kwargs,
176
+ )
177
+
178
+ self.vocab_size = vocab_size
179
+ self.max_position_embeddings = max_position_embeddings
180
+ self.hidden_size = hidden_size
181
+ self.intermediate_size = intermediate_size
182
+ self.num_hidden_layers = num_hidden_layers
183
+ self.num_attention_heads = num_attention_heads
184
+
185
+ # for backward compatibility
186
+ if num_key_value_heads is None:
187
+ num_key_value_heads = num_attention_heads
188
+
189
+ self.num_key_value_heads = num_key_value_heads
190
+ self.hidden_act = hidden_act
191
+ self.initializer_range = initializer_range
192
+ self.rms_norm_eps = rms_norm_eps
193
+ self.pretraining_tp = pretraining_tp
194
+ self.use_cache = use_cache
195
+ self.rope_theta = rope_theta
196
+ self.rope_scaling = rope_scaling
197
+ self.attention_bias = attention_bias
198
+ self.attention_dropout = attention_dropout
199
+ self.mlp_bias = mlp_bias
200
+ self.head_dim = head_dim if head_dim is not None else self.hidden_size // self.num_attention_heads
201
+ # Validate the correctness of rotary position embeddings parameters
202
+ # BC: if there is a 'type' field, copy it it to 'rope_type'.
203
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
204
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
205
+ rope_config_validation(self)
206
+
207
+ self.apply_qk_norm = apply_qk_norm
208
+ self.mla_config = mla_config
209
+
210
+ self._validate_mla_config()
211
+
212
+ def _validate_mla_config(self):
213
+ if self.mla_config is None:
214
+ warnings.warn("MLA config is None!")
215
+ return
216
+
217
+ EXPECTED_KEYS = [
218
+ "qk_nope_head_dim",
219
+ "qk_rope_head_dim",
220
+ "v_head_dim",
221
+ "kv_lora_rank",
222
+ "q_lora_rank",
223
+ ]
224
+ if not all((key in self.mla_config for key in EXPECTED_KEYS)):
225
+ raise ValueError(
226
+ f"MLA config is expected to have the following keys {EXPECTED_KEYS} but got {self.mla_config.keys()}."
227
+ )
228
+
229
+ if self.mla_config["qk_nope_head_dim"] + self.mla_config["qk_rope_head_dim"] != self.mla_config["v_head_dim"]:
230
+ err_msg = (
231
+ f"QK and V head dims do not match! Got {self.mla_config['qk_nope_head_dim']} + {self.mla_config['qk_rope_head_dim']} "
232
+ f"= {self.mla_config['qk_rope_head_dim'] + self.mla_config['qk_nope_head_dim']} and {self.mla_config['v_head_dim']}."
233
+ )
234
+ raise ValueError(err_msg)
235
+
236
+
237
+ class GigarEmbedConfig(PretrainedConfig):
238
+ model_type = "gigarembed"
239
+ is_composition = False
240
+
241
+ def __init__(
242
+ self,
243
+ latent_attention_config=None,
244
+ text_config=None,
245
+ padding_side: Literal["right", "left"]="right",
246
+ add_pad_token: bool=True,
247
+ is_mask_instruction: bool = True,
248
+ add_eos: bool=True,
249
+ mask_type: str="b",
250
+ **kwargs,
251
+ ):
252
+ if isinstance(latent_attention_config, dict):
253
+ latent_attention_config["model_type"] = (
254
+ latent_attention_config["model_type"] if "model_type" in latent_attention_config else LATENT_ATTENTION_TYPE
255
+ )
256
+ latent_attention_config = CONFIG_MAPPING[latent_attention_config["model_type"]](**latent_attention_config)
257
+
258
+ self.latent_attention_config = latent_attention_config
259
+
260
+ if isinstance(text_config, dict):
261
+ text_config = GigarConfig(**text_config)
262
+ elif text_config is None:
263
+ text_config = None
264
+
265
+ self.text_config = text_config
266
+ self.padding_side = padding_side
267
+ self.is_mask_instruction = is_mask_instruction
268
+ self.add_pad_token = add_pad_token
269
+ self.add_eos = add_eos
270
+ self.mask_type = mask_type
271
+ if "hidden_size" in kwargs:
272
+ self.hidden_size = kwargs["hidden_size"]
273
+
274
+ super().__init__(**kwargs)
275
+
276
+
277
+ class LatentAttentionConfig(PretrainedConfig):
278
+ model_type = LATENT_ATTENTION_TYPE
279
+ is_composition = False
280
+ _name_or_path = "latent_attention"
281
+
282
+ def __init__(
283
+ self,
284
+ num_latents_value: int,
285
+ num_cross_heads: int,
286
+ hidden_dim: int,
287
+ latent_dim: int,
288
+ cross_dim_head: int,
289
+ mult: int,
290
+ **kwargs,
291
+ ):
292
+ self.num_latents_value = num_latents_value
293
+ self.num_cross_heads = num_cross_heads
294
+ self.hidden_dim = hidden_dim
295
+ self.latent_dim = latent_dim
296
+ self.cross_dim_head = cross_dim_head
297
+ self.mult = mult
298
+
299
+ super().__init__(**kwargs)
300
+
301
+
302
+ AutoConfig.register(GIGAREMBED_TYPE, GigarEmbedConfig)
303
+ AutoConfig.register(LATENT_ATTENTION_TYPE, LatentAttentionConfig)
304
+
305
+ GigarEmbedConfig.register_for_auto_class()
306
+ LatentAttentionConfig.register_for_auto_class()
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fde33de39f7749887f5487b85af2672683bf875d68b40c46039b1ac435691e2
3
+ size 2172114460
modeling_gigarembed.py ADDED
@@ -0,0 +1,1015 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import logging
3
+ from typing import Callable, List, Optional, Tuple, Union, Mapping
4
+
5
+ import torch
6
+ import torch.nn as nn
7
+ import numpy as np
8
+ import torch.nn.functional as F
9
+
10
+ from einops import rearrange, repeat
11
+ from transformers import AutoModel, AutoTokenizer
12
+
13
+ from transformers.cache_utils import Cache
14
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS
15
+
16
+ from transformers.activations import ACT2FN
17
+ from transformers.cache_utils import DynamicCache, StaticCache
18
+ from transformers.generation import GenerationMixin
19
+ from transformers.modeling_attn_mask_utils import AttentionMaskConverter
20
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
21
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
22
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS
23
+ from transformers.modeling_utils import PreTrainedModel
24
+ from transformers.processing_utils import Unpack
25
+ from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
26
+
27
+ from .configuration_gigarembed import GigarConfig, GigarEmbedConfig, LatentAttentionConfig
28
+
29
+
30
+ logger = logging.getLogger(__name__)
31
+ _CONFIG_FOR_DOC = "GigarEmbedConfig"
32
+
33
+
34
+ class GigarMLP(nn.Module):
35
+ def __init__(self, config):
36
+ super().__init__()
37
+ self.config = config
38
+ self.hidden_size = config.hidden_size
39
+ self.intermediate_size = config.intermediate_size
40
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
41
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
42
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=config.mlp_bias)
43
+ self.act_fn = ACT2FN[config.hidden_act]
44
+
45
+ def forward(self, x):
46
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
47
+ return down_proj
48
+
49
+
50
+ class GigarRMSNorm(nn.Module):
51
+ def __init__(self, hidden_size, eps=1e-6):
52
+ """
53
+ GigarRMSNorm is equivalent to T5LayerNorm
54
+ """
55
+ super().__init__()
56
+ self.weight = nn.Parameter(torch.ones(hidden_size))
57
+ self.variance_epsilon = eps
58
+
59
+ def forward(self, hidden_states):
60
+ input_dtype = hidden_states.dtype
61
+ hidden_states = hidden_states.to(torch.float32)
62
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
63
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
64
+ return self.weight * hidden_states.to(input_dtype)
65
+
66
+ def extra_repr(self):
67
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
68
+
69
+
70
+ def rotate_half(x):
71
+ """Rotates half the hidden dims of the input."""
72
+ x1 = x[..., : x.shape[-1] // 2]
73
+ x2 = x[..., x.shape[-1] // 2 :]
74
+ return torch.cat((-x2, x1), dim=-1)
75
+
76
+
77
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
78
+ """Applies Rotary Position Embedding to the query and key tensors.
79
+
80
+ Args:
81
+ q (`torch.Tensor`): The query tensor.
82
+ k (`torch.Tensor`): The key tensor.
83
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
84
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
85
+ position_ids (`torch.Tensor`, *optional*):
86
+ Deprecated and unused.
87
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
88
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
89
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
90
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
91
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
92
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
93
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
94
+ Returns:
95
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
96
+ """
97
+ cos = cos.unsqueeze(unsqueeze_dim)
98
+ sin = sin.unsqueeze(unsqueeze_dim)
99
+ q_embed = (q * cos) + (rotate_half(q) * sin)
100
+ k_embed = (k * cos) + (rotate_half(k) * sin)
101
+ return q_embed, k_embed
102
+
103
+
104
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
105
+ """
106
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
107
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
108
+ """
109
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
110
+ if n_rep == 1:
111
+ return hidden_states
112
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
113
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
114
+
115
+
116
+ def eager_attention_forward(
117
+ module: nn.Module,
118
+ query: torch.Tensor,
119
+ key: torch.Tensor,
120
+ value: torch.Tensor,
121
+ attention_mask: Optional[torch.Tensor],
122
+ scaling: float,
123
+ dropout: float = 0.0,
124
+ **kwargs,
125
+ ):
126
+ key_states = repeat_kv(key, module.num_key_value_groups)
127
+ value_states = repeat_kv(value, module.num_key_value_groups)
128
+
129
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
130
+ if attention_mask is not None:
131
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
132
+ attn_weights = attn_weights + causal_mask
133
+
134
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
135
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
136
+ attn_output = torch.matmul(attn_weights, value_states)
137
+ attn_output = attn_output.transpose(1, 2).contiguous()
138
+
139
+ return attn_output, attn_weights
140
+
141
+
142
+ class GigarLatentAttention(nn.Module):
143
+ """
144
+ Multi-headed Latent Attention (MLA)
145
+
146
+ Check out the original paper: https://arxiv.org/pdf/2405.04434,
147
+ and the reference implementation: https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/model.py
148
+ """
149
+
150
+ def __init__(self, config: GigarConfig, layer_idx: Optional[int] = None):
151
+ super().__init__()
152
+ self.config = config
153
+ self.hidden_size = config.hidden_size
154
+ self.num_heads = config.num_attention_heads
155
+ self.layer_idx = layer_idx
156
+ self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
157
+
158
+ assert config.num_attention_heads == config.num_key_value_heads, (
159
+ "GQA for MLA is not supported (does it even make sense?)"
160
+ )
161
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
162
+
163
+ self.max_position_embeddings = config.max_position_embeddings
164
+ self.rope_theta = config.rope_theta
165
+ self.apply_qk_norm = config.apply_qk_norm
166
+ self.attention_dropout = config.attention_dropout
167
+
168
+ assert config.mla_config is not None
169
+ self.qk_nope_head_dim = config.mla_config["qk_nope_head_dim"]
170
+ self.qk_rope_head_dim = config.mla_config["qk_rope_head_dim"]
171
+ self.v_head_dim = config.mla_config["v_head_dim"] # V has no rope part
172
+ self.kv_lora_rank = config.mla_config["kv_lora_rank"]
173
+ self.q_lora_rank = config.mla_config["q_lora_rank"]
174
+
175
+ self.qk_head_dim = self.qk_nope_head_dim + self.qk_rope_head_dim
176
+
177
+ self.scaling = self.qk_head_dim**-0.5
178
+
179
+ if self.q_lora_rank == 0:
180
+ self.q_proj = nn.Linear(
181
+ self.hidden_size,
182
+ self.num_heads * self.qk_head_dim,
183
+ bias=config.attention_bias,
184
+ )
185
+ else:
186
+ self.dq_proj = nn.Linear(
187
+ self.hidden_size,
188
+ self.q_lora_rank,
189
+ bias=config.attention_bias,
190
+ )
191
+ self.q_norm = GigarRMSNorm(self.q_lora_rank)
192
+ self.uq_proj = nn.Linear(
193
+ self.q_lora_rank,
194
+ self.num_heads * self.qk_head_dim,
195
+ bias=config.attention_bias,
196
+ )
197
+
198
+ self.kv_norm = GigarRMSNorm(self.kv_lora_rank)
199
+ self.dkv_proj = nn.Linear(
200
+ self.hidden_size,
201
+ self.kv_lora_rank,
202
+ bias=config.attention_bias,
203
+ )
204
+ self.uk_proj = nn.Linear(
205
+ config.kv_lora_rank,
206
+ self.num_heads * self.qk_nope_head_dim,
207
+ bias=config.attention_bias,
208
+ )
209
+ self.uv_proj = nn.Linear(
210
+ config.kv_lora_rank,
211
+ self.num_heads * self.v_head_dim,
212
+ bias=config.attention_bias,
213
+ )
214
+ self.kr_proj = nn.Linear(
215
+ self.hidden_size,
216
+ self.num_heads * self.qk_rope_head_dim,
217
+ bias=config.attention_bias,
218
+ )
219
+
220
+ self.o_proj = nn.Linear(
221
+ self.num_heads * self.v_head_dim,
222
+ self.hidden_size,
223
+ bias=config.attention_bias,
224
+ )
225
+
226
+ if self.apply_qk_norm:
227
+ self.qk_q_norm = nn.LayerNorm(self.num_heads * self.qk_head_dim, bias=False)
228
+ self.qk_k_norm = nn.LayerNorm(self.num_heads * self.qk_head_dim, bias=False)
229
+
230
+ config_for_rope = copy.copy(self.config)
231
+ config_for_rope.head_dim = self.config.qk_rope_head_dim
232
+
233
+ self.is_causal = False
234
+
235
+ def _compute_qkv(
236
+ self,
237
+ hidden_states: torch.Tensor,
238
+ ):
239
+ """Compute query, key, and value tensors from hidden states."""
240
+ bsz, seq_len, _ = hidden_states.size()
241
+
242
+ if self.q_lora_rank == 0:
243
+ query = self.q_proj(hidden_states)
244
+ else:
245
+ query = self.uq_proj(self.q_norm(self.dq_proj(hidden_states)))
246
+
247
+ latent = self.dkv_proj(hidden_states)
248
+ latent = self.kv_norm(latent)
249
+ k_rope = self.kr_proj(hidden_states)
250
+
251
+ k_nope = self.uk_proj(latent)
252
+ value = self.uv_proj(latent)
253
+
254
+ if self.apply_qk_norm:
255
+ query = self.qk_q_norm(query).to(query.dtype)
256
+ key = self.qk_k_norm(torch.cat([k_nope, k_rope], dim=-1)).to(k_nope.dtype)
257
+ k_nope, k_rope = torch.split(key, [k_nope.shape[-1], k_rope.shape[-1]], dim=-1)
258
+
259
+ # Reshape tensors
260
+ query = query.view(bsz, seq_len, self.num_heads, self.qk_head_dim).transpose(1, 2)
261
+ k_nope = k_nope.view(bsz, seq_len, self.num_heads, self.qk_nope_head_dim).transpose(1, 2)
262
+ k_rope = k_rope.view(bsz, seq_len, self.num_heads, self.qk_rope_head_dim).transpose(1, 2)
263
+ value = value.view(bsz, seq_len, self.num_heads, self.v_head_dim).transpose(1, 2)
264
+
265
+ q_nope, q_rope = torch.split(query, [self.qk_nope_head_dim, self.qk_rope_head_dim], dim=-1)
266
+
267
+ return q_nope, q_rope, k_nope, k_rope, value
268
+
269
+ def forward(
270
+ self,
271
+ hidden_states: torch.Tensor,
272
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
273
+ attention_mask: Optional[torch.Tensor],
274
+ past_key_value: Optional[Cache] = None,
275
+ cache_position: Optional[torch.LongTensor] = None,
276
+ **kwargs,
277
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor], Optional[tuple[torch.Tensor]]]:
278
+ """
279
+ hidden_states: [bsz, seq_len, hidden_size]
280
+ attention_mask: [bsz, seq_len]
281
+ """
282
+ batch_size, seq_len, _ = hidden_states.size()
283
+
284
+ q_nope, q_rope, k_nope, k_rope, value_states = self._compute_qkv(hidden_states)
285
+
286
+ # cos, sin = self.rotary_emb(q_rope, seq_len=seq_len)
287
+ cos, sin = position_embeddings
288
+ q_rope, k_rope = apply_rotary_pos_emb(q_rope, k_rope, cos, sin)
289
+ query_states = torch.cat([q_nope, q_rope], dim=-1)
290
+ key_states = torch.cat([k_nope, k_rope], dim=-1)
291
+
292
+ if past_key_value is not None:
293
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
294
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
295
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
296
+
297
+ attention_interface: Callable = eager_attention_forward
298
+ if self.config._attn_implementation != "eager":
299
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
300
+
301
+ attn_output, attn_weights = attention_interface(
302
+ self,
303
+ query_states,
304
+ key_states,
305
+ value_states,
306
+ attention_mask,
307
+ dropout=0.0 if not self.training else self.attention_dropout,
308
+ scaling=self.scaling,
309
+ **kwargs,
310
+ )
311
+
312
+ attn_output = attn_output.reshape(batch_size, seq_len, -1).contiguous()
313
+ attn_output = self.o_proj(attn_output)
314
+
315
+ return attn_output, attn_weights
316
+
317
+
318
+ class GigarDecoderLayer(nn.Module):
319
+ def __init__(self, config: GigarConfig, layer_idx: Optional[int] = None):
320
+ super().__init__()
321
+ self.hidden_size = config.hidden_size
322
+
323
+ self.self_attn = GigarLatentAttention(config, layer_idx)
324
+ self.mlp = GigarMLP(config)
325
+ self.input_layernorm = GigarRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
326
+ self.post_attention_layernorm = GigarRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
327
+
328
+ def forward(
329
+ self,
330
+ hidden_states: torch.Tensor,
331
+ attention_mask: Optional[torch.Tensor] = None,
332
+ position_ids: Optional[torch.LongTensor] = None,
333
+ past_key_value: Optional[Cache] = None,
334
+ output_attentions: Optional[bool] = False,
335
+ use_cache: Optional[bool] = False,
336
+ cache_position: Optional[torch.LongTensor] = None,
337
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
338
+ **kwargs: Unpack[FlashAttentionKwargs],
339
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
340
+ residual = hidden_states
341
+
342
+ hidden_states = self.input_layernorm(hidden_states)
343
+
344
+ # Self Attention
345
+ hidden_states, self_attn_weights = self.self_attn(
346
+ hidden_states=hidden_states,
347
+ attention_mask=attention_mask,
348
+ position_ids=position_ids,
349
+ past_key_value=past_key_value,
350
+ output_attentions=output_attentions,
351
+ use_cache=use_cache,
352
+ cache_position=cache_position,
353
+ position_embeddings=position_embeddings,
354
+ **kwargs,
355
+ )
356
+ hidden_states = residual + hidden_states
357
+
358
+ # Fully Connected
359
+ residual = hidden_states
360
+ hidden_states = self.post_attention_layernorm(hidden_states)
361
+ hidden_states = self.mlp(hidden_states)
362
+ hidden_states = residual + hidden_states
363
+
364
+ outputs = (hidden_states,)
365
+ if output_attentions:
366
+ outputs += (self_attn_weights,)
367
+
368
+ return outputs
369
+
370
+
371
+ class GigarRotaryEmbedding(nn.Module):
372
+ def __init__(self, config: GigarConfig, device=None):
373
+ super().__init__()
374
+ # BC: "rope_type" was originally "type"
375
+ if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
376
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
377
+ else:
378
+ self.rope_type = "default"
379
+ self.max_seq_len_cached = config.max_position_embeddings
380
+ self.original_max_seq_len = config.max_position_embeddings
381
+
382
+ self.config = config
383
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
384
+
385
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
386
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
387
+ self.original_inv_freq = self.inv_freq
388
+
389
+ def _dynamic_frequency_update(self, position_ids, device):
390
+ """
391
+ dynamic RoPE layers should recompute `inv_freq` in the following situations:
392
+ 1 - growing beyond the cached sequence length (allow scaling)
393
+ 2 - the current sequence length is in the original scale (avoid losing precision with small sequences)
394
+ """
395
+ seq_len = torch.max(position_ids) + 1
396
+ if seq_len > self.max_seq_len_cached: # growth
397
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device, seq_len=seq_len)
398
+ self.register_buffer("inv_freq", inv_freq, persistent=False) # TODO joao: may break with compilation
399
+ self.max_seq_len_cached = seq_len
400
+
401
+ if seq_len < self.original_max_seq_len and self.max_seq_len_cached > self.original_max_seq_len: # reset
402
+ self.register_buffer("inv_freq", self.original_inv_freq, persistent=False)
403
+ self.max_seq_len_cached = self.original_max_seq_len
404
+
405
+ @torch.no_grad()
406
+ def forward(self, x, position_ids):
407
+ if "dynamic" in self.rope_type:
408
+ self._dynamic_frequency_update(position_ids, device=x.device)
409
+
410
+ # Core RoPE block
411
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
412
+ position_ids_expanded = position_ids[:, None, :].float()
413
+ # Force float32 (see https://github.com/huggingface/transformers/pull/29285)
414
+ device_type = x.device.type
415
+ device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
416
+ with torch.autocast(device_type=device_type, enabled=False):
417
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
418
+ emb = torch.cat((freqs, freqs), dim=-1)
419
+ cos = emb.cos()
420
+ sin = emb.sin()
421
+
422
+ # Advanced RoPE types (e.g. yarn) apply a post-processing scaling factor, equivalent to scaling attention
423
+ cos = cos * self.attention_scaling
424
+ sin = sin * self.attention_scaling
425
+
426
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
427
+
428
+
429
+ GIGAR_START_DOCSTRING = r"""
430
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
431
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
432
+ etc.)
433
+
434
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
435
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
436
+ and behavior.
437
+
438
+ Parameters:
439
+ config ([`GigarConfig`]):
440
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
441
+ load the weights associated with the model, only the configuration. Check out the
442
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
443
+ """
444
+
445
+
446
+ @add_start_docstrings(
447
+ "The bare Gigar Model outputting raw hidden-states without any specific head on top.",
448
+ GIGAR_START_DOCSTRING,
449
+ )
450
+ class GigarPreTrainedModel(PreTrainedModel):
451
+ config_class = GigarConfig
452
+ base_model_prefix = "model"
453
+ supports_gradient_checkpointing = True
454
+ _no_split_modules = ["GigarDecoderLayer"]
455
+ _skip_keys_device_placement = ["past_key_values"]
456
+ _supports_flash_attn_2 = True
457
+ _supports_sdpa = True
458
+ _supports_flex_attn = True
459
+ _supports_cache_class = True
460
+ _supports_quantized_cache = True
461
+ _supports_static_cache = True
462
+
463
+ def _init_weights(self, module):
464
+ std = self.config.initializer_range
465
+ if isinstance(module, nn.Linear):
466
+ module.weight.data.normal_(mean=0.0, std=std)
467
+ if module.bias is not None:
468
+ module.bias.data.zero_()
469
+ elif isinstance(module, nn.Embedding):
470
+ module.weight.data.normal_(mean=0.0, std=std)
471
+ if module.padding_idx is not None:
472
+ module.weight.data[module.padding_idx].zero_()
473
+
474
+
475
+ GIGAR_INPUTS_DOCSTRING = r"""
476
+ Args:
477
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
478
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
479
+ it.
480
+
481
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
482
+ [`PreTrainedTokenizer.__call__`] for details.
483
+
484
+ [What are input IDs?](../glossary#input-ids)
485
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
486
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
487
+
488
+ - 1 for tokens that are **not masked**,
489
+ - 0 for tokens that are **masked**.
490
+
491
+ [What are attention masks?](../glossary#attention-mask)
492
+
493
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
494
+ [`PreTrainedTokenizer.__call__`] for details.
495
+
496
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
497
+ `past_key_values`).
498
+
499
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
500
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
501
+ information on the default strategy.
502
+
503
+ - 1 indicates the head is **not masked**,
504
+ - 0 indicates the head is **masked**.
505
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
506
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
507
+ config.n_positions - 1]`.
508
+
509
+ [What are position IDs?](../glossary#position-ids)
510
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
511
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
512
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
513
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
514
+
515
+ Two formats are allowed:
516
+ - a [`~cache_utils.Cache`] instance, see our
517
+ [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache);
518
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
519
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
520
+ cache format.
521
+
522
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
523
+ legacy cache format will be returned.
524
+
525
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
526
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
527
+ of shape `(batch_size, sequence_length)`.
528
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
529
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
530
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
531
+ model's internal embedding lookup matrix.
532
+ use_cache (`bool`, *optional*):
533
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
534
+ `past_key_values`).
535
+ output_attentions (`bool`, *optional*):
536
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
537
+ tensors for more detail.
538
+ output_hidden_states (`bool`, *optional*):
539
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
540
+ more detail.
541
+ return_dict (`bool`, *optional*):
542
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
543
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
544
+ Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
545
+ this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
546
+ the complete sequence length.
547
+ """
548
+
549
+ @add_start_docstrings(
550
+ "The bare Gigar Model outputting raw hidden-states without any specific head on top.",
551
+ GIGAR_START_DOCSTRING,
552
+ )
553
+ class GigarModel(GigarPreTrainedModel):
554
+ """
555
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`GigarDecoderLayer`]
556
+
557
+ Args:
558
+ config: GigarConfig
559
+ """
560
+
561
+ def __init__(self, config: GigarConfig):
562
+ super().__init__(config)
563
+ self.padding_idx = config.pad_token_id
564
+ self.vocab_size = config.vocab_size
565
+
566
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
567
+ self.layers = nn.ModuleList(
568
+ [GigarDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
569
+ )
570
+ self.norm = GigarRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
571
+ self.rotary_emb = GigarRotaryEmbedding(config=config)
572
+ self.gradient_checkpointing = False
573
+
574
+ # Initialize weights and apply final processing
575
+ self.post_init()
576
+
577
+ def get_input_embeddings(self):
578
+ return self.embed_tokens
579
+
580
+ def set_input_embeddings(self, value):
581
+ self.embed_tokens = value
582
+
583
+ @add_start_docstrings_to_model_forward(GIGAR_INPUTS_DOCSTRING)
584
+ def forward(
585
+ self,
586
+ input_ids: torch.LongTensor = None,
587
+ attention_mask: Optional[torch.Tensor] = None,
588
+ position_ids: Optional[torch.LongTensor] = None,
589
+ past_key_values: Optional[Cache] = None,
590
+ inputs_embeds: Optional[torch.FloatTensor] = None,
591
+ use_cache: Optional[bool] = None,
592
+ output_attentions: Optional[bool] = None,
593
+ output_hidden_states: Optional[bool] = None,
594
+ return_dict: Optional[bool] = None,
595
+ cache_position: Optional[torch.LongTensor] = None,
596
+ **flash_attn_kwargs: Unpack[FlashAttentionKwargs],
597
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
598
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
599
+ output_hidden_states = (
600
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
601
+ )
602
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
603
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
604
+
605
+ if (input_ids is None) ^ (inputs_embeds is not None):
606
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
607
+
608
+ if self.gradient_checkpointing and self.training and use_cache:
609
+ logger.warning_once(
610
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
611
+ )
612
+ use_cache = False
613
+
614
+ if inputs_embeds is None:
615
+ inputs_embeds = self.embed_tokens(input_ids)
616
+
617
+ if use_cache and past_key_values is None:
618
+ past_key_values = DynamicCache()
619
+
620
+ if cache_position is None:
621
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
622
+ cache_position = torch.arange(
623
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
624
+ )
625
+
626
+ if position_ids is None:
627
+ position_ids = cache_position.unsqueeze(0)
628
+
629
+ attention_mask = self._update_encoder_mask(attention_mask, inputs_embeds)
630
+
631
+ hidden_states = inputs_embeds
632
+
633
+ # create position embeddings to be shared across the decoder layers
634
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
635
+
636
+ # decoder layers
637
+ all_hidden_states = () if output_hidden_states else None
638
+ all_self_attns = () if output_attentions else None
639
+
640
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
641
+ if output_hidden_states:
642
+ all_hidden_states += (hidden_states,)
643
+
644
+ if self.gradient_checkpointing and self.training:
645
+ layer_outputs = self._gradient_checkpointing_func(
646
+ decoder_layer.__call__,
647
+ hidden_states,
648
+ attention_mask, # causal_mask
649
+ position_ids,
650
+ past_key_values,
651
+ output_attentions,
652
+ use_cache,
653
+ cache_position,
654
+ position_embeddings,
655
+ )
656
+ else:
657
+ layer_outputs = decoder_layer(
658
+ hidden_states,
659
+ attention_mask=attention_mask, # causal_mask
660
+ position_ids=position_ids,
661
+ past_key_value=past_key_values,
662
+ output_attentions=output_attentions,
663
+ use_cache=use_cache,
664
+ cache_position=cache_position,
665
+ position_embeddings=position_embeddings,
666
+ **flash_attn_kwargs,
667
+ )
668
+
669
+ hidden_states = layer_outputs[0]
670
+
671
+ if output_attentions:
672
+ all_self_attns += (layer_outputs[1],)
673
+
674
+ hidden_states = self.norm(hidden_states)
675
+
676
+ # add hidden states from the last decoder layer
677
+ if output_hidden_states:
678
+ all_hidden_states += (hidden_states,)
679
+
680
+ output = BaseModelOutputWithPast(
681
+ last_hidden_state=hidden_states,
682
+ past_key_values=past_key_values if use_cache else None,
683
+ hidden_states=all_hidden_states,
684
+ attentions=all_self_attns,
685
+ )
686
+ return output if return_dict else output.to_tuple()
687
+
688
+ def _update_encoder_mask(
689
+ self,
690
+ attention_mask: torch.Tensor,
691
+ input_tensor: torch.Tensor,
692
+ ):
693
+ # Для flash_attention_2 возвращаем исходную маску
694
+ if self.config._attn_implementation == "flash_attention_2":
695
+ if attention_mask is not None and (attention_mask == 0).any():
696
+ return attention_mask
697
+ return None
698
+
699
+ dtype, device = input_tensor.dtype, input_tensor.device
700
+ batch_size, sequence_length = input_tensor.shape[:2]
701
+
702
+ # 1. Создаём базовую маску без ограничений (все токены видят друг друга)
703
+ encoder_mask = torch.full(
704
+ (batch_size, 1, sequence_length, sequence_length),
705
+ fill_value=1.0,
706
+ dtype=dtype,
707
+ device=device
708
+ )
709
+
710
+ # 2. Применяем padding-маску если есть
711
+ if attention_mask is not None:
712
+ # Создаём 4D padding-маску [batch, 1, 1, seq_len]
713
+ padding_mask = attention_mask[:, None, None, :].to(dtype=dtype)
714
+
715
+ # Комбинируем: обнуляем позиции где padding_mask == 0
716
+ encoder_mask = encoder_mask * padding_mask
717
+
718
+ # Конвертируем в формат для softmax (0 = -inf)
719
+ min_dtype = torch.finfo(dtype).min
720
+ encoder_mask = encoder_mask.masked_fill(encoder_mask == 0.0, min_dtype)
721
+
722
+ return encoder_mask
723
+
724
+ def _update_causal_mask(
725
+ self,
726
+ attention_mask: torch.Tensor,
727
+ input_tensor: torch.Tensor,
728
+ cache_position: torch.Tensor,
729
+ past_key_values: Cache,
730
+ output_attentions: bool,
731
+ ):
732
+ if self.config._attn_implementation == "flash_attention_2":
733
+ if attention_mask is not None and (attention_mask == 0.0).any():
734
+ return attention_mask
735
+ return None
736
+
737
+ # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
738
+ # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
739
+ # to infer the attention mask.
740
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
741
+ using_static_cache = isinstance(past_key_values, StaticCache)
742
+
743
+ # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
744
+ if self.config._attn_implementation == "sdpa" and not using_static_cache and not output_attentions:
745
+ if AttentionMaskConverter._ignore_causal_mask_sdpa(
746
+ attention_mask,
747
+ inputs_embeds=input_tensor,
748
+ past_key_values_length=past_seen_tokens,
749
+ is_training=self.training,
750
+ ):
751
+ return None
752
+
753
+ dtype, device = input_tensor.dtype, input_tensor.device
754
+ sequence_length = input_tensor.shape[1]
755
+ if using_static_cache:
756
+ target_length = past_key_values.get_max_cache_shape()
757
+ else:
758
+ target_length = (
759
+ attention_mask.shape[-1]
760
+ if isinstance(attention_mask, torch.Tensor)
761
+ else past_seen_tokens + sequence_length + 1
762
+ )
763
+
764
+ # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
765
+ causal_mask = self._prepare_4d_causal_attention_mask_with_cache_position(
766
+ attention_mask,
767
+ sequence_length=sequence_length,
768
+ target_length=target_length,
769
+ dtype=dtype,
770
+ device=device,
771
+ cache_position=cache_position,
772
+ batch_size=input_tensor.shape[0],
773
+ )
774
+
775
+ if (
776
+ self.config._attn_implementation == "sdpa"
777
+ and attention_mask is not None
778
+ and attention_mask.device.type == "cuda"
779
+ and not output_attentions
780
+ ):
781
+ # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
782
+ # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
783
+ # Details: https://github.com/pytorch/pytorch/issues/110213
784
+ min_dtype = torch.finfo(dtype).min
785
+ causal_mask = AttentionMaskConverter._unmask_unattended(causal_mask, min_dtype)
786
+
787
+ return causal_mask
788
+
789
+ @staticmethod
790
+ def _prepare_4d_causal_attention_mask_with_cache_position(
791
+ attention_mask: torch.Tensor,
792
+ sequence_length: int,
793
+ target_length: int,
794
+ dtype: torch.dtype,
795
+ device: torch.device,
796
+ cache_position: torch.Tensor,
797
+ batch_size: int,
798
+ **kwargs,
799
+ ):
800
+ """
801
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
802
+ `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
803
+
804
+ Args:
805
+ attention_mask (`torch.Tensor`):
806
+ A 2D attention mask of shape `(batch_size, key_value_length)` or a 4D attention mask of shape
807
+ `(batch_size, 1, query_length, key_value_length)`.
808
+ sequence_length (`int`):
809
+ The sequence length being processed.
810
+ target_length (`int`):
811
+ The target length: when generating with static cache, the mask should be as long as the static cache,
812
+ to account for the 0 padding, the part of the cache that is not filled yet.
813
+ dtype (`torch.dtype`):
814
+ The dtype to use for the 4D attention mask.
815
+ device (`torch.device`):
816
+ The device to plcae the 4D attention mask on.
817
+ cache_position (`torch.Tensor`):
818
+ Indices depicting the position of the input sequence tokens in the sequence.
819
+ batch_size (`torch.Tensor`):
820
+ Batch size.
821
+ """
822
+ if attention_mask is not None and attention_mask.dim() == 4:
823
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
824
+ causal_mask = attention_mask
825
+ else:
826
+ min_dtype = torch.finfo(dtype).min
827
+ causal_mask = torch.full(
828
+ (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device
829
+ )
830
+ if sequence_length != 1:
831
+ causal_mask = torch.triu(causal_mask, diagonal=1)
832
+ causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
833
+ causal_mask = causal_mask[None, None, :, :].expand(batch_size, 1, -1, -1)
834
+ if attention_mask is not None:
835
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
836
+ mask_length = attention_mask.shape[-1]
837
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
838
+ padding_mask = padding_mask == 0
839
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
840
+ padding_mask, min_dtype
841
+ )
842
+
843
+ return causal_mask
844
+
845
+
846
+ class FeedForward(nn.Module):
847
+ def __init__(self, dim, mult = 4):
848
+ super().__init__()
849
+ self.hidden_size = dim
850
+ self.intermediate_size = dim * mult
851
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
852
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
853
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
854
+ self.act_fn = nn.SiLU()
855
+
856
+ def forward(self, x):
857
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
858
+
859
+
860
+ class Attention(nn.Module):
861
+ def __init__(self, query_dimension, context_dimension=None, num_heads=8, head_dim=64):
862
+ super().__init__()
863
+ inner_dimension = head_dim * num_heads
864
+ context_dimension = context_dimension if context_dimension is not None else query_dimension
865
+
866
+ self.scaling_factor = head_dim ** -0.5
867
+ self.num_heads = num_heads
868
+
869
+ self.to_q = nn.Linear(query_dimension, inner_dimension, bias=False)
870
+ self.to_kv = nn.Linear(context_dimension, inner_dimension * 2, bias=False)
871
+ self.to_out = nn.Linear(inner_dimension, query_dimension, bias=False)
872
+
873
+ def forward(self, input_tensor, context=None, attention_mask=None):
874
+ batch_size, seq_len, _ = input_tensor.shape
875
+ num_heads = self.num_heads
876
+
877
+ # Project input to query
878
+ query = self.to_q(input_tensor)
879
+
880
+ # Use input as context if not provided
881
+ context = input_tensor if context is None else context
882
+ key, value = self.to_kv(context).chunk(2, dim=-1)
883
+
884
+ # Rearrange for multi-head attention
885
+ query = rearrange(query, 'b n (h d) -> (b h) n d', h=num_heads)
886
+ key = rearrange(key, 'b n (h d) -> (b h) n d', h=num_heads)
887
+ value = rearrange(value, 'b n (h d) -> (b h) n d', h=num_heads)
888
+
889
+ # Compute scaled dot-product attention
890
+ with torch.backends.cuda.sdp_kernel(
891
+ enable_flash=True,
892
+ enable_math=True,
893
+ enable_mem_efficient=True
894
+ ):
895
+ attention_output = F.scaled_dot_product_attention(query, key, value)
896
+
897
+ # Rearrange back to original shape
898
+ attention_output = rearrange(attention_output, '(b h) n d -> b n (h d)', h=num_heads)
899
+
900
+ return self.to_out(attention_output)
901
+
902
+
903
+ class LatentAttentionModel(PreTrainedModel):
904
+ config_class = LatentAttentionConfig
905
+
906
+ def __init__(self, configuration: LatentAttentionConfig):
907
+ super().__init__(configuration)
908
+
909
+ # Extract configuration parameters
910
+ num_latents = configuration.num_latents_value
911
+ latent_dimension = configuration.latent_dim
912
+ cross_attention_heads = configuration.num_cross_heads
913
+ cross_head_dimension = configuration.cross_dim_head
914
+ hidden_dimension = configuration.hidden_dim
915
+
916
+ # Initialize cross-attention components
917
+ self.cross_attend_blocks = nn.ModuleList([
918
+ Attention(
919
+ query_dimension=latent_dimension,
920
+ context_dimension=hidden_dimension,
921
+ num_heads=cross_attention_heads,
922
+ head_dim=cross_head_dimension
923
+ ),
924
+ FeedForward(latent_dimension)
925
+ ])
926
+
927
+ # Register learnable latents as model parameter
928
+ self.latents = nn.Parameter(torch.randn(num_latents, latent_dimension))
929
+
930
+ def forward(self, hidden_states, attention_mask: Optional[torch.Tensor] = None):
931
+ cross_attention, feed_forward = self.cross_attend_blocks
932
+
933
+ batch_size, device = hidden_states.size(0), hidden_states.device
934
+
935
+ # Expand latents to match batch size
936
+ expanded_latents = self.latents.repeat(batch_size, 1, 1)
937
+
938
+ # Apply cross-attention with residual connection
939
+ attended_output = cross_attention(
940
+ hidden_states, context=expanded_latents, attention_mask=attention_mask) + hidden_states
941
+
942
+ # Apply feed-forward with residual connection
943
+ processed_output = feed_forward(attended_output) + attended_output
944
+
945
+ return processed_output
946
+
947
+
948
+ class GigarEmbedModel(PreTrainedModel):
949
+ config_class = GigarEmbedConfig
950
+ _supports_flash_attn_2 = True
951
+ _no_split_modules = ["GigarDecoderLayer", "LatentAttentionModel"]
952
+
953
+ def __init__(self, configuration: GigarEmbedConfig):
954
+ super().__init__(configuration)
955
+
956
+ # Initialize latent attention model
957
+ self.latent_attention_model = AutoModel.from_config(
958
+ configuration.latent_attention_config
959
+ )
960
+
961
+ self.tokenizer, self.text_encoder = None, None
962
+ if configuration.text_config is not None:
963
+ # Initialize text model if provided in config
964
+ self.model = AutoModel.from_config(configuration.text_config)
965
+
966
+ # Initialize tokenizer if text config is available
967
+ self.tokenizer = AutoTokenizer.from_pretrained(
968
+ configuration.text_config.name_or_path
969
+ )
970
+
971
+ # Set configuration parameters
972
+ self.padding_side = configuration.padding_side
973
+ self.add_eos = configuration.add_eos
974
+ self.mask_type = configuration.mask_type
975
+
976
+ # Add padding token if configured
977
+ if configuration.add_pad_token and self.tokenizer is not None:
978
+ self.add_pad_token()
979
+
980
+ def add_pad_token(self):
981
+ self.tokenizer.pad_token_id = 0
982
+ self.tokenizer.padding_side = self.padding_side
983
+
984
+ def gradient_checkpointing_enable(self, *args, **kwargs):
985
+ self.model.gradient_checkpointing_enable(*args, **kwargs)
986
+
987
+ def forward(self, input_ids: torch.Tensor, attention_mask: torch.Tensor,
988
+ return_embeddings: bool = False, **kwargs):
989
+ kwargs.pop('token_type_ids', None)
990
+
991
+ with torch.autocast('cuda', dtype=torch.bfloat16):
992
+ outputs = self.model(input_ids=input_ids, attention_mask=attention_mask, **kwargs)
993
+
994
+ last_hidden = self.latent_attention_model(outputs.last_hidden_state, attention_mask)
995
+
996
+ if return_embeddings:
997
+ return self.mean_pool(last_hidden, attention_mask)
998
+
999
+ return BaseModelOutputWithPast(last_hidden_state=last_hidden)
1000
+
1001
+ def mean_pool(self, last_hidden: torch.Tensor, attention_mask: torch.Tensor):
1002
+ last_hidden = last_hidden.masked_fill(~attention_mask[..., None].bool(), 0.0)
1003
+ embeddings = last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
1004
+ return F.normalize(embeddings, p=2, dim=-1)
1005
+
1006
+
1007
+ ## AutoModel Register
1008
+ AutoModel.register(GigarConfig, GigarModel)
1009
+ AutoModel.register(GigarEmbedConfig, GigarEmbedModel)
1010
+ AutoModel.register(LatentAttentionConfig, LatentAttentionModel)
1011
+
1012
+ ## Register for auto class
1013
+ GigarModel.register_for_auto_class("AutoModel")
1014
+ GigarEmbedModel.register_for_auto_class("AutoModel")
1015
+ LatentAttentionModel.register_for_auto_class("AutoModel")
quantization_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "quant_method": "bitsandbytes",
3
+ "_load_in_8bit": false,
4
+ "_load_in_4bit": true,
5
+ "llm_int8_threshold": 6.0,
6
+ "llm_int8_skip_modules": null,
7
+ "llm_int8_enable_fp32_cpu_offload": false,
8
+ "llm_int8_has_fp16_weight": false,
9
+ "bnb_4bit_quant_type": "nf4",
10
+ "bnb_4bit_use_double_quant": true,
11
+ "bnb_4bit_compute_dtype": "bfloat16",
12
+ "bnb_4bit_quant_storage": "uint8",
13
+ "load_in_4bit": true,
14
+ "load_in_8bit": false
15
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "<unk>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ec0a1cffcc9192f5ee3d7b273673a062918055238bda3d23cfb6d2512e947ff
3
+ size 10728325
tokenizer_config.json ADDED
@@ -0,0 +1,2092 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<unk>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "128000": {
28
+ "content": "<|gigatoken_1|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128001": {
36
+ "content": "<|gigatoken_2|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128002": {
44
+ "content": "<|gigatoken_3|>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "128003": {
52
+ "content": "<|gigatoken_4|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "128004": {
60
+ "content": "<|gigatoken_5|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "128005": {
68
+ "content": "<|gigatoken_6|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "128006": {
76
+ "content": "<|gigatoken_7|>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "128007": {
84
+ "content": "<|gigatoken_8|>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "128008": {
92
+ "content": "<|gigatoken_9|>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "128009": {
100
+ "content": "<|gigatoken_10|>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "128010": {
108
+ "content": "<|gigatoken_11|>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "128011": {
116
+ "content": "<|gigatoken_12|>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "128012": {
124
+ "content": "<|gigatoken_13|>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "128013": {
132
+ "content": "<|gigatoken_14|>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "128014": {
140
+ "content": "<|gigatoken_15|>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "128015": {
148
+ "content": "<|gigatoken_16|>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "128016": {
156
+ "content": "<|gigatoken_17|>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "128017": {
164
+ "content": "<|gigatoken_18|>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "128018": {
172
+ "content": "<|gigatoken_19|>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "128019": {
180
+ "content": "<|gigatoken_20|>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "128020": {
188
+ "content": "<|gigatoken_21|>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "128021": {
196
+ "content": "<|gigatoken_22|>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "128022": {
204
+ "content": "<|gigatoken_23|>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "128023": {
212
+ "content": "<|gigatoken_24|>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "128024": {
220
+ "content": "<|gigatoken_25|>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "128025": {
228
+ "content": "<|gigatoken_26|>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "128026": {
236
+ "content": "<|gigatoken_27|>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "128027": {
244
+ "content": "<|gigatoken_28|>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "128028": {
252
+ "content": "<|gigatoken_29|>",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "128029": {
260
+ "content": "<|gigatoken_30|>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "128030": {
268
+ "content": "<|gigatoken_31|>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "128031": {
276
+ "content": "<|gigatoken_32|>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "128032": {
284
+ "content": "<|gigatoken_33|>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "128033": {
292
+ "content": "<|gigatoken_34|>",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "128034": {
300
+ "content": "<|gigatoken_35|>",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "128035": {
308
+ "content": "<|gigatoken_36|>",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "128036": {
316
+ "content": "<|gigatoken_37|>",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "128037": {
324
+ "content": "<|gigatoken_38|>",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "128038": {
332
+ "content": "<|gigatoken_39|>",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "128039": {
340
+ "content": "<|gigatoken_40|>",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "128040": {
348
+ "content": "<|gigatoken_41|>",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "128041": {
356
+ "content": "<|gigatoken_42|>",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "128042": {
364
+ "content": "<|gigatoken_43|>",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "128043": {
372
+ "content": "<|gigatoken_44|>",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "128044": {
380
+ "content": "<|gigatoken_45|>",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "128045": {
388
+ "content": "<|gigatoken_46|>",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "128046": {
396
+ "content": "<|gigatoken_47|>",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "128047": {
404
+ "content": "<|gigatoken_48|>",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "128048": {
412
+ "content": "<|gigatoken_49|>",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "128049": {
420
+ "content": "<|gigatoken_50|>",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "128050": {
428
+ "content": "<|gigatoken_51|>",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "128051": {
436
+ "content": "<|gigatoken_52|>",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "128052": {
444
+ "content": "<|gigatoken_53|>",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "128053": {
452
+ "content": "<|gigatoken_54|>",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "128054": {
460
+ "content": "<|gigatoken_55|>",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "128055": {
468
+ "content": "<|gigatoken_56|>",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "128056": {
476
+ "content": "<|gigatoken_57|>",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "128057": {
484
+ "content": "<|gigatoken_58|>",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "128058": {
492
+ "content": "<|gigatoken_59|>",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "128059": {
500
+ "content": "<|gigatoken_60|>",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "128060": {
508
+ "content": "<|gigatoken_61|>",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "128061": {
516
+ "content": "<|gigatoken_62|>",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "128062": {
524
+ "content": "<|gigatoken_63|>",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "128063": {
532
+ "content": "<|gigatoken_64|>",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "128064": {
540
+ "content": "<|gigatoken_65|>",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "128065": {
548
+ "content": "<|gigatoken_66|>",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "128066": {
556
+ "content": "<|gigatoken_67|>",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "128067": {
564
+ "content": "<|gigatoken_68|>",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "128068": {
572
+ "content": "<|gigatoken_69|>",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "128069": {
580
+ "content": "<|gigatoken_70|>",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "128070": {
588
+ "content": "<|gigatoken_71|>",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "128071": {
596
+ "content": "<|gigatoken_72|>",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "128072": {
604
+ "content": "<|gigatoken_73|>",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "128073": {
612
+ "content": "<|gigatoken_74|>",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "128074": {
620
+ "content": "<|gigatoken_75|>",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "128075": {
628
+ "content": "<|gigatoken_76|>",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "128076": {
636
+ "content": "<|gigatoken_77|>",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "128077": {
644
+ "content": "<|gigatoken_78|>",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "128078": {
652
+ "content": "<|gigatoken_79|>",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "128079": {
660
+ "content": "<|gigatoken_80|>",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "128080": {
668
+ "content": "<|gigatoken_81|>",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "128081": {
676
+ "content": "<|gigatoken_82|>",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "128082": {
684
+ "content": "<|gigatoken_83|>",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "128083": {
692
+ "content": "<|gigatoken_84|>",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "128084": {
700
+ "content": "<|gigatoken_85|>",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "128085": {
708
+ "content": "<|gigatoken_86|>",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "128086": {
716
+ "content": "<|gigatoken_87|>",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "128087": {
724
+ "content": "<|gigatoken_88|>",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "128088": {
732
+ "content": "<|gigatoken_89|>",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "128089": {
740
+ "content": "<|gigatoken_90|>",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "128090": {
748
+ "content": "<|gigatoken_91|>",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "128091": {
756
+ "content": "<|gigatoken_92|>",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "128092": {
764
+ "content": "<|gigatoken_93|>",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "128093": {
772
+ "content": "<|gigatoken_94|>",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "128094": {
780
+ "content": "<|gigatoken_95|>",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "128095": {
788
+ "content": "<|gigatoken_96|>",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "128096": {
796
+ "content": "<|gigatoken_97|>",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "128097": {
804
+ "content": "<|gigatoken_98|>",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "128098": {
812
+ "content": "<|gigatoken_99|>",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "128099": {
820
+ "content": "<|gigatoken_100|>",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "128100": {
828
+ "content": "<|gigatoken_101|>",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ },
835
+ "128101": {
836
+ "content": "<|gigatoken_102|>",
837
+ "lstrip": false,
838
+ "normalized": false,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": true
842
+ },
843
+ "128102": {
844
+ "content": "<|gigatoken_103|>",
845
+ "lstrip": false,
846
+ "normalized": false,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": true
850
+ },
851
+ "128103": {
852
+ "content": "<|gigatoken_104|>",
853
+ "lstrip": false,
854
+ "normalized": false,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": true
858
+ },
859
+ "128104": {
860
+ "content": "<|gigatoken_105|>",
861
+ "lstrip": false,
862
+ "normalized": false,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": true
866
+ },
867
+ "128105": {
868
+ "content": "<|gigatoken_106|>",
869
+ "lstrip": false,
870
+ "normalized": false,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": true
874
+ },
875
+ "128106": {
876
+ "content": "<|gigatoken_107|>",
877
+ "lstrip": false,
878
+ "normalized": false,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": true
882
+ },
883
+ "128107": {
884
+ "content": "<|gigatoken_108|>",
885
+ "lstrip": false,
886
+ "normalized": false,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": true
890
+ },
891
+ "128108": {
892
+ "content": "<|gigatoken_109|>",
893
+ "lstrip": false,
894
+ "normalized": false,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": true
898
+ },
899
+ "128109": {
900
+ "content": "<|gigatoken_110|>",
901
+ "lstrip": false,
902
+ "normalized": false,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": true
906
+ },
907
+ "128110": {
908
+ "content": "<|gigatoken_111|>",
909
+ "lstrip": false,
910
+ "normalized": false,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": true
914
+ },
915
+ "128111": {
916
+ "content": "<|gigatoken_112|>",
917
+ "lstrip": false,
918
+ "normalized": false,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": true
922
+ },
923
+ "128112": {
924
+ "content": "<|gigatoken_113|>",
925
+ "lstrip": false,
926
+ "normalized": false,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": true
930
+ },
931
+ "128113": {
932
+ "content": "<|gigatoken_114|>",
933
+ "lstrip": false,
934
+ "normalized": false,
935
+ "rstrip": false,
936
+ "single_word": false,
937
+ "special": true
938
+ },
939
+ "128114": {
940
+ "content": "<|gigatoken_115|>",
941
+ "lstrip": false,
942
+ "normalized": false,
943
+ "rstrip": false,
944
+ "single_word": false,
945
+ "special": true
946
+ },
947
+ "128115": {
948
+ "content": "<|gigatoken_116|>",
949
+ "lstrip": false,
950
+ "normalized": false,
951
+ "rstrip": false,
952
+ "single_word": false,
953
+ "special": true
954
+ },
955
+ "128116": {
956
+ "content": "<|gigatoken_117|>",
957
+ "lstrip": false,
958
+ "normalized": false,
959
+ "rstrip": false,
960
+ "single_word": false,
961
+ "special": true
962
+ },
963
+ "128117": {
964
+ "content": "<|gigatoken_118|>",
965
+ "lstrip": false,
966
+ "normalized": false,
967
+ "rstrip": false,
968
+ "single_word": false,
969
+ "special": true
970
+ },
971
+ "128118": {
972
+ "content": "<|gigatoken_119|>",
973
+ "lstrip": false,
974
+ "normalized": false,
975
+ "rstrip": false,
976
+ "single_word": false,
977
+ "special": true
978
+ },
979
+ "128119": {
980
+ "content": "<|gigatoken_120|>",
981
+ "lstrip": false,
982
+ "normalized": false,
983
+ "rstrip": false,
984
+ "single_word": false,
985
+ "special": true
986
+ },
987
+ "128120": {
988
+ "content": "<|gigatoken_121|>",
989
+ "lstrip": false,
990
+ "normalized": false,
991
+ "rstrip": false,
992
+ "single_word": false,
993
+ "special": true
994
+ },
995
+ "128121": {
996
+ "content": "<|gigatoken_122|>",
997
+ "lstrip": false,
998
+ "normalized": false,
999
+ "rstrip": false,
1000
+ "single_word": false,
1001
+ "special": true
1002
+ },
1003
+ "128122": {
1004
+ "content": "<|gigatoken_123|>",
1005
+ "lstrip": false,
1006
+ "normalized": false,
1007
+ "rstrip": false,
1008
+ "single_word": false,
1009
+ "special": true
1010
+ },
1011
+ "128123": {
1012
+ "content": "<|gigatoken_124|>",
1013
+ "lstrip": false,
1014
+ "normalized": false,
1015
+ "rstrip": false,
1016
+ "single_word": false,
1017
+ "special": true
1018
+ },
1019
+ "128124": {
1020
+ "content": "<|gigatoken_125|>",
1021
+ "lstrip": false,
1022
+ "normalized": false,
1023
+ "rstrip": false,
1024
+ "single_word": false,
1025
+ "special": true
1026
+ },
1027
+ "128125": {
1028
+ "content": "<|gigatoken_126|>",
1029
+ "lstrip": false,
1030
+ "normalized": false,
1031
+ "rstrip": false,
1032
+ "single_word": false,
1033
+ "special": true
1034
+ },
1035
+ "128126": {
1036
+ "content": "<|gigatoken_127|>",
1037
+ "lstrip": false,
1038
+ "normalized": false,
1039
+ "rstrip": false,
1040
+ "single_word": false,
1041
+ "special": true
1042
+ },
1043
+ "128127": {
1044
+ "content": "<|gigatoken_128|>",
1045
+ "lstrip": false,
1046
+ "normalized": false,
1047
+ "rstrip": false,
1048
+ "single_word": false,
1049
+ "special": true
1050
+ },
1051
+ "128128": {
1052
+ "content": "<|gigatoken_129|>",
1053
+ "lstrip": false,
1054
+ "normalized": false,
1055
+ "rstrip": false,
1056
+ "single_word": false,
1057
+ "special": true
1058
+ },
1059
+ "128129": {
1060
+ "content": "<|gigatoken_130|>",
1061
+ "lstrip": false,
1062
+ "normalized": false,
1063
+ "rstrip": false,
1064
+ "single_word": false,
1065
+ "special": true
1066
+ },
1067
+ "128130": {
1068
+ "content": "<|gigatoken_131|>",
1069
+ "lstrip": false,
1070
+ "normalized": false,
1071
+ "rstrip": false,
1072
+ "single_word": false,
1073
+ "special": true
1074
+ },
1075
+ "128131": {
1076
+ "content": "<|gigatoken_132|>",
1077
+ "lstrip": false,
1078
+ "normalized": false,
1079
+ "rstrip": false,
1080
+ "single_word": false,
1081
+ "special": true
1082
+ },
1083
+ "128132": {
1084
+ "content": "<|gigatoken_133|>",
1085
+ "lstrip": false,
1086
+ "normalized": false,
1087
+ "rstrip": false,
1088
+ "single_word": false,
1089
+ "special": true
1090
+ },
1091
+ "128133": {
1092
+ "content": "<|gigatoken_134|>",
1093
+ "lstrip": false,
1094
+ "normalized": false,
1095
+ "rstrip": false,
1096
+ "single_word": false,
1097
+ "special": true
1098
+ },
1099
+ "128134": {
1100
+ "content": "<|gigatoken_135|>",
1101
+ "lstrip": false,
1102
+ "normalized": false,
1103
+ "rstrip": false,
1104
+ "single_word": false,
1105
+ "special": true
1106
+ },
1107
+ "128135": {
1108
+ "content": "<|gigatoken_136|>",
1109
+ "lstrip": false,
1110
+ "normalized": false,
1111
+ "rstrip": false,
1112
+ "single_word": false,
1113
+ "special": true
1114
+ },
1115
+ "128136": {
1116
+ "content": "<|gigatoken_137|>",
1117
+ "lstrip": false,
1118
+ "normalized": false,
1119
+ "rstrip": false,
1120
+ "single_word": false,
1121
+ "special": true
1122
+ },
1123
+ "128137": {
1124
+ "content": "<|gigatoken_138|>",
1125
+ "lstrip": false,
1126
+ "normalized": false,
1127
+ "rstrip": false,
1128
+ "single_word": false,
1129
+ "special": true
1130
+ },
1131
+ "128138": {
1132
+ "content": "<|gigatoken_139|>",
1133
+ "lstrip": false,
1134
+ "normalized": false,
1135
+ "rstrip": false,
1136
+ "single_word": false,
1137
+ "special": true
1138
+ },
1139
+ "128139": {
1140
+ "content": "<|gigatoken_140|>",
1141
+ "lstrip": false,
1142
+ "normalized": false,
1143
+ "rstrip": false,
1144
+ "single_word": false,
1145
+ "special": true
1146
+ },
1147
+ "128140": {
1148
+ "content": "<|gigatoken_141|>",
1149
+ "lstrip": false,
1150
+ "normalized": false,
1151
+ "rstrip": false,
1152
+ "single_word": false,
1153
+ "special": true
1154
+ },
1155
+ "128141": {
1156
+ "content": "<|gigatoken_142|>",
1157
+ "lstrip": false,
1158
+ "normalized": false,
1159
+ "rstrip": false,
1160
+ "single_word": false,
1161
+ "special": true
1162
+ },
1163
+ "128142": {
1164
+ "content": "<|gigatoken_143|>",
1165
+ "lstrip": false,
1166
+ "normalized": false,
1167
+ "rstrip": false,
1168
+ "single_word": false,
1169
+ "special": true
1170
+ },
1171
+ "128143": {
1172
+ "content": "<|gigatoken_144|>",
1173
+ "lstrip": false,
1174
+ "normalized": false,
1175
+ "rstrip": false,
1176
+ "single_word": false,
1177
+ "special": true
1178
+ },
1179
+ "128144": {
1180
+ "content": "<|gigatoken_145|>",
1181
+ "lstrip": false,
1182
+ "normalized": false,
1183
+ "rstrip": false,
1184
+ "single_word": false,
1185
+ "special": true
1186
+ },
1187
+ "128145": {
1188
+ "content": "<|gigatoken_146|>",
1189
+ "lstrip": false,
1190
+ "normalized": false,
1191
+ "rstrip": false,
1192
+ "single_word": false,
1193
+ "special": true
1194
+ },
1195
+ "128146": {
1196
+ "content": "<|gigatoken_147|>",
1197
+ "lstrip": false,
1198
+ "normalized": false,
1199
+ "rstrip": false,
1200
+ "single_word": false,
1201
+ "special": true
1202
+ },
1203
+ "128147": {
1204
+ "content": "<|gigatoken_148|>",
1205
+ "lstrip": false,
1206
+ "normalized": false,
1207
+ "rstrip": false,
1208
+ "single_word": false,
1209
+ "special": true
1210
+ },
1211
+ "128148": {
1212
+ "content": "<|gigatoken_149|>",
1213
+ "lstrip": false,
1214
+ "normalized": false,
1215
+ "rstrip": false,
1216
+ "single_word": false,
1217
+ "special": true
1218
+ },
1219
+ "128149": {
1220
+ "content": "<|gigatoken_150|>",
1221
+ "lstrip": false,
1222
+ "normalized": false,
1223
+ "rstrip": false,
1224
+ "single_word": false,
1225
+ "special": true
1226
+ },
1227
+ "128150": {
1228
+ "content": "<|gigatoken_151|>",
1229
+ "lstrip": false,
1230
+ "normalized": false,
1231
+ "rstrip": false,
1232
+ "single_word": false,
1233
+ "special": true
1234
+ },
1235
+ "128151": {
1236
+ "content": "<|gigatoken_152|>",
1237
+ "lstrip": false,
1238
+ "normalized": false,
1239
+ "rstrip": false,
1240
+ "single_word": false,
1241
+ "special": true
1242
+ },
1243
+ "128152": {
1244
+ "content": "<|gigatoken_153|>",
1245
+ "lstrip": false,
1246
+ "normalized": false,
1247
+ "rstrip": false,
1248
+ "single_word": false,
1249
+ "special": true
1250
+ },
1251
+ "128153": {
1252
+ "content": "<|gigatoken_154|>",
1253
+ "lstrip": false,
1254
+ "normalized": false,
1255
+ "rstrip": false,
1256
+ "single_word": false,
1257
+ "special": true
1258
+ },
1259
+ "128154": {
1260
+ "content": "<|gigatoken_155|>",
1261
+ "lstrip": false,
1262
+ "normalized": false,
1263
+ "rstrip": false,
1264
+ "single_word": false,
1265
+ "special": true
1266
+ },
1267
+ "128155": {
1268
+ "content": "<|gigatoken_156|>",
1269
+ "lstrip": false,
1270
+ "normalized": false,
1271
+ "rstrip": false,
1272
+ "single_word": false,
1273
+ "special": true
1274
+ },
1275
+ "128156": {
1276
+ "content": "<|gigatoken_157|>",
1277
+ "lstrip": false,
1278
+ "normalized": false,
1279
+ "rstrip": false,
1280
+ "single_word": false,
1281
+ "special": true
1282
+ },
1283
+ "128157": {
1284
+ "content": "<|gigatoken_158|>",
1285
+ "lstrip": false,
1286
+ "normalized": false,
1287
+ "rstrip": false,
1288
+ "single_word": false,
1289
+ "special": true
1290
+ },
1291
+ "128158": {
1292
+ "content": "<|gigatoken_159|>",
1293
+ "lstrip": false,
1294
+ "normalized": false,
1295
+ "rstrip": false,
1296
+ "single_word": false,
1297
+ "special": true
1298
+ },
1299
+ "128159": {
1300
+ "content": "<|gigatoken_160|>",
1301
+ "lstrip": false,
1302
+ "normalized": false,
1303
+ "rstrip": false,
1304
+ "single_word": false,
1305
+ "special": true
1306
+ },
1307
+ "128160": {
1308
+ "content": "<|gigatoken_161|>",
1309
+ "lstrip": false,
1310
+ "normalized": false,
1311
+ "rstrip": false,
1312
+ "single_word": false,
1313
+ "special": true
1314
+ },
1315
+ "128161": {
1316
+ "content": "<|gigatoken_162|>",
1317
+ "lstrip": false,
1318
+ "normalized": false,
1319
+ "rstrip": false,
1320
+ "single_word": false,
1321
+ "special": true
1322
+ },
1323
+ "128162": {
1324
+ "content": "<|gigatoken_163|>",
1325
+ "lstrip": false,
1326
+ "normalized": false,
1327
+ "rstrip": false,
1328
+ "single_word": false,
1329
+ "special": true
1330
+ },
1331
+ "128163": {
1332
+ "content": "<|gigatoken_164|>",
1333
+ "lstrip": false,
1334
+ "normalized": false,
1335
+ "rstrip": false,
1336
+ "single_word": false,
1337
+ "special": true
1338
+ },
1339
+ "128164": {
1340
+ "content": "<|gigatoken_165|>",
1341
+ "lstrip": false,
1342
+ "normalized": false,
1343
+ "rstrip": false,
1344
+ "single_word": false,
1345
+ "special": true
1346
+ },
1347
+ "128165": {
1348
+ "content": "<|gigatoken_166|>",
1349
+ "lstrip": false,
1350
+ "normalized": false,
1351
+ "rstrip": false,
1352
+ "single_word": false,
1353
+ "special": true
1354
+ },
1355
+ "128166": {
1356
+ "content": "<|gigatoken_167|>",
1357
+ "lstrip": false,
1358
+ "normalized": false,
1359
+ "rstrip": false,
1360
+ "single_word": false,
1361
+ "special": true
1362
+ },
1363
+ "128167": {
1364
+ "content": "<|gigatoken_168|>",
1365
+ "lstrip": false,
1366
+ "normalized": false,
1367
+ "rstrip": false,
1368
+ "single_word": false,
1369
+ "special": true
1370
+ },
1371
+ "128168": {
1372
+ "content": "<|gigatoken_169|>",
1373
+ "lstrip": false,
1374
+ "normalized": false,
1375
+ "rstrip": false,
1376
+ "single_word": false,
1377
+ "special": true
1378
+ },
1379
+ "128169": {
1380
+ "content": "<|gigatoken_170|>",
1381
+ "lstrip": false,
1382
+ "normalized": false,
1383
+ "rstrip": false,
1384
+ "single_word": false,
1385
+ "special": true
1386
+ },
1387
+ "128170": {
1388
+ "content": "<|gigatoken_171|>",
1389
+ "lstrip": false,
1390
+ "normalized": false,
1391
+ "rstrip": false,
1392
+ "single_word": false,
1393
+ "special": true
1394
+ },
1395
+ "128171": {
1396
+ "content": "<|gigatoken_172|>",
1397
+ "lstrip": false,
1398
+ "normalized": false,
1399
+ "rstrip": false,
1400
+ "single_word": false,
1401
+ "special": true
1402
+ },
1403
+ "128172": {
1404
+ "content": "<|gigatoken_173|>",
1405
+ "lstrip": false,
1406
+ "normalized": false,
1407
+ "rstrip": false,
1408
+ "single_word": false,
1409
+ "special": true
1410
+ },
1411
+ "128173": {
1412
+ "content": "<|gigatoken_174|>",
1413
+ "lstrip": false,
1414
+ "normalized": false,
1415
+ "rstrip": false,
1416
+ "single_word": false,
1417
+ "special": true
1418
+ },
1419
+ "128174": {
1420
+ "content": "<|gigatoken_175|>",
1421
+ "lstrip": false,
1422
+ "normalized": false,
1423
+ "rstrip": false,
1424
+ "single_word": false,
1425
+ "special": true
1426
+ },
1427
+ "128175": {
1428
+ "content": "<|gigatoken_176|>",
1429
+ "lstrip": false,
1430
+ "normalized": false,
1431
+ "rstrip": false,
1432
+ "single_word": false,
1433
+ "special": true
1434
+ },
1435
+ "128176": {
1436
+ "content": "<|gigatoken_177|>",
1437
+ "lstrip": false,
1438
+ "normalized": false,
1439
+ "rstrip": false,
1440
+ "single_word": false,
1441
+ "special": true
1442
+ },
1443
+ "128177": {
1444
+ "content": "<|gigatoken_178|>",
1445
+ "lstrip": false,
1446
+ "normalized": false,
1447
+ "rstrip": false,
1448
+ "single_word": false,
1449
+ "special": true
1450
+ },
1451
+ "128178": {
1452
+ "content": "<|gigatoken_179|>",
1453
+ "lstrip": false,
1454
+ "normalized": false,
1455
+ "rstrip": false,
1456
+ "single_word": false,
1457
+ "special": true
1458
+ },
1459
+ "128179": {
1460
+ "content": "<|gigatoken_180|>",
1461
+ "lstrip": false,
1462
+ "normalized": false,
1463
+ "rstrip": false,
1464
+ "single_word": false,
1465
+ "special": true
1466
+ },
1467
+ "128180": {
1468
+ "content": "<|gigatoken_181|>",
1469
+ "lstrip": false,
1470
+ "normalized": false,
1471
+ "rstrip": false,
1472
+ "single_word": false,
1473
+ "special": true
1474
+ },
1475
+ "128181": {
1476
+ "content": "<|gigatoken_182|>",
1477
+ "lstrip": false,
1478
+ "normalized": false,
1479
+ "rstrip": false,
1480
+ "single_word": false,
1481
+ "special": true
1482
+ },
1483
+ "128182": {
1484
+ "content": "<|gigatoken_183|>",
1485
+ "lstrip": false,
1486
+ "normalized": false,
1487
+ "rstrip": false,
1488
+ "single_word": false,
1489
+ "special": true
1490
+ },
1491
+ "128183": {
1492
+ "content": "<|gigatoken_184|>",
1493
+ "lstrip": false,
1494
+ "normalized": false,
1495
+ "rstrip": false,
1496
+ "single_word": false,
1497
+ "special": true
1498
+ },
1499
+ "128184": {
1500
+ "content": "<|gigatoken_185|>",
1501
+ "lstrip": false,
1502
+ "normalized": false,
1503
+ "rstrip": false,
1504
+ "single_word": false,
1505
+ "special": true
1506
+ },
1507
+ "128185": {
1508
+ "content": "<|gigatoken_186|>",
1509
+ "lstrip": false,
1510
+ "normalized": false,
1511
+ "rstrip": false,
1512
+ "single_word": false,
1513
+ "special": true
1514
+ },
1515
+ "128186": {
1516
+ "content": "<|gigatoken_187|>",
1517
+ "lstrip": false,
1518
+ "normalized": false,
1519
+ "rstrip": false,
1520
+ "single_word": false,
1521
+ "special": true
1522
+ },
1523
+ "128187": {
1524
+ "content": "<|gigatoken_188|>",
1525
+ "lstrip": false,
1526
+ "normalized": false,
1527
+ "rstrip": false,
1528
+ "single_word": false,
1529
+ "special": true
1530
+ },
1531
+ "128188": {
1532
+ "content": "<|gigatoken_189|>",
1533
+ "lstrip": false,
1534
+ "normalized": false,
1535
+ "rstrip": false,
1536
+ "single_word": false,
1537
+ "special": true
1538
+ },
1539
+ "128189": {
1540
+ "content": "<|gigatoken_190|>",
1541
+ "lstrip": false,
1542
+ "normalized": false,
1543
+ "rstrip": false,
1544
+ "single_word": false,
1545
+ "special": true
1546
+ },
1547
+ "128190": {
1548
+ "content": "<|gigatoken_191|>",
1549
+ "lstrip": false,
1550
+ "normalized": false,
1551
+ "rstrip": false,
1552
+ "single_word": false,
1553
+ "special": true
1554
+ },
1555
+ "128191": {
1556
+ "content": "<|gigatoken_192|>",
1557
+ "lstrip": false,
1558
+ "normalized": false,
1559
+ "rstrip": false,
1560
+ "single_word": false,
1561
+ "special": true
1562
+ },
1563
+ "128192": {
1564
+ "content": "<|gigatoken_193|>",
1565
+ "lstrip": false,
1566
+ "normalized": false,
1567
+ "rstrip": false,
1568
+ "single_word": false,
1569
+ "special": true
1570
+ },
1571
+ "128193": {
1572
+ "content": "<|gigatoken_194|>",
1573
+ "lstrip": false,
1574
+ "normalized": false,
1575
+ "rstrip": false,
1576
+ "single_word": false,
1577
+ "special": true
1578
+ },
1579
+ "128194": {
1580
+ "content": "<|gigatoken_195|>",
1581
+ "lstrip": false,
1582
+ "normalized": false,
1583
+ "rstrip": false,
1584
+ "single_word": false,
1585
+ "special": true
1586
+ },
1587
+ "128195": {
1588
+ "content": "<|gigatoken_196|>",
1589
+ "lstrip": false,
1590
+ "normalized": false,
1591
+ "rstrip": false,
1592
+ "single_word": false,
1593
+ "special": true
1594
+ },
1595
+ "128196": {
1596
+ "content": "<|gigatoken_197|>",
1597
+ "lstrip": false,
1598
+ "normalized": false,
1599
+ "rstrip": false,
1600
+ "single_word": false,
1601
+ "special": true
1602
+ },
1603
+ "128197": {
1604
+ "content": "<|gigatoken_198|>",
1605
+ "lstrip": false,
1606
+ "normalized": false,
1607
+ "rstrip": false,
1608
+ "single_word": false,
1609
+ "special": true
1610
+ },
1611
+ "128198": {
1612
+ "content": "<|gigatoken_199|>",
1613
+ "lstrip": false,
1614
+ "normalized": false,
1615
+ "rstrip": false,
1616
+ "single_word": false,
1617
+ "special": true
1618
+ },
1619
+ "128199": {
1620
+ "content": "<|gigatoken_200|>",
1621
+ "lstrip": false,
1622
+ "normalized": false,
1623
+ "rstrip": false,
1624
+ "single_word": false,
1625
+ "special": true
1626
+ },
1627
+ "128200": {
1628
+ "content": "<|gigatoken_201|>",
1629
+ "lstrip": false,
1630
+ "normalized": false,
1631
+ "rstrip": false,
1632
+ "single_word": false,
1633
+ "special": true
1634
+ },
1635
+ "128201": {
1636
+ "content": "<|gigatoken_202|>",
1637
+ "lstrip": false,
1638
+ "normalized": false,
1639
+ "rstrip": false,
1640
+ "single_word": false,
1641
+ "special": true
1642
+ },
1643
+ "128202": {
1644
+ "content": "<|gigatoken_203|>",
1645
+ "lstrip": false,
1646
+ "normalized": false,
1647
+ "rstrip": false,
1648
+ "single_word": false,
1649
+ "special": true
1650
+ },
1651
+ "128203": {
1652
+ "content": "<|gigatoken_204|>",
1653
+ "lstrip": false,
1654
+ "normalized": false,
1655
+ "rstrip": false,
1656
+ "single_word": false,
1657
+ "special": true
1658
+ },
1659
+ "128204": {
1660
+ "content": "<|gigatoken_205|>",
1661
+ "lstrip": false,
1662
+ "normalized": false,
1663
+ "rstrip": false,
1664
+ "single_word": false,
1665
+ "special": true
1666
+ },
1667
+ "128205": {
1668
+ "content": "<|gigatoken_206|>",
1669
+ "lstrip": false,
1670
+ "normalized": false,
1671
+ "rstrip": false,
1672
+ "single_word": false,
1673
+ "special": true
1674
+ },
1675
+ "128206": {
1676
+ "content": "<|gigatoken_207|>",
1677
+ "lstrip": false,
1678
+ "normalized": false,
1679
+ "rstrip": false,
1680
+ "single_word": false,
1681
+ "special": true
1682
+ },
1683
+ "128207": {
1684
+ "content": "<|gigatoken_208|>",
1685
+ "lstrip": false,
1686
+ "normalized": false,
1687
+ "rstrip": false,
1688
+ "single_word": false,
1689
+ "special": true
1690
+ },
1691
+ "128208": {
1692
+ "content": "<|gigatoken_209|>",
1693
+ "lstrip": false,
1694
+ "normalized": false,
1695
+ "rstrip": false,
1696
+ "single_word": false,
1697
+ "special": true
1698
+ },
1699
+ "128209": {
1700
+ "content": "<|gigatoken_210|>",
1701
+ "lstrip": false,
1702
+ "normalized": false,
1703
+ "rstrip": false,
1704
+ "single_word": false,
1705
+ "special": true
1706
+ },
1707
+ "128210": {
1708
+ "content": "<|gigatoken_211|>",
1709
+ "lstrip": false,
1710
+ "normalized": false,
1711
+ "rstrip": false,
1712
+ "single_word": false,
1713
+ "special": true
1714
+ },
1715
+ "128211": {
1716
+ "content": "<|gigatoken_212|>",
1717
+ "lstrip": false,
1718
+ "normalized": false,
1719
+ "rstrip": false,
1720
+ "single_word": false,
1721
+ "special": true
1722
+ },
1723
+ "128212": {
1724
+ "content": "<|gigatoken_213|>",
1725
+ "lstrip": false,
1726
+ "normalized": false,
1727
+ "rstrip": false,
1728
+ "single_word": false,
1729
+ "special": true
1730
+ },
1731
+ "128213": {
1732
+ "content": "<|gigatoken_214|>",
1733
+ "lstrip": false,
1734
+ "normalized": false,
1735
+ "rstrip": false,
1736
+ "single_word": false,
1737
+ "special": true
1738
+ },
1739
+ "128214": {
1740
+ "content": "<|gigatoken_215|>",
1741
+ "lstrip": false,
1742
+ "normalized": false,
1743
+ "rstrip": false,
1744
+ "single_word": false,
1745
+ "special": true
1746
+ },
1747
+ "128215": {
1748
+ "content": "<|gigatoken_216|>",
1749
+ "lstrip": false,
1750
+ "normalized": false,
1751
+ "rstrip": false,
1752
+ "single_word": false,
1753
+ "special": true
1754
+ },
1755
+ "128216": {
1756
+ "content": "<|gigatoken_217|>",
1757
+ "lstrip": false,
1758
+ "normalized": false,
1759
+ "rstrip": false,
1760
+ "single_word": false,
1761
+ "special": true
1762
+ },
1763
+ "128217": {
1764
+ "content": "<|gigatoken_218|>",
1765
+ "lstrip": false,
1766
+ "normalized": false,
1767
+ "rstrip": false,
1768
+ "single_word": false,
1769
+ "special": true
1770
+ },
1771
+ "128218": {
1772
+ "content": "<|gigatoken_219|>",
1773
+ "lstrip": false,
1774
+ "normalized": false,
1775
+ "rstrip": false,
1776
+ "single_word": false,
1777
+ "special": true
1778
+ },
1779
+ "128219": {
1780
+ "content": "<|gigatoken_220|>",
1781
+ "lstrip": false,
1782
+ "normalized": false,
1783
+ "rstrip": false,
1784
+ "single_word": false,
1785
+ "special": true
1786
+ },
1787
+ "128220": {
1788
+ "content": "<|gigatoken_221|>",
1789
+ "lstrip": false,
1790
+ "normalized": false,
1791
+ "rstrip": false,
1792
+ "single_word": false,
1793
+ "special": true
1794
+ },
1795
+ "128221": {
1796
+ "content": "<|gigatoken_222|>",
1797
+ "lstrip": false,
1798
+ "normalized": false,
1799
+ "rstrip": false,
1800
+ "single_word": false,
1801
+ "special": true
1802
+ },
1803
+ "128222": {
1804
+ "content": "<|gigatoken_223|>",
1805
+ "lstrip": false,
1806
+ "normalized": false,
1807
+ "rstrip": false,
1808
+ "single_word": false,
1809
+ "special": true
1810
+ },
1811
+ "128223": {
1812
+ "content": "<|gigatoken_224|>",
1813
+ "lstrip": false,
1814
+ "normalized": false,
1815
+ "rstrip": false,
1816
+ "single_word": false,
1817
+ "special": true
1818
+ },
1819
+ "128224": {
1820
+ "content": "<|gigatoken_225|>",
1821
+ "lstrip": false,
1822
+ "normalized": false,
1823
+ "rstrip": false,
1824
+ "single_word": false,
1825
+ "special": true
1826
+ },
1827
+ "128225": {
1828
+ "content": "<|gigatoken_226|>",
1829
+ "lstrip": false,
1830
+ "normalized": false,
1831
+ "rstrip": false,
1832
+ "single_word": false,
1833
+ "special": true
1834
+ },
1835
+ "128226": {
1836
+ "content": "<|gigatoken_227|>",
1837
+ "lstrip": false,
1838
+ "normalized": false,
1839
+ "rstrip": false,
1840
+ "single_word": false,
1841
+ "special": true
1842
+ },
1843
+ "128227": {
1844
+ "content": "<|gigatoken_228|>",
1845
+ "lstrip": false,
1846
+ "normalized": false,
1847
+ "rstrip": false,
1848
+ "single_word": false,
1849
+ "special": true
1850
+ },
1851
+ "128228": {
1852
+ "content": "<|gigatoken_229|>",
1853
+ "lstrip": false,
1854
+ "normalized": false,
1855
+ "rstrip": false,
1856
+ "single_word": false,
1857
+ "special": true
1858
+ },
1859
+ "128229": {
1860
+ "content": "<|gigatoken_230|>",
1861
+ "lstrip": false,
1862
+ "normalized": false,
1863
+ "rstrip": false,
1864
+ "single_word": false,
1865
+ "special": true
1866
+ },
1867
+ "128230": {
1868
+ "content": "<|gigatoken_231|>",
1869
+ "lstrip": false,
1870
+ "normalized": false,
1871
+ "rstrip": false,
1872
+ "single_word": false,
1873
+ "special": true
1874
+ },
1875
+ "128231": {
1876
+ "content": "<|gigatoken_232|>",
1877
+ "lstrip": false,
1878
+ "normalized": false,
1879
+ "rstrip": false,
1880
+ "single_word": false,
1881
+ "special": true
1882
+ },
1883
+ "128232": {
1884
+ "content": "<|gigatoken_233|>",
1885
+ "lstrip": false,
1886
+ "normalized": false,
1887
+ "rstrip": false,
1888
+ "single_word": false,
1889
+ "special": true
1890
+ },
1891
+ "128233": {
1892
+ "content": "<|gigatoken_234|>",
1893
+ "lstrip": false,
1894
+ "normalized": false,
1895
+ "rstrip": false,
1896
+ "single_word": false,
1897
+ "special": true
1898
+ },
1899
+ "128234": {
1900
+ "content": "<|gigatoken_235|>",
1901
+ "lstrip": false,
1902
+ "normalized": false,
1903
+ "rstrip": false,
1904
+ "single_word": false,
1905
+ "special": true
1906
+ },
1907
+ "128235": {
1908
+ "content": "<|gigatoken_236|>",
1909
+ "lstrip": false,
1910
+ "normalized": false,
1911
+ "rstrip": false,
1912
+ "single_word": false,
1913
+ "special": true
1914
+ },
1915
+ "128236": {
1916
+ "content": "<|gigatoken_237|>",
1917
+ "lstrip": false,
1918
+ "normalized": false,
1919
+ "rstrip": false,
1920
+ "single_word": false,
1921
+ "special": true
1922
+ },
1923
+ "128237": {
1924
+ "content": "<|gigatoken_238|>",
1925
+ "lstrip": false,
1926
+ "normalized": false,
1927
+ "rstrip": false,
1928
+ "single_word": false,
1929
+ "special": true
1930
+ },
1931
+ "128238": {
1932
+ "content": "<|gigatoken_239|>",
1933
+ "lstrip": false,
1934
+ "normalized": false,
1935
+ "rstrip": false,
1936
+ "single_word": false,
1937
+ "special": true
1938
+ },
1939
+ "128239": {
1940
+ "content": "<|gigatoken_240|>",
1941
+ "lstrip": false,
1942
+ "normalized": false,
1943
+ "rstrip": false,
1944
+ "single_word": false,
1945
+ "special": true
1946
+ },
1947
+ "128240": {
1948
+ "content": "<|gigatoken_241|>",
1949
+ "lstrip": false,
1950
+ "normalized": false,
1951
+ "rstrip": false,
1952
+ "single_word": false,
1953
+ "special": true
1954
+ },
1955
+ "128241": {
1956
+ "content": "<|gigatoken_242|>",
1957
+ "lstrip": false,
1958
+ "normalized": false,
1959
+ "rstrip": false,
1960
+ "single_word": false,
1961
+ "special": true
1962
+ },
1963
+ "128242": {
1964
+ "content": "<|gigatoken_243|>",
1965
+ "lstrip": false,
1966
+ "normalized": false,
1967
+ "rstrip": false,
1968
+ "single_word": false,
1969
+ "special": true
1970
+ },
1971
+ "128243": {
1972
+ "content": "<|gigatoken_244|>",
1973
+ "lstrip": false,
1974
+ "normalized": false,
1975
+ "rstrip": false,
1976
+ "single_word": false,
1977
+ "special": true
1978
+ },
1979
+ "128244": {
1980
+ "content": "<|gigatoken_245|>",
1981
+ "lstrip": false,
1982
+ "normalized": false,
1983
+ "rstrip": false,
1984
+ "single_word": false,
1985
+ "special": true
1986
+ },
1987
+ "128245": {
1988
+ "content": "<|gigatoken_246|>",
1989
+ "lstrip": false,
1990
+ "normalized": false,
1991
+ "rstrip": false,
1992
+ "single_word": false,
1993
+ "special": true
1994
+ },
1995
+ "128246": {
1996
+ "content": "<|gigatoken_247|>",
1997
+ "lstrip": false,
1998
+ "normalized": false,
1999
+ "rstrip": false,
2000
+ "single_word": false,
2001
+ "special": true
2002
+ },
2003
+ "128247": {
2004
+ "content": "<|gigatoken_248|>",
2005
+ "lstrip": false,
2006
+ "normalized": false,
2007
+ "rstrip": false,
2008
+ "single_word": false,
2009
+ "special": true
2010
+ },
2011
+ "128248": {
2012
+ "content": "<|gigatoken_249|>",
2013
+ "lstrip": false,
2014
+ "normalized": false,
2015
+ "rstrip": false,
2016
+ "single_word": false,
2017
+ "special": true
2018
+ },
2019
+ "128249": {
2020
+ "content": "<|gigatoken_250|>",
2021
+ "lstrip": false,
2022
+ "normalized": false,
2023
+ "rstrip": false,
2024
+ "single_word": false,
2025
+ "special": true
2026
+ },
2027
+ "128250": {
2028
+ "content": "<|gigatoken_251|>",
2029
+ "lstrip": false,
2030
+ "normalized": false,
2031
+ "rstrip": false,
2032
+ "single_word": false,
2033
+ "special": true
2034
+ },
2035
+ "128251": {
2036
+ "content": "<|gigatoken_252|>",
2037
+ "lstrip": false,
2038
+ "normalized": false,
2039
+ "rstrip": false,
2040
+ "single_word": false,
2041
+ "special": true
2042
+ },
2043
+ "128252": {
2044
+ "content": "<|gigatoken_253|>",
2045
+ "lstrip": false,
2046
+ "normalized": false,
2047
+ "rstrip": false,
2048
+ "single_word": false,
2049
+ "special": true
2050
+ },
2051
+ "128253": {
2052
+ "content": "<|gigatoken_254|>",
2053
+ "lstrip": false,
2054
+ "normalized": false,
2055
+ "rstrip": false,
2056
+ "single_word": false,
2057
+ "special": true
2058
+ },
2059
+ "128254": {
2060
+ "content": "<|gigatoken_255|>",
2061
+ "lstrip": false,
2062
+ "normalized": false,
2063
+ "rstrip": false,
2064
+ "single_word": false,
2065
+ "special": true
2066
+ },
2067
+ "128255": {
2068
+ "content": "<|gigatoken_256|>",
2069
+ "lstrip": false,
2070
+ "normalized": false,
2071
+ "rstrip": false,
2072
+ "single_word": false,
2073
+ "special": true
2074
+ }
2075
+ },
2076
+ "bos_token": "<s>",
2077
+ "clean_up_tokenization_spaces": true,
2078
+ "eos_token": "</s>",
2079
+ "extra_special_tokens": {},
2080
+ "max_length": 512,
2081
+ "model_max_length": 1000000000000000019884624838656,
2082
+ "pad_to_multiple_of": null,
2083
+ "pad_token": "<unk>",
2084
+ "pad_token_type_id": 0,
2085
+ "padding_side": "right",
2086
+ "sep_token": "<unk>",
2087
+ "stride": 0,
2088
+ "tokenizer_class": "PreTrainedTokenizerFast",
2089
+ "truncation_side": "right",
2090
+ "truncation_strategy": "longest_first",
2091
+ "unk_token": "<unk>"
2092
+ }