Tom Aarsen commited on
Commit
8573a0b
·
1 Parent(s): 7374f0d

Only include tokenizer.json in git-lfs, not *.py, *.md, *.json

Browse files
.gitattributes CHANGED
@@ -34,7 +34,3 @@ saved_model/**/* 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
37
- *.md filter=lfs diff=lfs merge=lfs -text
38
- *.json filter=lfs diff=lfs merge=lfs -text
39
- *.py filter=lfs diff=lfs merge=lfs -text
40
- *.DS_Store 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
 
 
 
 
config.json CHANGED
@@ -1,3 +1,40 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:8d99d311c18c0abf5838de9dc06749f96ea872464ff53cb8e7a1becfbfac79c5
3
- size 1034
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Salesforce/SFR-Embedding-Code-2B_R",
3
+ "architectures": [
4
+ "CodeXEmbedModel2B"
5
+ ],
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_gemma2.CodeXEmbedConfig",
8
+ "AutoModel": "modeling_gemma2.CodeXEmbedModel2B"
9
+ },
10
+ "attention_bias": false,
11
+ "attention_dropout": 0.0,
12
+ "attn_logit_softcapping": 50.0,
13
+ "bos_token_id": 2,
14
+ "cache_implementation": "hybrid",
15
+ "eos_token_id": [
16
+ 1,
17
+ 107
18
+ ],
19
+ "final_logit_softcapping": 30.0,
20
+ "head_dim": 256,
21
+ "hidden_act": "gelu_pytorch_tanh",
22
+ "hidden_activation": "gelu_pytorch_tanh",
23
+ "hidden_size": 2304,
24
+ "initializer_range": 0.02,
25
+ "intermediate_size": 9216,
26
+ "max_position_embeddings": 8192,
27
+ "model_type": "codexembed2b",
28
+ "num_attention_heads": 8,
29
+ "num_hidden_layers": 26,
30
+ "num_key_value_heads": 4,
31
+ "pad_token_id": 0,
32
+ "query_pre_attn_scalar": 256,
33
+ "rms_norm_eps": 1e-06,
34
+ "rope_theta": 10000.0,
35
+ "sliding_window": 4096,
36
+ "torch_dtype": "bfloat16",
37
+ "transformers_version": "4.45.1",
38
+ "use_cache": true,
39
+ "vocab_size": 256000
40
+ }
configuration_gemma2.py CHANGED
@@ -1,3 +1,156 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3e8543cd6586a6ba7880d797c23f0d14f1a9b111ad8e446b5635324b39455f26
3
- size 8423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
2
+ # This file was automatically generated from <path_to_diff_file.py>.
3
+ # Do NOT edit this file manually as any edits will be overwritten by the generation of
4
+ # the file from the diff. If any change should be done, please apply the change to the
5
+ # diff.py file directly.
6
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
7
+ # coding=utf-8
8
+ # Copyright 2024 Google Inc. HuggingFace Inc. team. All rights reserved.
9
+ #
10
+ #
11
+ # Licensed under the Apache License, Version 2.0 (the "License");
12
+ # you may not use this file except in compliance with the License.
13
+ # You may obtain a copy of the License at
14
+ #
15
+ # http://www.apache.org/licenses/LICENSE-2.0
16
+ #
17
+ # Unless required by applicable law or agreed to in writing, software
18
+ # distributed under the License is distributed on an "AS IS" BASIS,
19
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ # See the License for the specific language governing permissions and
21
+ # limitations under the License.
22
+ from transformers import PretrainedConfig
23
+
24
+
25
+ class CodeXEmbedConfig(PretrainedConfig):
26
+ r"""
27
+ This is the configuration class to store the configuration of a [`Gemma2Model`]. It is used to instantiate an Gemma2
28
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
29
+ defaults will yield a similar configuration to that of the Gemma2-7B.
30
+ e.g. [google/gemma2-7b](https://huggingface.co/google/gemma2-7b)
31
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
32
+ documentation from [`PretrainedConfig`] for more information.
33
+ Args:
34
+ vocab_size (`int`, *optional*, defaults to 256000):
35
+ Vocabulary size of the Gemma2 model. Defines the number of different tokens that can be represented by the
36
+ `inputs_ids` passed when calling [`Gemma2Model`]
37
+ hidden_size (`int`, *optional*, defaults to 3072):
38
+ Dimension of the hidden representations.
39
+ intermediate_size (`int`, *optional*, defaults to 24576):
40
+ Dimension of the MLP representations.
41
+ num_hidden_layers (`int`, *optional*, defaults to 28):
42
+ Number of hidden layers in the Transformer decoder.
43
+ num_attention_heads (`int`, *optional*, defaults to 16):
44
+ Number of attention heads for each attention layer in the Transformer decoder.
45
+ num_key_value_heads (`int`, *optional*, defaults to 16):
46
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
47
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
48
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
49
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
50
+ by meanpooling all the original heads within that group. For more details checkout [this
51
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
52
+ `num_attention_heads`.
53
+ head_dim (`int`, *optional*, defaults to 256):
54
+ The attention head dimension.
55
+ hidden_activation (`str` or `function`, *optional*, defaults to `"gelu_pytorch_tanh"`):
56
+ The non-linear activation function (function or string) in the decoder.
57
+ max_position_embeddings (`int`, *optional*, defaults to 8192):
58
+ The maximum sequence length that this model might ever be used with.
59
+ initializer_range (`float`, *optional*, defaults to 0.02):
60
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
61
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
62
+ The epsilon used by the rms normalization layers.
63
+ use_cache (`bool`, *optional*, defaults to `True`):
64
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
65
+ relevant if `config.is_decoder=True`.
66
+ pad_token_id (`int`, *optional*, defaults to 0):
67
+ Padding token id.
68
+ eos_token_id (`int`, *optional*, defaults to 1):
69
+ End of stream token id.
70
+ bos_token_id (`int`, *optional*, defaults to 2):
71
+ Beginning of stream token id.
72
+ tie_word_embeddings (`bool`, *optional*, defaults to `True`):
73
+ Whether to tie weight embeddings
74
+ rope_theta (`float`, *optional*, defaults to 10000.0):
75
+ The base period of the RoPE embeddings.
76
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
77
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
78
+ attention_dropout (`float`, *optional*, defaults to 0.0):
79
+ The dropout ratio for the attention probabilities.
80
+ final_logit_softcapping (`float`, *optional*, defaults to 30.0): scaling factor when applying tanh softcapping on the logits.
81
+ attn_logit_softcapping (`float`, *optional*, defaults to 50.0): scaling factor when applying tanh softcapping on the attention scores.
82
+ query_pre_attn_scalar (`float`, *optional*, defaults to 224): scaling factor used on the attention scores
83
+ sliding_window (`int`, *optional*, defaults to 4096): in Gemma2, every other layer uses sliding window attention. This is the
84
+ size of the sliding window.
85
+ ```python
86
+ >>> from transformers import Gemma2Model, CodeXEmbedConfig
87
+ >>> # Initializing a Gemma2 gemma2-9b style configuration
88
+ >>> configuration = CodeXEmbedConfig()
89
+ >>> # Initializing a model from the gemma2-9b style configuration
90
+ >>> model = Gemma2Model(configuration)
91
+ >>> # Accessing the model configuration
92
+ >>> configuration = model.config
93
+ ```"""
94
+
95
+ model_type = "codexembed2b"
96
+ keys_to_ignore_at_inference = ["past_key_values"]
97
+
98
+ def __init__(
99
+ self,
100
+ vocab_size=256000,
101
+ hidden_size=3072,
102
+ intermediate_size=24576,
103
+ num_hidden_layers=28,
104
+ num_attention_heads=16,
105
+ num_key_value_heads=16,
106
+ head_dim=256,
107
+ hidden_activation="gelu_pytorch_tanh",
108
+ max_position_embeddings=8192,
109
+ initializer_range=0.02,
110
+ rms_norm_eps=1e-6,
111
+ use_cache=True,
112
+ pad_token_id=0,
113
+ eos_token_id=1,
114
+ bos_token_id=2,
115
+ tie_word_embeddings=True,
116
+ rope_theta=10000.0,
117
+ attention_bias=False,
118
+ attention_dropout=0.0,
119
+ final_logit_softcapping=30.0,
120
+ attn_logit_softcapping=50.0,
121
+ query_pre_attn_scalar=224,
122
+ sliding_window=4096,
123
+ **kwargs,
124
+ ):
125
+ self.vocab_size = vocab_size
126
+ self.max_position_embeddings = max_position_embeddings
127
+ self.hidden_size = hidden_size
128
+ self.intermediate_size = intermediate_size
129
+ self.num_hidden_layers = num_hidden_layers
130
+ self.num_attention_heads = num_attention_heads
131
+ self.head_dim = head_dim
132
+ self.num_key_value_heads = num_key_value_heads
133
+ self.hidden_activation = hidden_activation
134
+ self.initializer_range = initializer_range
135
+ self.rms_norm_eps = rms_norm_eps
136
+ self.use_cache = use_cache
137
+ self.rope_theta = rope_theta
138
+ self.attention_bias = attention_bias
139
+ self.attention_dropout = attention_dropout
140
+ self.attn_logit_softcapping = attn_logit_softcapping
141
+
142
+ super().__init__(
143
+ pad_token_id=pad_token_id,
144
+ bos_token_id=bos_token_id,
145
+ eos_token_id=eos_token_id,
146
+ tie_word_embeddings=tie_word_embeddings,
147
+ **kwargs,
148
+ )
149
+ self.final_logit_softcapping = final_logit_softcapping
150
+ self.query_pre_attn_scalar = query_pre_attn_scalar
151
+ self.sliding_window = sliding_window
152
+ self.cache_implementation = "hybrid"
153
+
154
+ MODEL_TYPE = "codexembed2b"
155
+ from transformers import AutoConfig
156
+ AutoConfig.register(MODEL_TYPE, CodeXEmbedConfig)
model.safetensors.index.json CHANGED
@@ -1,3 +1,295 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:92764588f700e36874c52f9f05bba143857e5069fc69b14450f907a1cdf879ed
3
- size 22495
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 5228683776
4
+ },
5
+ "weight_map": {
6
+ "embed_tokens.weight": "model-00001-of-00002.safetensors",
7
+ "layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
8
+ "layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
9
+ "layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
10
+ "layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
11
+ "layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
12
+ "layers.0.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "layers.0.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
14
+ "layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
15
+ "layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
16
+ "layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
17
+ "layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
18
+ "layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
19
+ "layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
20
+ "layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
21
+ "layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
22
+ "layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
23
+ "layers.1.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
24
+ "layers.1.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
25
+ "layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
26
+ "layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
27
+ "layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
28
+ "layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
29
+ "layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
30
+ "layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
31
+ "layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
32
+ "layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
33
+ "layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
34
+ "layers.10.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
35
+ "layers.10.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
36
+ "layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
37
+ "layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
38
+ "layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
39
+ "layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
40
+ "layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
41
+ "layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
42
+ "layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
43
+ "layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
44
+ "layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
45
+ "layers.11.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
46
+ "layers.11.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
47
+ "layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
48
+ "layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
49
+ "layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
50
+ "layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
51
+ "layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
52
+ "layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
53
+ "layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
54
+ "layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
55
+ "layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
56
+ "layers.12.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
57
+ "layers.12.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
58
+ "layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
59
+ "layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
60
+ "layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
61
+ "layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
62
+ "layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
63
+ "layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
64
+ "layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
65
+ "layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
66
+ "layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
67
+ "layers.13.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
68
+ "layers.13.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
69
+ "layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
70
+ "layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
71
+ "layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
72
+ "layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
73
+ "layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
74
+ "layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
75
+ "layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
76
+ "layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
77
+ "layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
78
+ "layers.14.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
79
+ "layers.14.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
80
+ "layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
81
+ "layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
82
+ "layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
83
+ "layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
84
+ "layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
85
+ "layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
86
+ "layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
87
+ "layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
88
+ "layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
89
+ "layers.15.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
90
+ "layers.15.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
91
+ "layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
92
+ "layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
93
+ "layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
94
+ "layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
95
+ "layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
96
+ "layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
97
+ "layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
98
+ "layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
99
+ "layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
100
+ "layers.16.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
101
+ "layers.16.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
102
+ "layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
103
+ "layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
104
+ "layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
105
+ "layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
106
+ "layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
107
+ "layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
108
+ "layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
109
+ "layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
110
+ "layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
111
+ "layers.17.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
112
+ "layers.17.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
113
+ "layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
114
+ "layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
115
+ "layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
116
+ "layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
117
+ "layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
118
+ "layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
119
+ "layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
120
+ "layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
121
+ "layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
122
+ "layers.18.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
123
+ "layers.18.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
124
+ "layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
125
+ "layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
126
+ "layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
127
+ "layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
128
+ "layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
129
+ "layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
130
+ "layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
131
+ "layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
132
+ "layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
133
+ "layers.19.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
134
+ "layers.19.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
135
+ "layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
136
+ "layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
137
+ "layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
138
+ "layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
139
+ "layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
140
+ "layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
141
+ "layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
142
+ "layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
143
+ "layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
144
+ "layers.2.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
145
+ "layers.2.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
146
+ "layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
147
+ "layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
148
+ "layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
149
+ "layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
150
+ "layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
151
+ "layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
152
+ "layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
153
+ "layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
154
+ "layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
155
+ "layers.20.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
156
+ "layers.20.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
157
+ "layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
158
+ "layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
159
+ "layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
160
+ "layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
161
+ "layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors",
162
+ "layers.21.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
163
+ "layers.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
164
+ "layers.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
165
+ "layers.21.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
166
+ "layers.21.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
167
+ "layers.21.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
168
+ "layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
169
+ "layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
170
+ "layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
171
+ "layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
172
+ "layers.22.input_layernorm.weight": "model-00001-of-00002.safetensors",
173
+ "layers.22.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
174
+ "layers.22.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
175
+ "layers.22.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
176
+ "layers.22.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
177
+ "layers.22.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
178
+ "layers.22.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
179
+ "layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
180
+ "layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
181
+ "layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
182
+ "layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
183
+ "layers.23.input_layernorm.weight": "model-00001-of-00002.safetensors",
184
+ "layers.23.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
185
+ "layers.23.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
186
+ "layers.23.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
187
+ "layers.23.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
188
+ "layers.23.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
189
+ "layers.23.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
190
+ "layers.23.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
191
+ "layers.23.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
192
+ "layers.23.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
193
+ "layers.23.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
194
+ "layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
195
+ "layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
196
+ "layers.24.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
197
+ "layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
198
+ "layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
199
+ "layers.24.post_feedforward_layernorm.weight": "model-00002-of-00002.safetensors",
200
+ "layers.24.pre_feedforward_layernorm.weight": "model-00002-of-00002.safetensors",
201
+ "layers.24.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
202
+ "layers.24.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
203
+ "layers.24.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
204
+ "layers.24.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
205
+ "layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
206
+ "layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
207
+ "layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
208
+ "layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
209
+ "layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
210
+ "layers.25.post_feedforward_layernorm.weight": "model-00002-of-00002.safetensors",
211
+ "layers.25.pre_feedforward_layernorm.weight": "model-00002-of-00002.safetensors",
212
+ "layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
213
+ "layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
214
+ "layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
215
+ "layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
216
+ "layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
217
+ "layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
218
+ "layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
219
+ "layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
220
+ "layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
221
+ "layers.3.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
222
+ "layers.3.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
223
+ "layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
224
+ "layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
225
+ "layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
226
+ "layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
227
+ "layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
228
+ "layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
229
+ "layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
230
+ "layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
231
+ "layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
232
+ "layers.4.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
233
+ "layers.4.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
234
+ "layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
235
+ "layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
236
+ "layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
237
+ "layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
238
+ "layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
239
+ "layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
240
+ "layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
241
+ "layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
242
+ "layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
243
+ "layers.5.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
244
+ "layers.5.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
245
+ "layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
246
+ "layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
247
+ "layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
248
+ "layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
249
+ "layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
250
+ "layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
251
+ "layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
252
+ "layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
253
+ "layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
254
+ "layers.6.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
255
+ "layers.6.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
256
+ "layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
257
+ "layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
258
+ "layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
259
+ "layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
260
+ "layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
261
+ "layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
262
+ "layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
263
+ "layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
264
+ "layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
265
+ "layers.7.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
266
+ "layers.7.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
267
+ "layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
268
+ "layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
269
+ "layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
270
+ "layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
271
+ "layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
272
+ "layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
273
+ "layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
274
+ "layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
275
+ "layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
276
+ "layers.8.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
277
+ "layers.8.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
278
+ "layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
279
+ "layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
280
+ "layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
281
+ "layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
282
+ "layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
283
+ "layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
284
+ "layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
285
+ "layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
286
+ "layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
287
+ "layers.9.post_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
288
+ "layers.9.pre_feedforward_layernorm.weight": "model-00001-of-00002.safetensors",
289
+ "layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
290
+ "layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
291
+ "layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
292
+ "layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
293
+ "norm.weight": "model-00002-of-00002.safetensors"
294
+ }
295
+ }
modeling_gemma2.py CHANGED
@@ -1,3 +1,1395 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f131d619523ba705182c1e6811475d606532ecd5d10a3c53aa0098146c01fce1
3
- size 63465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
2
+ # This file was automatically generated from <path_to_diff_file.py>.
3
+ # Do NOT edit this file manually as any edits will be overwritten by the generation of
4
+ # the file from the diff. If any change should be done, please apply the change to the
5
+ # diff.py file directly.
6
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
7
+ # coding=utf-8
8
+ # Copyright 2024 Google Inc. HuggingFace Inc. team. All rights reserved.
9
+ #
10
+ #
11
+ # Licensed under the Apache License, Version 2.0 (the "License");
12
+ # you may not use this file except in compliance with the License.
13
+ # You may obtain a copy of the License at
14
+ #
15
+ # http://www.apache.org/licenses/LICENSE-2.0
16
+ #
17
+ # Unless required by applicable law or agreed to in writing, software
18
+ # distributed under the License is distributed on an "AS IS" BASIS,
19
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ # See the License for the specific language governing permissions and
21
+ # limitations under the License.
22
+ from typing import List, Optional, Tuple, Union
23
+
24
+ import torch
25
+ import torch.utils.checkpoint
26
+ from torch import nn
27
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
28
+
29
+ from transformers.activations import ACT2FN
30
+ from transformers.cache_utils import Cache, HybridCache
31
+ from transformers.modeling_outputs import (
32
+ BaseModelOutputWithPast,
33
+ CausalLMOutputWithPast,
34
+ SequenceClassifierOutputWithPast,
35
+ TokenClassifierOutput,
36
+ )
37
+ from transformers.modeling_utils import PreTrainedModel
38
+ from transformers.utils import (
39
+ add_start_docstrings,
40
+ add_start_docstrings_to_model_forward,
41
+ is_flash_attn_2_available,
42
+ is_flash_attn_greater_or_equal,
43
+ is_flash_attn_greater_or_equal_2_10,
44
+ logging,
45
+ replace_return_docstrings,
46
+ )
47
+ from transformers.modeling_attn_mask_utils import _prepare_4d_attention_mask_for_sdpa
48
+ from .configuration_gemma2 import CodeXEmbedConfig
49
+ from transformers import AutoTokenizer, AutoModel
50
+ import torch
51
+ import logging
52
+ import numpy as np
53
+ from typing import List, Dict
54
+
55
+
56
+ if is_flash_attn_2_available():
57
+ from transformers.modeling_flash_attention_utils import _flash_attention_forward
58
+
59
+
60
+ logger = logging.getLogger(__name__)
61
+
62
+
63
+ # Copied from transformers.models.llama.modeling_llama._prepare_4d_causal_attention_mask_with_cache_position
64
+ def _prepare_4d_causal_attention_mask_with_cache_position(
65
+ attention_mask: torch.Tensor,
66
+ sequence_length: int,
67
+ target_length: int,
68
+ dtype: torch.dtype,
69
+ device: torch.device,
70
+ min_dtype: float,
71
+ cache_position: torch.Tensor,
72
+ batch_size: int,
73
+ ):
74
+ """
75
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
76
+ `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
77
+
78
+ Args:
79
+ attention_mask (`torch.Tensor`):
80
+ A 2D attention mask of shape `(batch_size, key_value_length)` or a 4D attention mask of shape `(batch_size, 1, query_length, key_value_length)`.
81
+ sequence_length (`int`):
82
+ The sequence length being processed.
83
+ target_length (`int`):
84
+ The target length: when generating with static cache, the mask should be as long as the static cache, to account for the 0 padding, the part of the cache that is not filled yet.
85
+ dtype (`torch.dtype`):
86
+ The dtype to use for the 4D attention mask.
87
+ device (`torch.device`):
88
+ The device to plcae the 4D attention mask on.
89
+ min_dtype (`float`):
90
+ The minimum value representable with the dtype `dtype`.
91
+ cache_position (`torch.Tensor`):
92
+ Indices depicting the position of the input sequence tokens in the sequence.
93
+ batch_size (`torch.Tensor`):
94
+ Batch size.
95
+ """
96
+ if attention_mask is not None and attention_mask.dim() == 4:
97
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
98
+ causal_mask = attention_mask
99
+ else:
100
+ causal_mask = torch.full((sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device)
101
+ if sequence_length != 1:
102
+ causal_mask = torch.triu(causal_mask, diagonal=1)
103
+ causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
104
+ causal_mask = causal_mask[None, None, :, :].expand(batch_size, 1, -1, -1)
105
+ if attention_mask is not None:
106
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
107
+ mask_length = attention_mask.shape[-1]
108
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
109
+ padding_mask = padding_mask == 0
110
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
111
+ padding_mask, min_dtype
112
+ )
113
+
114
+ return causal_mask
115
+
116
+
117
+ class Gemma2RMSNorm(nn.Module):
118
+ def __init__(self, dim: int, eps: float = 1e-6):
119
+ super().__init__()
120
+ self.eps = eps
121
+ self.weight = nn.Parameter(torch.zeros(dim))
122
+
123
+ def _norm(self, x):
124
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
125
+
126
+ def forward(self, x):
127
+ output = self._norm(x.float())
128
+ # Llama does x.to(float16) * w whilst Gemma2 is (x * w).to(float16)
129
+ # See https://github.com/huggingface/transformers/pull/29402
130
+ output = output * (1.0 + self.weight.float())
131
+ return output.type_as(x)
132
+
133
+ def extra_repr(self):
134
+ return f"{tuple(self.weight.shape)}, eps={self.eps}"
135
+
136
+
137
+ class Gemma2RotaryEmbedding(nn.Module):
138
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
139
+ super().__init__()
140
+
141
+ self.dim = dim
142
+ self.max_position_embeddings = max_position_embeddings
143
+ self.base = base
144
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64).float() / self.dim))
145
+ self.register_buffer("inv_freq", tensor=inv_freq, persistent=False)
146
+
147
+ @torch.no_grad()
148
+ def forward(self, x, position_ids, seq_len=None):
149
+ # x: [bs, num_attention_heads, seq_len, head_size]
150
+ self.inv_freq.to(x.device)
151
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
152
+ position_ids_expanded = position_ids[:, None, :].float()
153
+ # Force float32 since bfloat16 loses precision on long contexts
154
+ # See https://github.com/huggingface/transformers/pull/29285
155
+ device_type = x.device.type
156
+ device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
157
+ with torch.autocast(device_type=device_type, enabled=False):
158
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
159
+ emb = torch.cat((freqs, freqs), dim=-1)
160
+ cos = emb.cos()
161
+ sin = emb.sin()
162
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
163
+
164
+
165
+ def rotate_half(x):
166
+ """Rotates half the hidden dims of the input."""
167
+ x1 = x[..., : x.shape[-1] // 2]
168
+ x2 = x[..., x.shape[-1] // 2 :]
169
+ return torch.cat((-x2, x1), dim=-1)
170
+
171
+
172
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
173
+ """Applies Rotary Position Embedding to the query and key tensors.
174
+
175
+ Args:
176
+ q (`torch.Tensor`): The query tensor.
177
+ k (`torch.Tensor`): The key tensor.
178
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
179
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
180
+ position_ids (`torch.Tensor`, *optional*):
181
+ Deprecated and unused.
182
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
183
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
184
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
185
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
186
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
187
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
188
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
189
+ Returns:
190
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
191
+ """
192
+ cos = cos.unsqueeze(unsqueeze_dim)
193
+ sin = sin.unsqueeze(unsqueeze_dim)
194
+ q_embed = (q * cos) + (rotate_half(q) * sin)
195
+ k_embed = (k * cos) + (rotate_half(k) * sin)
196
+ return q_embed, k_embed
197
+
198
+
199
+ class Gemma2MLP(nn.Module):
200
+ def __init__(self, config):
201
+ super().__init__()
202
+ self.config = config
203
+ self.hidden_size = config.hidden_size
204
+ self.intermediate_size = config.intermediate_size
205
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
206
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
207
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
208
+ self.act_fn = ACT2FN[config.hidden_activation]
209
+
210
+ def forward(self, x):
211
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
212
+
213
+
214
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
215
+ """
216
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
217
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
218
+ """
219
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
220
+ if n_rep == 1:
221
+ return hidden_states
222
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
223
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
224
+
225
+
226
+ class Gemma2Attention(nn.Module):
227
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
228
+
229
+ def __init__(self, config: CodeXEmbedConfig, layer_idx: Optional[int] = None, is_causal: bool=False):
230
+ super().__init__()
231
+ self.config = config
232
+ self.layer_idx = layer_idx
233
+ if layer_idx is None:
234
+ logger.warning_once(
235
+ f"Instantiating {self.__class__.__name__} without passing a `layer_idx` is not recommended and will "
236
+ "lead to errors during the forward call if caching is used. Please make sure to provide a `layer_idx` "
237
+ "when creating this class."
238
+ )
239
+
240
+ self.attention_dropout = config.attention_dropout
241
+ self.hidden_size = config.hidden_size
242
+ self.num_heads = config.num_attention_heads
243
+ self.head_dim = config.head_dim
244
+ self.num_key_value_heads = config.num_key_value_heads
245
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
246
+ self.max_position_embeddings = config.max_position_embeddings
247
+ self.rope_theta = config.rope_theta
248
+ self.is_causal = is_causal
249
+ self.scaling = config.query_pre_attn_scalar**-0.5
250
+
251
+ if self.hidden_size % self.num_heads != 0:
252
+ raise ValueError(
253
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
254
+ f" and `num_heads`: {self.num_heads})."
255
+ )
256
+
257
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
258
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
259
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
260
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
261
+ self.rotary_emb = Gemma2RotaryEmbedding(
262
+ self.head_dim,
263
+ max_position_embeddings=self.max_position_embeddings,
264
+ base=self.rope_theta,
265
+ )
266
+ self.sliding_window = config.sliding_window if not bool(layer_idx % 2) else None
267
+
268
+ def forward(
269
+ self,
270
+ hidden_states: torch.Tensor,
271
+ attention_mask: Optional[torch.Tensor] = None,
272
+ position_ids: Optional[torch.LongTensor] = None,
273
+ past_key_value: Optional[Cache] = None,
274
+ output_attentions: bool = False,
275
+ use_cache: bool = False,
276
+ cache_position: Optional[torch.LongTensor] = None,
277
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
278
+ bsz, q_len, _ = hidden_states.size()
279
+
280
+ query_states = self.q_proj(hidden_states)
281
+ key_states = self.k_proj(hidden_states)
282
+ value_states = self.v_proj(hidden_states)
283
+
284
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
285
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
286
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
287
+
288
+ cos, sin = self.rotary_emb(value_states, position_ids)
289
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
290
+
291
+ if past_key_value is not None:
292
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
293
+ cache_kwargs = {
294
+ "sin": sin,
295
+ "cos": cos,
296
+ "sliding_window": self.sliding_window,
297
+ "cache_position": cache_position,
298
+ }
299
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
300
+
301
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
302
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
303
+
304
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) * self.scaling
305
+
306
+ if self.config.attn_logit_softcapping is not None:
307
+ attn_weights = attn_weights / self.config.attn_logit_softcapping
308
+ attn_weights = torch.tanh(attn_weights)
309
+ attn_weights = attn_weights * self.config.attn_logit_softcapping
310
+
311
+ if attention_mask is not None: # no matter the length, we just slice it
312
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
313
+ attn_weights = attn_weights + causal_mask
314
+
315
+ # upcast attention to fp32
316
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
317
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
318
+ attn_output = torch.matmul(attn_weights, value_states)
319
+
320
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
321
+ raise ValueError(
322
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
323
+ f" {attn_output.size()}"
324
+ )
325
+
326
+ attn_output = attn_output.transpose(1, 2).contiguous()
327
+
328
+ attn_output = attn_output.view(bsz, q_len, -1)
329
+ attn_output = self.o_proj(attn_output)
330
+
331
+ if not output_attentions:
332
+ attn_weights = None
333
+
334
+ return attn_output, attn_weights, past_key_value
335
+
336
+
337
+ class Gemma2FlashAttention2(Gemma2Attention):
338
+ """
339
+ Gemma2 flash attention module. This module inherits from `Gemma2Attention` as the weights of the module stays
340
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
341
+ flash attention and deal with padding tokens in case the input contains any of them.
342
+ """
343
+
344
+ def __init__(self, *args, **kwargs):
345
+ super().__init__(*args, **kwargs)
346
+
347
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
348
+ # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
349
+ # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
350
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
351
+
352
+ def forward(
353
+ self,
354
+ hidden_states: torch.Tensor,
355
+ attention_mask: Optional[torch.LongTensor] = None,
356
+ position_ids: Optional[torch.LongTensor] = None,
357
+ past_key_value: Optional[Cache] = None,
358
+ output_attentions: bool = False,
359
+ use_cache: bool = False,
360
+ cache_position: Optional[torch.LongTensor] = None,
361
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
362
+ output_attentions = False
363
+
364
+ bsz, q_len, _ = hidden_states.size()
365
+
366
+ query_states = self.q_proj(hidden_states)
367
+ key_states = self.k_proj(hidden_states)
368
+ value_states = self.v_proj(hidden_states)
369
+
370
+ # Flash attention requires the input to have the shape
371
+ # batch_size x seq_length x head_dim x hidden_dim
372
+ # therefore we just need to keep the original shape
373
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
374
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
375
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
376
+
377
+ cos, sin = self.rotary_emb(value_states, position_ids)
378
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
379
+
380
+ if past_key_value is not None:
381
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
382
+ cache_kwargs = {
383
+ "sin": sin,
384
+ "cos": cos,
385
+ "sliding_window": self.sliding_window,
386
+ "cache_position": cache_position,
387
+ }
388
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
389
+
390
+ if attention_mask is not None:
391
+ seq_len = attention_mask.shape[1]
392
+ key_states = key_states[:, :, :seq_len]
393
+ value_states = value_states[:, :, :seq_len]
394
+
395
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
396
+ # to be able to avoid many of these transpose/reshape/view.
397
+ query_states = query_states.transpose(1, 2)
398
+ key_states = key_states.transpose(1, 2)
399
+ value_states = value_states.transpose(1, 2)
400
+
401
+ dropout_rate = self.attention_dropout if self.training else 0.0
402
+
403
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
404
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
405
+ # cast them back in the correct dtype just to be sure everything works as expected.
406
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
407
+ # in fp32. (Gemma2RMSNorm handles it correctly)
408
+
409
+ input_dtype = query_states.dtype
410
+ if input_dtype == torch.float32:
411
+ if torch.is_autocast_enabled():
412
+ target_dtype = torch.get_autocast_gpu_dtype()
413
+ # Handle the case where the model is quantized
414
+ elif hasattr(self.config, "_pre_quantization_dtype"):
415
+ target_dtype = self.config._pre_quantization_dtype
416
+ else:
417
+ target_dtype = self.q_proj.weight.dtype
418
+
419
+ logger.warning_once(
420
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
421
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
422
+ f" {target_dtype}."
423
+ )
424
+
425
+ query_states = query_states.to(target_dtype)
426
+ key_states = key_states.to(target_dtype)
427
+ value_states = value_states.to(target_dtype)
428
+
429
+ attn_output = _flash_attention_forward(
430
+ query_states,
431
+ key_states,
432
+ value_states,
433
+ attention_mask,
434
+ q_len,
435
+ dropout=dropout_rate,
436
+ softmax_scale=self.scaling,
437
+ is_causal=self.is_causal,
438
+ use_top_left_mask=self._flash_attn_uses_top_left_mask,
439
+ softcap=self.config.attn_logit_softcapping if is_flash_attn_greater_or_equal("2.6.0") else None,
440
+ )
441
+
442
+ attn_output = attn_output.reshape(bsz, q_len, -1).contiguous()
443
+ attn_output = self.o_proj(attn_output)
444
+
445
+ if not output_attentions:
446
+ attn_weights = None
447
+
448
+ return attn_output, attn_weights, past_key_value
449
+
450
+
451
+ class Gemma2SdpaAttention(Gemma2Attention):
452
+ """
453
+ Gemma2 attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
454
+ `Gemma2Attention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
455
+ SDPA API.
456
+ """
457
+
458
+ # Adapted from Gemma2Attention.forward
459
+ def forward(
460
+ self,
461
+ hidden_states: torch.Tensor,
462
+ attention_mask: Optional[torch.Tensor] = None,
463
+ position_ids: Optional[torch.LongTensor] = None,
464
+ past_key_value: Optional[Cache] = None,
465
+ output_attentions: bool = False,
466
+ use_cache: bool = False,
467
+ cache_position: Optional[torch.LongTensor] = None,
468
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
469
+ if output_attentions:
470
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
471
+ logger.warning_once(
472
+ "Gemma2Model is using Gemma2SdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
473
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
474
+ )
475
+ return super().forward(
476
+ hidden_states=hidden_states,
477
+ attention_mask=attention_mask,
478
+ position_ids=position_ids,
479
+ past_key_value=past_key_value,
480
+ output_attentions=output_attentions,
481
+ use_cache=use_cache,
482
+ cache_position=cache_position,
483
+ )
484
+
485
+ bsz, q_len, _ = hidden_states.size()
486
+
487
+ query_states = self.q_proj(hidden_states)
488
+ key_states = self.k_proj(hidden_states)
489
+ value_states = self.v_proj(hidden_states)
490
+
491
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
492
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
493
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
494
+
495
+ cos, sin = self.rotary_emb(value_states, position_ids)
496
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
497
+
498
+ if past_key_value is not None:
499
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
500
+ cache_kwargs = {
501
+ "sin": sin,
502
+ "cos": cos,
503
+ "sliding_window": self.sliding_window,
504
+ "cache_position": cache_position,
505
+ }
506
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
507
+
508
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
509
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
510
+
511
+ causal_mask = attention_mask
512
+ if attention_mask is not None:
513
+ causal_mask = causal_mask[:, :, :, : key_states.shape[-2]]
514
+
515
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
516
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
517
+ if query_states.device.type == "cuda" and causal_mask is not None:
518
+ query_states = query_states.contiguous()
519
+ key_states = key_states.contiguous()
520
+ value_states = value_states.contiguous()
521
+
522
+ # We dispatch to SDPA's Flash Attention or Efficient kernels via this `is_causal` if statement instead of an inline conditional assignment
523
+ # in SDPA to support both torch.compile's dynamic shapes and full graph options. An inline conditional prevents dynamic shapes from compiling.
524
+ # We pass our own mask, so is_causal must be False
525
+ is_causal = True if causal_mask is None and q_len > 1 else False
526
+
527
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
528
+ query_states,
529
+ key_states,
530
+ value_states,
531
+ attn_mask=causal_mask,
532
+ dropout_p=self.attention_dropout if self.training else 0.0,
533
+ is_causal=is_causal,
534
+ scale=self.scaling,
535
+ )
536
+
537
+ attn_output = attn_output.transpose(1, 2).contiguous()
538
+ attn_output = attn_output.view(bsz, q_len, -1)
539
+
540
+ attn_output = self.o_proj(attn_output)
541
+
542
+ return attn_output, None, past_key_value
543
+
544
+
545
+ GEMMA2_ATTENTION_CLASSES = {
546
+ "eager": Gemma2Attention,
547
+ "flash_attention_2": Gemma2FlashAttention2,
548
+ "sdpa": Gemma2SdpaAttention,
549
+ }
550
+
551
+
552
+ class Gemma2DecoderLayer(nn.Module):
553
+ def __init__(self, config: CodeXEmbedConfig, layer_idx: int, is_causal: bool):
554
+ super().__init__()
555
+ self.config = config
556
+ self.hidden_size = config.hidden_size
557
+
558
+ self.self_attn = GEMMA2_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx, is_causal=is_causal)
559
+
560
+ self.mlp = Gemma2MLP(config)
561
+ self.input_layernorm = Gemma2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
562
+ self.post_attention_layernorm = Gemma2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
563
+
564
+ self.is_sliding = not bool(layer_idx % 2)
565
+ self.pre_feedforward_layernorm = Gemma2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
566
+ self.post_feedforward_layernorm = Gemma2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
567
+ self.sliding_window = config.sliding_window
568
+
569
+ def forward(
570
+ self,
571
+ hidden_states: torch.Tensor,
572
+ attention_mask: Optional[torch.Tensor] = None,
573
+ position_ids: Optional[torch.LongTensor] = None,
574
+ past_key_value: Optional[Cache] = None,
575
+ output_attentions: Optional[bool] = False,
576
+ use_cache: Optional[bool] = False,
577
+ cache_position: Optional[torch.LongTensor] = None,
578
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
579
+ if self.is_sliding and attention_mask is not None: # efficient SDPA and no padding
580
+ # Flash-attn is a 2D tensor
581
+ if self.config._attn_implementation == "flash_attention_2":
582
+ attention_mask = attention_mask[:, -self.sliding_window :]
583
+ else:
584
+ min_dtype = torch.finfo(attention_mask.dtype).min
585
+ sliding_window_mask = torch.tril(
586
+ torch.ones_like(attention_mask, dtype=torch.bool), diagonal=-self.sliding_window
587
+ )
588
+ attention_mask = torch.where(sliding_window_mask, min_dtype, attention_mask)
589
+ if attention_mask.shape[-1] <= 1: # when decoding
590
+ attention_mask = attention_mask[:, :, :, -self.sliding_window :]
591
+
592
+ residual = hidden_states
593
+
594
+ hidden_states = self.input_layernorm(hidden_states)
595
+
596
+ # Self Attention
597
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
598
+ hidden_states=hidden_states,
599
+ attention_mask=attention_mask,
600
+ position_ids=position_ids,
601
+ past_key_value=past_key_value,
602
+ output_attentions=output_attentions,
603
+ use_cache=use_cache,
604
+ cache_position=cache_position,
605
+ )
606
+ hidden_states = self.post_attention_layernorm(hidden_states)
607
+ hidden_states = residual + hidden_states
608
+
609
+ residual = hidden_states
610
+ hidden_states = self.pre_feedforward_layernorm(hidden_states)
611
+ hidden_states = self.mlp(hidden_states)
612
+ hidden_states = self.post_feedforward_layernorm(hidden_states)
613
+ hidden_states = residual + hidden_states
614
+
615
+ outputs = (hidden_states,)
616
+
617
+ if output_attentions:
618
+ outputs += (self_attn_weights,)
619
+
620
+ if use_cache:
621
+ outputs += (present_key_value,)
622
+
623
+ return outputs
624
+
625
+
626
+ GEMMA2_START_DOCSTRING = r"""
627
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
628
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
629
+ etc.)
630
+
631
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
632
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
633
+ and behavior.
634
+
635
+ Parameters:
636
+ config ([`CodeXEmbedConfig`]):
637
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
638
+ load the weights associated with the model, only the configuration. Check out the
639
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
640
+ """
641
+
642
+
643
+ @add_start_docstrings(
644
+ "The bare Gemma2 Model outputting raw hidden-states without any specific head on top.",
645
+ GEMMA2_START_DOCSTRING,
646
+ )
647
+ class Gemma2PreTrainedModel(PreTrainedModel):
648
+ config_class = CodeXEmbedConfig
649
+ base_model_prefix = "model"
650
+ supports_gradient_checkpointing = True
651
+ _no_split_modules = ["Gemma2DecoderLayer"]
652
+ _skip_keys_device_placement = ["past_key_values"]
653
+ _supports_flash_attn_2 = True
654
+ _supports_sdpa = True
655
+ _supports_cache_class = True
656
+ _supports_quantized_cache = False
657
+ _supports_static_cache = True
658
+
659
+ def _init_weights(self, module):
660
+ std = self.config.initializer_range
661
+ if isinstance(module, nn.Linear):
662
+ module.weight.data.normal_(mean=0.0, std=std)
663
+ if module.bias is not None:
664
+ module.bias.data.zero_()
665
+ elif isinstance(module, nn.Embedding):
666
+ module.weight.data.normal_(mean=0.0, std=std)
667
+ if module.padding_idx is not None:
668
+ module.weight.data[module.padding_idx].zero_()
669
+
670
+
671
+ _CONFIG_FOR_DOC = "CodeXEmbedConfig"
672
+
673
+
674
+ GEMMA2_INPUTS_DOCSTRING = r"""
675
+ Args:
676
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
677
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
678
+ it.
679
+
680
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
681
+ [`PreTrainedTokenizer.__call__`] for details.
682
+
683
+ [What are input IDs?](../glossary#input-ids)
684
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
685
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
686
+
687
+ - 1 for tokens that are **not masked**,
688
+ - 0 for tokens that are **masked**.
689
+
690
+ [What are attention masks?](../glossary#attention-mask)
691
+
692
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
693
+ [`PreTrainedTokenizer.__call__`] for details.
694
+
695
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
696
+ `past_key_values`).
697
+
698
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
699
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
700
+ information on the default strategy.
701
+
702
+ - 1 indicates the head is **not masked**,
703
+ - 0 indicates the head is **masked**.
704
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
705
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
706
+ config.n_positions - 1]`.
707
+
708
+ [What are position IDs?](../glossary#position-ids)
709
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
710
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
711
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
712
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
713
+
714
+ Two formats are allowed:
715
+ - a [`~cache_utils.Cache`] instance;
716
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
717
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
718
+ cache format.
719
+
720
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
721
+ legacy cache format will be returned.
722
+
723
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
724
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
725
+ of shape `(batch_size, sequence_length)`.
726
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
727
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
728
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
729
+ model's internal embedding lookup matrix.
730
+ use_cache (`bool`, *optional*):
731
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
732
+ `past_key_values`).
733
+ output_attentions (`bool`, *optional*):
734
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
735
+ tensors for more detail.
736
+ output_hidden_states (`bool`, *optional*):
737
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
738
+ more detail.
739
+ return_dict (`bool`, *optional*):
740
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
741
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
742
+ Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
743
+ this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
744
+ the complete sequence length.
745
+ """
746
+
747
+
748
+ @add_start_docstrings(
749
+ "The bare Gemma2 Model outputting raw hidden-states without any specific head on top.",
750
+ GEMMA2_START_DOCSTRING,
751
+ )
752
+ class Gemma2Model(Gemma2PreTrainedModel):
753
+ """
754
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`Gemma2DecoderLayer`]
755
+
756
+ Args:
757
+ config: CodeXEmbedConfig
758
+ """
759
+
760
+ def __init__(self, config: CodeXEmbedConfig, **kwargs):
761
+ super().__init__(config)
762
+ self.padding_idx = config.pad_token_id
763
+ self.vocab_size = config.vocab_size
764
+
765
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
766
+ self.is_causal = getattr(kwargs, 'is_causal', False)
767
+ self.layers = nn.ModuleList(
768
+ [Gemma2DecoderLayer(config, layer_idx, self.is_causal) for layer_idx in range(config.num_hidden_layers)]
769
+ )
770
+ self.norm = Gemma2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
771
+ self.gradient_checkpointing = False
772
+
773
+ # Initialize weights and apply final processing
774
+ self.post_init()
775
+
776
+ def get_input_embeddings(self):
777
+ return self.embed_tokens
778
+
779
+ def set_input_embeddings(self, value):
780
+ self.embed_tokens = value
781
+
782
+ @add_start_docstrings_to_model_forward(GEMMA2_INPUTS_DOCSTRING)
783
+ def forward(
784
+ self,
785
+ input_ids: torch.LongTensor = None,
786
+ attention_mask: Optional[torch.Tensor] = None,
787
+ position_ids: Optional[torch.LongTensor] = None,
788
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
789
+ inputs_embeds: Optional[torch.FloatTensor] = None,
790
+ use_cache: Optional[bool] = None,
791
+ output_attentions: Optional[bool] = None,
792
+ output_hidden_states: Optional[bool] = None,
793
+ return_dict: Optional[bool] = None,
794
+ cache_position: Optional[torch.LongTensor] = None,
795
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
796
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
797
+ output_hidden_states = (
798
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
799
+ )
800
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
801
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
802
+
803
+ if (input_ids is None) ^ (inputs_embeds is not None):
804
+ raise ValueError(
805
+ "You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
806
+ )
807
+
808
+ if self.gradient_checkpointing and self.training and use_cache:
809
+ logger.warning_once(
810
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
811
+ )
812
+ use_cache = False
813
+
814
+ if inputs_embeds is None:
815
+ inputs_embeds = self.embed_tokens(input_ids)
816
+
817
+ if cache_position is None:
818
+ cache_position = torch.arange(0, inputs_embeds.shape[1], device=inputs_embeds.device)
819
+
820
+ if position_ids is None:
821
+ position_ids = cache_position.unsqueeze(0)
822
+
823
+ if self.is_causal:
824
+ causal_mask = self._update_attention_mask(
825
+ attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
826
+ )
827
+ else:
828
+ causal_mask = _prepare_4d_attention_mask_for_sdpa(
829
+ attention_mask, inputs_embeds.dtype
830
+ )
831
+
832
+ # embed positions
833
+ hidden_states = inputs_embeds
834
+
835
+ # normalized
836
+ # Gemma2 downcasts the below to float16, causing sqrt(3072)=55.4256 to become 55.5
837
+ # See https://github.com/huggingface/transformers/pull/29402
838
+ normalizer = torch.tensor(self.config.hidden_size**0.5, dtype=hidden_states.dtype)
839
+ hidden_states = hidden_states * normalizer
840
+
841
+ all_hidden_states = () if output_hidden_states else None
842
+ all_self_attns = () if output_attentions else None
843
+
844
+ for decoder_layer in self.layers:
845
+ if output_hidden_states:
846
+ all_hidden_states += (hidden_states,)
847
+
848
+ if self.gradient_checkpointing and self.training:
849
+ layer_outputs = self._gradient_checkpointing_func(
850
+ decoder_layer.__call__,
851
+ hidden_states,
852
+ causal_mask,
853
+ position_ids,
854
+ past_key_values,
855
+ output_attentions,
856
+ use_cache,
857
+ cache_position,
858
+ )
859
+ else:
860
+ layer_outputs = decoder_layer(
861
+ hidden_states,
862
+ attention_mask=causal_mask,
863
+ position_ids=position_ids,
864
+ past_key_value=past_key_values,
865
+ output_attentions=output_attentions,
866
+ use_cache=use_cache,
867
+ cache_position=cache_position,
868
+ )
869
+
870
+ hidden_states = layer_outputs[0]
871
+
872
+ if output_attentions:
873
+ all_self_attns += (layer_outputs[1],)
874
+
875
+ hidden_states = self.norm(hidden_states)
876
+
877
+ # add hidden states from the last decoder layer
878
+ if output_hidden_states:
879
+ all_hidden_states += (hidden_states,)
880
+
881
+ next_cache = past_key_values if use_cache else None
882
+
883
+ if not return_dict:
884
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
885
+ return BaseModelOutputWithPast(
886
+ last_hidden_state=hidden_states,
887
+ past_key_values=next_cache,
888
+ hidden_states=all_hidden_states,
889
+ attentions=all_self_attns,
890
+ )
891
+
892
+ def _update_attention_mask(
893
+ self,
894
+ attention_mask: torch.Tensor,
895
+ input_tensor: torch.Tensor,
896
+ cache_position: torch.Tensor,
897
+ past_key_values: Cache,
898
+ output_attentions: bool,
899
+ ):
900
+ # Flash Attention currently doesn't support static cache but Gemma2 work only with static cache.
901
+ # So we will pass in attention mask as is in any case, not only when ther's padding. Then we'll use its shape
902
+ # to cut out keys/values trailing 0 used in static cache. This workaround should be compile compatible
903
+ # as it doesn't cause dynamic control issues.
904
+ if self.config._attn_implementation == "flash_attention_2":
905
+ return attention_mask
906
+
907
+ dtype, device = input_tensor.dtype, input_tensor.device
908
+ min_dtype = torch.finfo(dtype).min
909
+ sequence_length = input_tensor.shape[1]
910
+ if isinstance(past_key_values, HybridCache):
911
+ target_length = past_key_values.get_max_length()
912
+ else:
913
+ target_length = attention_mask.shape[-1] if attention_mask is not None else input_tensor.shape[1]
914
+
915
+ # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
916
+ causal_mask = _prepare_4d_causal_attention_mask_with_cache_position(
917
+ attention_mask,
918
+ sequence_length=sequence_length,
919
+ target_length=target_length,
920
+ dtype=dtype,
921
+ device=device,
922
+ min_dtype=min_dtype,
923
+ cache_position=cache_position,
924
+ batch_size=input_tensor.shape[0],
925
+ )
926
+ return causal_mask
927
+
928
+
929
+ class Gemma2ForCausalLM(Gemma2PreTrainedModel):
930
+ _tied_weights_keys = ["lm_head.weight"]
931
+
932
+ def __init__(self, config):
933
+ super().__init__(config)
934
+ self.model = Gemma2Model(config)
935
+ self.vocab_size = config.vocab_size
936
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
937
+
938
+ # Initialize weights and apply final processing
939
+ self.post_init()
940
+
941
+ def get_input_embeddings(self):
942
+ return self.model.embed_tokens
943
+
944
+ def set_input_embeddings(self, value):
945
+ self.model.embed_tokens = value
946
+
947
+ def get_output_embeddings(self):
948
+ return self.lm_head
949
+
950
+ def set_output_embeddings(self, new_embeddings):
951
+ self.lm_head = new_embeddings
952
+
953
+ def set_decoder(self, decoder):
954
+ self.model = decoder
955
+
956
+ def get_decoder(self):
957
+ return self.model
958
+
959
+ @add_start_docstrings_to_model_forward(GEMMA2_INPUTS_DOCSTRING)
960
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
961
+ def forward(
962
+ self,
963
+ input_ids: torch.LongTensor = None,
964
+ attention_mask: Optional[torch.Tensor] = None,
965
+ position_ids: Optional[torch.LongTensor] = None,
966
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
967
+ inputs_embeds: Optional[torch.FloatTensor] = None,
968
+ labels: Optional[torch.LongTensor] = None,
969
+ use_cache: Optional[bool] = None,
970
+ output_attentions: Optional[bool] = None,
971
+ output_hidden_states: Optional[bool] = None,
972
+ return_dict: Optional[bool] = None,
973
+ cache_position: Optional[torch.LongTensor] = None,
974
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
975
+ r"""
976
+ Args:
977
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
978
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
979
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
980
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
981
+
982
+ Returns:
983
+
984
+ Example:
985
+
986
+ ```python
987
+ >>> from transformers import AutoTokenizer, GemmaForCausalLM
988
+
989
+ >>> model = GemmaForCausalLM.from_pretrained("google/gemma-2-9b")
990
+ >>> tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b")
991
+
992
+ >>> prompt = "What is your favorite condiment?"
993
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
994
+
995
+ >>> # Generate
996
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
997
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
998
+ "What is your favorite condiment?"
999
+ ```"""
1000
+ if self.training and self.config._attn_implementation != "eager":
1001
+ logger.warning_once(
1002
+ "It is strongly recommended to train Gemma2 models with the `eager` attention implementation "
1003
+ f"instead of `{self.config._attn_implementation}`. Use `eager` with `AutoModelForCausalLM.from_pretrained('<path-to-checkpoint>', attn_implementation='eager')`."
1004
+ )
1005
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1006
+ output_hidden_states = (
1007
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1008
+ )
1009
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1010
+
1011
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1012
+ outputs = self.model(
1013
+ input_ids=input_ids,
1014
+ attention_mask=attention_mask,
1015
+ position_ids=position_ids,
1016
+ past_key_values=past_key_values,
1017
+ inputs_embeds=inputs_embeds,
1018
+ use_cache=use_cache,
1019
+ output_attentions=output_attentions,
1020
+ output_hidden_states=output_hidden_states,
1021
+ return_dict=return_dict,
1022
+ cache_position=cache_position,
1023
+ )
1024
+
1025
+ hidden_states = outputs[0]
1026
+ logits = self.lm_head(hidden_states)
1027
+ if self.config.final_logit_softcapping is not None:
1028
+ logits = logits / self.config.final_logit_softcapping
1029
+ logits = torch.tanh(logits)
1030
+ logits = logits * self.config.final_logit_softcapping
1031
+
1032
+ logits = logits.float()
1033
+ loss = None
1034
+ if labels is not None:
1035
+ # Shift so that tokens < n predict n
1036
+ shift_logits = logits[..., :-1, :].contiguous()
1037
+ shift_labels = labels[..., 1:].contiguous()
1038
+ # Flatten the tokens
1039
+ loss_fct = CrossEntropyLoss()
1040
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1041
+ shift_labels = shift_labels.view(-1)
1042
+ # Enable model parallelism
1043
+ shift_labels = shift_labels.to(shift_logits.device)
1044
+ loss = loss_fct(shift_logits, shift_labels)
1045
+
1046
+ if not return_dict:
1047
+ output = (logits,) + outputs[1:]
1048
+ return (loss,) + output if loss is not None else output
1049
+
1050
+ return CausalLMOutputWithPast(
1051
+ loss=loss,
1052
+ logits=logits,
1053
+ past_key_values=outputs.past_key_values,
1054
+ hidden_states=outputs.hidden_states,
1055
+ attentions=outputs.attentions,
1056
+ )
1057
+
1058
+ def prepare_inputs_for_generation(
1059
+ self,
1060
+ input_ids,
1061
+ past_key_values=None,
1062
+ attention_mask=None,
1063
+ inputs_embeds=None,
1064
+ cache_position=None,
1065
+ position_ids=None,
1066
+ use_cache=True,
1067
+ **kwargs,
1068
+ ):
1069
+ # If we have cache: let's slice `input_ids` through `cache_position`, to keep only the unprocessed tokens
1070
+ # Exception 1: when passing input_embeds, input_ids may be missing entries
1071
+ # Exception 2: some generation methods do special slicing of input_ids, so we don't need to do it here
1072
+ if past_key_values is not None:
1073
+ if inputs_embeds is not None: # Exception 1
1074
+ input_ids = input_ids[:, -cache_position.shape[0] :]
1075
+ elif input_ids.shape[1] != cache_position.shape[0]: # Default case (the "else", a no op, is Exception 2)
1076
+ input_ids = input_ids[:, cache_position]
1077
+
1078
+ if attention_mask is not None and position_ids is None:
1079
+ # create position_ids on the fly for batch generation
1080
+ position_ids = attention_mask.long().cumsum(-1) - 1
1081
+ position_ids.masked_fill_(attention_mask == 0, 1)
1082
+ if past_key_values:
1083
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1084
+ # This `clone` call is needed to avoid recapturing cuda graphs with `torch.compile`'s
1085
+ # `mode="reduce-overhead`, as otherwise the input `position_ids` would have various stride
1086
+ # during the decoding. Here, simply using `.contiguous()` is not sufficient as in the
1087
+ # batch size = 1 case, `position_ids` is already contiguous but with varying stride
1088
+ # which retriggers a capture.
1089
+ position_ids = position_ids.clone(memory_format=torch.contiguous_format)
1090
+
1091
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1092
+ if inputs_embeds is not None and cache_position[0] == 0:
1093
+ model_inputs = {"inputs_embeds": inputs_embeds}
1094
+ else:
1095
+ # The clone here is for the same reason as for `position_ids`.
1096
+ model_inputs = {"input_ids": input_ids.clone(memory_format=torch.contiguous_format)}
1097
+
1098
+ if isinstance(past_key_values, HybridCache) and attention_mask.ndim == 2:
1099
+ if inputs_embeds is not None:
1100
+ batch_size, sequence_length = inputs_embeds.shape
1101
+ device = inputs_embeds.device
1102
+ else:
1103
+ batch_size, sequence_length = input_ids.shape
1104
+ device = input_ids.device
1105
+
1106
+ dtype = self.lm_head.weight.dtype
1107
+ min_dtype = torch.finfo(dtype).min
1108
+
1109
+ attention_mask = _prepare_4d_causal_attention_mask_with_cache_position(
1110
+ attention_mask,
1111
+ sequence_length=sequence_length,
1112
+ target_length=past_key_values.get_max_length(),
1113
+ dtype=dtype,
1114
+ device=device,
1115
+ min_dtype=min_dtype,
1116
+ cache_position=cache_position,
1117
+ batch_size=batch_size,
1118
+ )
1119
+
1120
+ model_inputs.update(
1121
+ {
1122
+ "position_ids": position_ids,
1123
+ "cache_position": cache_position,
1124
+ "past_key_values": past_key_values,
1125
+ "use_cache": use_cache,
1126
+ "attention_mask": attention_mask,
1127
+ }
1128
+ )
1129
+ return model_inputs
1130
+
1131
+
1132
+ @add_start_docstrings(
1133
+ """
1134
+ The Gemma2 Model transformer with a sequence classification head on top (linear layer).
1135
+
1136
+ [`Gemma2ForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1137
+ (e.g. GPT-2) do.
1138
+
1139
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1140
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1141
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1142
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1143
+ each row of the batch).
1144
+ """,
1145
+ GEMMA2_START_DOCSTRING,
1146
+ )
1147
+ class Gemma2ForSequenceClassification(Gemma2PreTrainedModel):
1148
+ def __init__(self, config):
1149
+ super().__init__(config)
1150
+ self.num_labels = config.num_labels
1151
+ self.model = Gemma2Model(config)
1152
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1153
+
1154
+ # Initialize weights and apply final processing
1155
+ self.post_init()
1156
+
1157
+ def get_input_embeddings(self):
1158
+ return self.model.embed_tokens
1159
+
1160
+ def set_input_embeddings(self, value):
1161
+ self.model.embed_tokens = value
1162
+
1163
+ @add_start_docstrings_to_model_forward(GEMMA2_INPUTS_DOCSTRING)
1164
+ def forward(
1165
+ self,
1166
+ input_ids: torch.LongTensor = None,
1167
+ attention_mask: Optional[torch.Tensor] = None,
1168
+ position_ids: Optional[torch.LongTensor] = None,
1169
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1170
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1171
+ labels: Optional[torch.LongTensor] = None,
1172
+ use_cache: Optional[bool] = None,
1173
+ output_attentions: Optional[bool] = None,
1174
+ output_hidden_states: Optional[bool] = None,
1175
+ return_dict: Optional[bool] = None,
1176
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1177
+ r"""
1178
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1179
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1180
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1181
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1182
+ """
1183
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1184
+
1185
+ transformer_outputs = self.model(
1186
+ input_ids,
1187
+ attention_mask=attention_mask,
1188
+ position_ids=position_ids,
1189
+ past_key_values=past_key_values,
1190
+ inputs_embeds=inputs_embeds,
1191
+ use_cache=use_cache,
1192
+ output_attentions=output_attentions,
1193
+ output_hidden_states=output_hidden_states,
1194
+ return_dict=return_dict,
1195
+ )
1196
+ hidden_states = transformer_outputs[0]
1197
+ logits = self.score(hidden_states)
1198
+
1199
+ if input_ids is not None:
1200
+ batch_size = input_ids.shape[0]
1201
+ else:
1202
+ batch_size = inputs_embeds.shape[0]
1203
+
1204
+ if self.config.pad_token_id is None and batch_size != 1:
1205
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1206
+ if self.config.pad_token_id is None:
1207
+ sequence_lengths = -1
1208
+ else:
1209
+ if input_ids is not None:
1210
+ # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
1211
+ sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
1212
+ sequence_lengths = sequence_lengths % input_ids.shape[-1]
1213
+ sequence_lengths = sequence_lengths.to(logits.device)
1214
+ else:
1215
+ sequence_lengths = -1
1216
+
1217
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1218
+
1219
+ loss = None
1220
+ if labels is not None:
1221
+ labels = labels.to(logits.device)
1222
+ if self.config.problem_type is None:
1223
+ if self.num_labels == 1:
1224
+ self.config.problem_type = "regression"
1225
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1226
+ self.config.problem_type = "single_label_classification"
1227
+ else:
1228
+ self.config.problem_type = "multi_label_classification"
1229
+
1230
+ if self.config.problem_type == "regression":
1231
+ loss_fct = MSELoss()
1232
+ if self.num_labels == 1:
1233
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1234
+ else:
1235
+ loss = loss_fct(pooled_logits, labels)
1236
+ elif self.config.problem_type == "single_label_classification":
1237
+ loss_fct = CrossEntropyLoss()
1238
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1239
+ elif self.config.problem_type == "multi_label_classification":
1240
+ loss_fct = BCEWithLogitsLoss()
1241
+ loss = loss_fct(pooled_logits, labels)
1242
+ if not return_dict:
1243
+ output = (pooled_logits,) + transformer_outputs[1:]
1244
+ return ((loss,) + output) if loss is not None else output
1245
+
1246
+ return SequenceClassifierOutputWithPast(
1247
+ loss=loss,
1248
+ logits=pooled_logits,
1249
+ past_key_values=transformer_outputs.past_key_values,
1250
+ hidden_states=transformer_outputs.hidden_states,
1251
+ attentions=transformer_outputs.attentions,
1252
+ )
1253
+
1254
+
1255
+ @add_start_docstrings(
1256
+ """
1257
+ The Gemma2 Model transformer with a token classification head on top (a linear layer on top of the hidden-states
1258
+ output) e.g. for Named-Entity-Recognition (NER) tasks.
1259
+ """,
1260
+ GEMMA2_START_DOCSTRING,
1261
+ )
1262
+ class Gemma2ForTokenClassification(Gemma2PreTrainedModel):
1263
+ def __init__(self, config):
1264
+ super().__init__(config)
1265
+ self.num_labels = config.num_labels
1266
+ self.model = Gemma2Model(config)
1267
+ if getattr(config, "classifier_dropout", None) is not None:
1268
+ classifier_dropout = config.classifier_dropout
1269
+ elif getattr(config, "hidden_dropout", None) is not None:
1270
+ classifier_dropout = config.hidden_dropout
1271
+ else:
1272
+ classifier_dropout = 0.1
1273
+ self.dropout = nn.Dropout(classifier_dropout)
1274
+ self.score = nn.Linear(config.hidden_size, config.num_labels)
1275
+
1276
+ # Initialize weights and apply final processing
1277
+ self.post_init()
1278
+
1279
+ def get_input_embeddings(self):
1280
+ return self.model.embed_tokens
1281
+
1282
+ def set_input_embeddings(self, value):
1283
+ self.model.embed_tokens = value
1284
+
1285
+ @add_start_docstrings_to_model_forward(GEMMA2_INPUTS_DOCSTRING)
1286
+ def forward(
1287
+ self,
1288
+ input_ids: Optional[torch.LongTensor] = None,
1289
+ attention_mask: Optional[torch.Tensor] = None,
1290
+ position_ids: Optional[torch.LongTensor] = None,
1291
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1292
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1293
+ labels: Optional[torch.LongTensor] = None,
1294
+ use_cache: Optional[bool] = None,
1295
+ output_attentions: Optional[bool] = None,
1296
+ output_hidden_states: Optional[bool] = None,
1297
+ return_dict: Optional[bool] = None,
1298
+ ) -> Union[Tuple, TokenClassifierOutput]:
1299
+ r"""
1300
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1301
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1302
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1303
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1304
+ """
1305
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1306
+
1307
+ outputs = self.model(
1308
+ input_ids,
1309
+ attention_mask=attention_mask,
1310
+ position_ids=position_ids,
1311
+ past_key_values=past_key_values,
1312
+ inputs_embeds=inputs_embeds,
1313
+ use_cache=use_cache,
1314
+ output_attentions=output_attentions,
1315
+ output_hidden_states=output_hidden_states,
1316
+ return_dict=return_dict,
1317
+ )
1318
+ sequence_output = outputs[0]
1319
+ sequence_output = self.dropout(sequence_output)
1320
+ logits = self.score(sequence_output)
1321
+
1322
+ loss = None
1323
+ if labels is not None:
1324
+ loss_fct = CrossEntropyLoss()
1325
+ loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
1326
+
1327
+ if not return_dict:
1328
+ output = (logits,) + outputs[2:]
1329
+ return ((loss,) + output) if loss is not None else output
1330
+
1331
+ return TokenClassifierOutput(
1332
+ loss=loss,
1333
+ logits=logits,
1334
+ hidden_states=outputs.hidden_states,
1335
+ attentions=outputs.attentions,
1336
+ )
1337
+
1338
+ def get_detailed_instruct(task_description: str, query: str) -> str:
1339
+ return f'Instruct: {task_description}\nQuery: {query}'
1340
+
1341
+ class CodeXEmbedModel2B(PreTrainedModel):
1342
+ config_class = CodeXEmbedConfig
1343
+ base_model_prefix = 'model'
1344
+ def __init__(self, config, **kwargs):
1345
+ super().__init__(config)
1346
+ self.model = Gemma2Model.from_pretrained(config._name_or_path, trust_remote_code=True, is_causal=False, device_map="auto")
1347
+ self.tokenizer = AutoTokenizer.from_pretrained(config._name_or_path, trust_remote_code=True, device_map="auto")
1348
+
1349
+ if not self.tokenizer.pad_token:
1350
+ self.tokenizer.pad_token = self.tokenizer.eos_token
1351
+ self.tokenizer.padding_side = 'right'
1352
+
1353
+ def last_token_pool(self, model_output, attention_mask):
1354
+ last_hidden_states = model_output.last_hidden_state
1355
+ sequence_lengths = attention_mask.sum(dim=1) - 1
1356
+ batch_size = last_hidden_states.shape[0]
1357
+ return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
1358
+
1359
+ def encode_text(self, texts: List[str], max_length: int) -> np.ndarray:
1360
+ logging.info(f"Encoding {len(texts)} texts...")
1361
+
1362
+ # Tokenize all texts
1363
+ encoded_input = self.tokenizer(
1364
+ texts,
1365
+ padding=True,
1366
+ truncation=True,
1367
+ max_length=max_length,
1368
+ return_tensors="pt"
1369
+ ).to('cuda')
1370
+
1371
+ # Generate embeddings
1372
+ with torch.no_grad():
1373
+ model_output = self.model(**encoded_input)
1374
+ embeddings = self.last_token_pool(model_output, encoded_input['attention_mask'])
1375
+
1376
+ if embeddings is None:
1377
+ logging.error("Embeddings are None.")
1378
+ else:
1379
+ logging.info(f"Encoded {len(embeddings)} embeddings.")
1380
+
1381
+ return embeddings.cpu()
1382
+
1383
+ def encode_queries(self, queries: List[str], max_length: int, instruction: str, **kwargs) -> np.ndarray:
1384
+ all_queries = [get_detailed_instruct(instruction, query) for query in queries]
1385
+ return self.encode_text(all_queries, max_length)
1386
+
1387
+ def encode_corpus(self, corpus: List[str], max_length: int,
1388
+ **kwargs) -> np.ndarray:
1389
+ return self.encode_text(corpus, max_length)
1390
+
1391
+ ## AutoModel Register
1392
+ AutoModel.register(CodeXEmbedConfig, CodeXEmbedModel2B)
1393
+
1394
+ ## Register for auto class
1395
+ CodeXEmbedModel2B.register_for_auto_class("AutoModel")
special_tokens_map.json CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:baec30ea10906f16adb8c18af7a34023002c1746542612b8b41c9f09e1351351
3
- size 636
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<start_of_turn>",
4
+ "<end_of_turn>"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<bos>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "eos_token": {
14
+ "content": "<eos>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "pad_token": {
21
+ "content": "<pad>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "unk_token": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ }
34
+ }
tokenizer_config.json CHANGED
@@ -1,3 +1,2013 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9f4ba5ef130db0eb0e00bf6ba764431f6d9ffa7efe552bd648da2a40b256ec45
3
- size 46995
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": true,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<pad>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<eos>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "<bos>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "3": {
30
+ "content": "<unk>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "4": {
38
+ "content": "<mask>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": false
44
+ },
45
+ "5": {
46
+ "content": "<2mass>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": false
52
+ },
53
+ "6": {
54
+ "content": "[@BOS@]",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": false
60
+ },
61
+ "7": {
62
+ "content": "<unused0>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": false
68
+ },
69
+ "8": {
70
+ "content": "<unused1>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": false
76
+ },
77
+ "9": {
78
+ "content": "<unused2>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": false
84
+ },
85
+ "10": {
86
+ "content": "<unused3>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": false
92
+ },
93
+ "11": {
94
+ "content": "<unused4>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": false
100
+ },
101
+ "12": {
102
+ "content": "<unused5>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": false
108
+ },
109
+ "13": {
110
+ "content": "<unused6>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": false
116
+ },
117
+ "14": {
118
+ "content": "<unused7>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "15": {
126
+ "content": "<unused8>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "16": {
134
+ "content": "<unused9>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "17": {
142
+ "content": "<unused10>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "18": {
150
+ "content": "<unused11>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "19": {
158
+ "content": "<unused12>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "20": {
166
+ "content": "<unused13>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "21": {
174
+ "content": "<unused14>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "22": {
182
+ "content": "<unused15>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "23": {
190
+ "content": "<unused16>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "24": {
198
+ "content": "<unused17>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "25": {
206
+ "content": "<unused18>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ },
213
+ "26": {
214
+ "content": "<unused19>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": false
220
+ },
221
+ "27": {
222
+ "content": "<unused20>",
223
+ "lstrip": false,
224
+ "normalized": false,
225
+ "rstrip": false,
226
+ "single_word": false,
227
+ "special": false
228
+ },
229
+ "28": {
230
+ "content": "<unused21>",
231
+ "lstrip": false,
232
+ "normalized": false,
233
+ "rstrip": false,
234
+ "single_word": false,
235
+ "special": false
236
+ },
237
+ "29": {
238
+ "content": "<unused22>",
239
+ "lstrip": false,
240
+ "normalized": false,
241
+ "rstrip": false,
242
+ "single_word": false,
243
+ "special": false
244
+ },
245
+ "30": {
246
+ "content": "<unused23>",
247
+ "lstrip": false,
248
+ "normalized": false,
249
+ "rstrip": false,
250
+ "single_word": false,
251
+ "special": false
252
+ },
253
+ "31": {
254
+ "content": "<unused24>",
255
+ "lstrip": false,
256
+ "normalized": false,
257
+ "rstrip": false,
258
+ "single_word": false,
259
+ "special": false
260
+ },
261
+ "32": {
262
+ "content": "<unused25>",
263
+ "lstrip": false,
264
+ "normalized": false,
265
+ "rstrip": false,
266
+ "single_word": false,
267
+ "special": false
268
+ },
269
+ "33": {
270
+ "content": "<unused26>",
271
+ "lstrip": false,
272
+ "normalized": false,
273
+ "rstrip": false,
274
+ "single_word": false,
275
+ "special": false
276
+ },
277
+ "34": {
278
+ "content": "<unused27>",
279
+ "lstrip": false,
280
+ "normalized": false,
281
+ "rstrip": false,
282
+ "single_word": false,
283
+ "special": false
284
+ },
285
+ "35": {
286
+ "content": "<unused28>",
287
+ "lstrip": false,
288
+ "normalized": false,
289
+ "rstrip": false,
290
+ "single_word": false,
291
+ "special": false
292
+ },
293
+ "36": {
294
+ "content": "<unused29>",
295
+ "lstrip": false,
296
+ "normalized": false,
297
+ "rstrip": false,
298
+ "single_word": false,
299
+ "special": false
300
+ },
301
+ "37": {
302
+ "content": "<unused30>",
303
+ "lstrip": false,
304
+ "normalized": false,
305
+ "rstrip": false,
306
+ "single_word": false,
307
+ "special": false
308
+ },
309
+ "38": {
310
+ "content": "<unused31>",
311
+ "lstrip": false,
312
+ "normalized": false,
313
+ "rstrip": false,
314
+ "single_word": false,
315
+ "special": false
316
+ },
317
+ "39": {
318
+ "content": "<unused32>",
319
+ "lstrip": false,
320
+ "normalized": false,
321
+ "rstrip": false,
322
+ "single_word": false,
323
+ "special": false
324
+ },
325
+ "40": {
326
+ "content": "<unused33>",
327
+ "lstrip": false,
328
+ "normalized": false,
329
+ "rstrip": false,
330
+ "single_word": false,
331
+ "special": false
332
+ },
333
+ "41": {
334
+ "content": "<unused34>",
335
+ "lstrip": false,
336
+ "normalized": false,
337
+ "rstrip": false,
338
+ "single_word": false,
339
+ "special": false
340
+ },
341
+ "42": {
342
+ "content": "<unused35>",
343
+ "lstrip": false,
344
+ "normalized": false,
345
+ "rstrip": false,
346
+ "single_word": false,
347
+ "special": false
348
+ },
349
+ "43": {
350
+ "content": "<unused36>",
351
+ "lstrip": false,
352
+ "normalized": false,
353
+ "rstrip": false,
354
+ "single_word": false,
355
+ "special": false
356
+ },
357
+ "44": {
358
+ "content": "<unused37>",
359
+ "lstrip": false,
360
+ "normalized": false,
361
+ "rstrip": false,
362
+ "single_word": false,
363
+ "special": false
364
+ },
365
+ "45": {
366
+ "content": "<unused38>",
367
+ "lstrip": false,
368
+ "normalized": false,
369
+ "rstrip": false,
370
+ "single_word": false,
371
+ "special": false
372
+ },
373
+ "46": {
374
+ "content": "<unused39>",
375
+ "lstrip": false,
376
+ "normalized": false,
377
+ "rstrip": false,
378
+ "single_word": false,
379
+ "special": false
380
+ },
381
+ "47": {
382
+ "content": "<unused40>",
383
+ "lstrip": false,
384
+ "normalized": false,
385
+ "rstrip": false,
386
+ "single_word": false,
387
+ "special": false
388
+ },
389
+ "48": {
390
+ "content": "<unused41>",
391
+ "lstrip": false,
392
+ "normalized": false,
393
+ "rstrip": false,
394
+ "single_word": false,
395
+ "special": false
396
+ },
397
+ "49": {
398
+ "content": "<unused42>",
399
+ "lstrip": false,
400
+ "normalized": false,
401
+ "rstrip": false,
402
+ "single_word": false,
403
+ "special": false
404
+ },
405
+ "50": {
406
+ "content": "<unused43>",
407
+ "lstrip": false,
408
+ "normalized": false,
409
+ "rstrip": false,
410
+ "single_word": false,
411
+ "special": false
412
+ },
413
+ "51": {
414
+ "content": "<unused44>",
415
+ "lstrip": false,
416
+ "normalized": false,
417
+ "rstrip": false,
418
+ "single_word": false,
419
+ "special": false
420
+ },
421
+ "52": {
422
+ "content": "<unused45>",
423
+ "lstrip": false,
424
+ "normalized": false,
425
+ "rstrip": false,
426
+ "single_word": false,
427
+ "special": false
428
+ },
429
+ "53": {
430
+ "content": "<unused46>",
431
+ "lstrip": false,
432
+ "normalized": false,
433
+ "rstrip": false,
434
+ "single_word": false,
435
+ "special": false
436
+ },
437
+ "54": {
438
+ "content": "<unused47>",
439
+ "lstrip": false,
440
+ "normalized": false,
441
+ "rstrip": false,
442
+ "single_word": false,
443
+ "special": false
444
+ },
445
+ "55": {
446
+ "content": "<unused48>",
447
+ "lstrip": false,
448
+ "normalized": false,
449
+ "rstrip": false,
450
+ "single_word": false,
451
+ "special": false
452
+ },
453
+ "56": {
454
+ "content": "<unused49>",
455
+ "lstrip": false,
456
+ "normalized": false,
457
+ "rstrip": false,
458
+ "single_word": false,
459
+ "special": false
460
+ },
461
+ "57": {
462
+ "content": "<unused50>",
463
+ "lstrip": false,
464
+ "normalized": false,
465
+ "rstrip": false,
466
+ "single_word": false,
467
+ "special": false
468
+ },
469
+ "58": {
470
+ "content": "<unused51>",
471
+ "lstrip": false,
472
+ "normalized": false,
473
+ "rstrip": false,
474
+ "single_word": false,
475
+ "special": false
476
+ },
477
+ "59": {
478
+ "content": "<unused52>",
479
+ "lstrip": false,
480
+ "normalized": false,
481
+ "rstrip": false,
482
+ "single_word": false,
483
+ "special": false
484
+ },
485
+ "60": {
486
+ "content": "<unused53>",
487
+ "lstrip": false,
488
+ "normalized": false,
489
+ "rstrip": false,
490
+ "single_word": false,
491
+ "special": false
492
+ },
493
+ "61": {
494
+ "content": "<unused54>",
495
+ "lstrip": false,
496
+ "normalized": false,
497
+ "rstrip": false,
498
+ "single_word": false,
499
+ "special": false
500
+ },
501
+ "62": {
502
+ "content": "<unused55>",
503
+ "lstrip": false,
504
+ "normalized": false,
505
+ "rstrip": false,
506
+ "single_word": false,
507
+ "special": false
508
+ },
509
+ "63": {
510
+ "content": "<unused56>",
511
+ "lstrip": false,
512
+ "normalized": false,
513
+ "rstrip": false,
514
+ "single_word": false,
515
+ "special": false
516
+ },
517
+ "64": {
518
+ "content": "<unused57>",
519
+ "lstrip": false,
520
+ "normalized": false,
521
+ "rstrip": false,
522
+ "single_word": false,
523
+ "special": false
524
+ },
525
+ "65": {
526
+ "content": "<unused58>",
527
+ "lstrip": false,
528
+ "normalized": false,
529
+ "rstrip": false,
530
+ "single_word": false,
531
+ "special": false
532
+ },
533
+ "66": {
534
+ "content": "<unused59>",
535
+ "lstrip": false,
536
+ "normalized": false,
537
+ "rstrip": false,
538
+ "single_word": false,
539
+ "special": false
540
+ },
541
+ "67": {
542
+ "content": "<unused60>",
543
+ "lstrip": false,
544
+ "normalized": false,
545
+ "rstrip": false,
546
+ "single_word": false,
547
+ "special": false
548
+ },
549
+ "68": {
550
+ "content": "<unused61>",
551
+ "lstrip": false,
552
+ "normalized": false,
553
+ "rstrip": false,
554
+ "single_word": false,
555
+ "special": false
556
+ },
557
+ "69": {
558
+ "content": "<unused62>",
559
+ "lstrip": false,
560
+ "normalized": false,
561
+ "rstrip": false,
562
+ "single_word": false,
563
+ "special": false
564
+ },
565
+ "70": {
566
+ "content": "<unused63>",
567
+ "lstrip": false,
568
+ "normalized": false,
569
+ "rstrip": false,
570
+ "single_word": false,
571
+ "special": false
572
+ },
573
+ "71": {
574
+ "content": "<unused64>",
575
+ "lstrip": false,
576
+ "normalized": false,
577
+ "rstrip": false,
578
+ "single_word": false,
579
+ "special": false
580
+ },
581
+ "72": {
582
+ "content": "<unused65>",
583
+ "lstrip": false,
584
+ "normalized": false,
585
+ "rstrip": false,
586
+ "single_word": false,
587
+ "special": false
588
+ },
589
+ "73": {
590
+ "content": "<unused66>",
591
+ "lstrip": false,
592
+ "normalized": false,
593
+ "rstrip": false,
594
+ "single_word": false,
595
+ "special": false
596
+ },
597
+ "74": {
598
+ "content": "<unused67>",
599
+ "lstrip": false,
600
+ "normalized": false,
601
+ "rstrip": false,
602
+ "single_word": false,
603
+ "special": false
604
+ },
605
+ "75": {
606
+ "content": "<unused68>",
607
+ "lstrip": false,
608
+ "normalized": false,
609
+ "rstrip": false,
610
+ "single_word": false,
611
+ "special": false
612
+ },
613
+ "76": {
614
+ "content": "<unused69>",
615
+ "lstrip": false,
616
+ "normalized": false,
617
+ "rstrip": false,
618
+ "single_word": false,
619
+ "special": false
620
+ },
621
+ "77": {
622
+ "content": "<unused70>",
623
+ "lstrip": false,
624
+ "normalized": false,
625
+ "rstrip": false,
626
+ "single_word": false,
627
+ "special": false
628
+ },
629
+ "78": {
630
+ "content": "<unused71>",
631
+ "lstrip": false,
632
+ "normalized": false,
633
+ "rstrip": false,
634
+ "single_word": false,
635
+ "special": false
636
+ },
637
+ "79": {
638
+ "content": "<unused72>",
639
+ "lstrip": false,
640
+ "normalized": false,
641
+ "rstrip": false,
642
+ "single_word": false,
643
+ "special": false
644
+ },
645
+ "80": {
646
+ "content": "<unused73>",
647
+ "lstrip": false,
648
+ "normalized": false,
649
+ "rstrip": false,
650
+ "single_word": false,
651
+ "special": false
652
+ },
653
+ "81": {
654
+ "content": "<unused74>",
655
+ "lstrip": false,
656
+ "normalized": false,
657
+ "rstrip": false,
658
+ "single_word": false,
659
+ "special": false
660
+ },
661
+ "82": {
662
+ "content": "<unused75>",
663
+ "lstrip": false,
664
+ "normalized": false,
665
+ "rstrip": false,
666
+ "single_word": false,
667
+ "special": false
668
+ },
669
+ "83": {
670
+ "content": "<unused76>",
671
+ "lstrip": false,
672
+ "normalized": false,
673
+ "rstrip": false,
674
+ "single_word": false,
675
+ "special": false
676
+ },
677
+ "84": {
678
+ "content": "<unused77>",
679
+ "lstrip": false,
680
+ "normalized": false,
681
+ "rstrip": false,
682
+ "single_word": false,
683
+ "special": false
684
+ },
685
+ "85": {
686
+ "content": "<unused78>",
687
+ "lstrip": false,
688
+ "normalized": false,
689
+ "rstrip": false,
690
+ "single_word": false,
691
+ "special": false
692
+ },
693
+ "86": {
694
+ "content": "<unused79>",
695
+ "lstrip": false,
696
+ "normalized": false,
697
+ "rstrip": false,
698
+ "single_word": false,
699
+ "special": false
700
+ },
701
+ "87": {
702
+ "content": "<unused80>",
703
+ "lstrip": false,
704
+ "normalized": false,
705
+ "rstrip": false,
706
+ "single_word": false,
707
+ "special": false
708
+ },
709
+ "88": {
710
+ "content": "<unused81>",
711
+ "lstrip": false,
712
+ "normalized": false,
713
+ "rstrip": false,
714
+ "single_word": false,
715
+ "special": false
716
+ },
717
+ "89": {
718
+ "content": "<unused82>",
719
+ "lstrip": false,
720
+ "normalized": false,
721
+ "rstrip": false,
722
+ "single_word": false,
723
+ "special": false
724
+ },
725
+ "90": {
726
+ "content": "<unused83>",
727
+ "lstrip": false,
728
+ "normalized": false,
729
+ "rstrip": false,
730
+ "single_word": false,
731
+ "special": false
732
+ },
733
+ "91": {
734
+ "content": "<unused84>",
735
+ "lstrip": false,
736
+ "normalized": false,
737
+ "rstrip": false,
738
+ "single_word": false,
739
+ "special": false
740
+ },
741
+ "92": {
742
+ "content": "<unused85>",
743
+ "lstrip": false,
744
+ "normalized": false,
745
+ "rstrip": false,
746
+ "single_word": false,
747
+ "special": false
748
+ },
749
+ "93": {
750
+ "content": "<unused86>",
751
+ "lstrip": false,
752
+ "normalized": false,
753
+ "rstrip": false,
754
+ "single_word": false,
755
+ "special": false
756
+ },
757
+ "94": {
758
+ "content": "<unused87>",
759
+ "lstrip": false,
760
+ "normalized": false,
761
+ "rstrip": false,
762
+ "single_word": false,
763
+ "special": false
764
+ },
765
+ "95": {
766
+ "content": "<unused88>",
767
+ "lstrip": false,
768
+ "normalized": false,
769
+ "rstrip": false,
770
+ "single_word": false,
771
+ "special": false
772
+ },
773
+ "96": {
774
+ "content": "<unused89>",
775
+ "lstrip": false,
776
+ "normalized": false,
777
+ "rstrip": false,
778
+ "single_word": false,
779
+ "special": false
780
+ },
781
+ "97": {
782
+ "content": "<unused90>",
783
+ "lstrip": false,
784
+ "normalized": false,
785
+ "rstrip": false,
786
+ "single_word": false,
787
+ "special": false
788
+ },
789
+ "98": {
790
+ "content": "<unused91>",
791
+ "lstrip": false,
792
+ "normalized": false,
793
+ "rstrip": false,
794
+ "single_word": false,
795
+ "special": false
796
+ },
797
+ "99": {
798
+ "content": "<unused92>",
799
+ "lstrip": false,
800
+ "normalized": false,
801
+ "rstrip": false,
802
+ "single_word": false,
803
+ "special": false
804
+ },
805
+ "100": {
806
+ "content": "<unused93>",
807
+ "lstrip": false,
808
+ "normalized": false,
809
+ "rstrip": false,
810
+ "single_word": false,
811
+ "special": false
812
+ },
813
+ "101": {
814
+ "content": "<unused94>",
815
+ "lstrip": false,
816
+ "normalized": false,
817
+ "rstrip": false,
818
+ "single_word": false,
819
+ "special": false
820
+ },
821
+ "102": {
822
+ "content": "<unused95>",
823
+ "lstrip": false,
824
+ "normalized": false,
825
+ "rstrip": false,
826
+ "single_word": false,
827
+ "special": false
828
+ },
829
+ "103": {
830
+ "content": "<unused96>",
831
+ "lstrip": false,
832
+ "normalized": false,
833
+ "rstrip": false,
834
+ "single_word": false,
835
+ "special": false
836
+ },
837
+ "104": {
838
+ "content": "<unused97>",
839
+ "lstrip": false,
840
+ "normalized": false,
841
+ "rstrip": false,
842
+ "single_word": false,
843
+ "special": false
844
+ },
845
+ "105": {
846
+ "content": "<unused98>",
847
+ "lstrip": false,
848
+ "normalized": false,
849
+ "rstrip": false,
850
+ "single_word": false,
851
+ "special": false
852
+ },
853
+ "106": {
854
+ "content": "<start_of_turn>",
855
+ "lstrip": false,
856
+ "normalized": false,
857
+ "rstrip": false,
858
+ "single_word": false,
859
+ "special": true
860
+ },
861
+ "107": {
862
+ "content": "<end_of_turn>",
863
+ "lstrip": false,
864
+ "normalized": false,
865
+ "rstrip": false,
866
+ "single_word": false,
867
+ "special": true
868
+ },
869
+ "108": {
870
+ "content": "\n",
871
+ "lstrip": false,
872
+ "normalized": false,
873
+ "rstrip": false,
874
+ "single_word": false,
875
+ "special": false
876
+ },
877
+ "109": {
878
+ "content": "\n\n",
879
+ "lstrip": false,
880
+ "normalized": false,
881
+ "rstrip": false,
882
+ "single_word": false,
883
+ "special": false
884
+ },
885
+ "110": {
886
+ "content": "\n\n\n",
887
+ "lstrip": false,
888
+ "normalized": false,
889
+ "rstrip": false,
890
+ "single_word": false,
891
+ "special": false
892
+ },
893
+ "111": {
894
+ "content": "\n\n\n\n",
895
+ "lstrip": false,
896
+ "normalized": false,
897
+ "rstrip": false,
898
+ "single_word": false,
899
+ "special": false
900
+ },
901
+ "112": {
902
+ "content": "\n\n\n\n\n",
903
+ "lstrip": false,
904
+ "normalized": false,
905
+ "rstrip": false,
906
+ "single_word": false,
907
+ "special": false
908
+ },
909
+ "113": {
910
+ "content": "\n\n\n\n\n\n",
911
+ "lstrip": false,
912
+ "normalized": false,
913
+ "rstrip": false,
914
+ "single_word": false,
915
+ "special": false
916
+ },
917
+ "114": {
918
+ "content": "\n\n\n\n\n\n\n",
919
+ "lstrip": false,
920
+ "normalized": false,
921
+ "rstrip": false,
922
+ "single_word": false,
923
+ "special": false
924
+ },
925
+ "115": {
926
+ "content": "\n\n\n\n\n\n\n\n",
927
+ "lstrip": false,
928
+ "normalized": false,
929
+ "rstrip": false,
930
+ "single_word": false,
931
+ "special": false
932
+ },
933
+ "116": {
934
+ "content": "\n\n\n\n\n\n\n\n\n",
935
+ "lstrip": false,
936
+ "normalized": false,
937
+ "rstrip": false,
938
+ "single_word": false,
939
+ "special": false
940
+ },
941
+ "117": {
942
+ "content": "\n\n\n\n\n\n\n\n\n\n",
943
+ "lstrip": false,
944
+ "normalized": false,
945
+ "rstrip": false,
946
+ "single_word": false,
947
+ "special": false
948
+ },
949
+ "118": {
950
+ "content": "\n\n\n\n\n\n\n\n\n\n\n",
951
+ "lstrip": false,
952
+ "normalized": false,
953
+ "rstrip": false,
954
+ "single_word": false,
955
+ "special": false
956
+ },
957
+ "119": {
958
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n",
959
+ "lstrip": false,
960
+ "normalized": false,
961
+ "rstrip": false,
962
+ "single_word": false,
963
+ "special": false
964
+ },
965
+ "120": {
966
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n",
967
+ "lstrip": false,
968
+ "normalized": false,
969
+ "rstrip": false,
970
+ "single_word": false,
971
+ "special": false
972
+ },
973
+ "121": {
974
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
975
+ "lstrip": false,
976
+ "normalized": false,
977
+ "rstrip": false,
978
+ "single_word": false,
979
+ "special": false
980
+ },
981
+ "122": {
982
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
983
+ "lstrip": false,
984
+ "normalized": false,
985
+ "rstrip": false,
986
+ "single_word": false,
987
+ "special": false
988
+ },
989
+ "123": {
990
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
991
+ "lstrip": false,
992
+ "normalized": false,
993
+ "rstrip": false,
994
+ "single_word": false,
995
+ "special": false
996
+ },
997
+ "124": {
998
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
999
+ "lstrip": false,
1000
+ "normalized": false,
1001
+ "rstrip": false,
1002
+ "single_word": false,
1003
+ "special": false
1004
+ },
1005
+ "125": {
1006
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1007
+ "lstrip": false,
1008
+ "normalized": false,
1009
+ "rstrip": false,
1010
+ "single_word": false,
1011
+ "special": false
1012
+ },
1013
+ "126": {
1014
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1015
+ "lstrip": false,
1016
+ "normalized": false,
1017
+ "rstrip": false,
1018
+ "single_word": false,
1019
+ "special": false
1020
+ },
1021
+ "127": {
1022
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1023
+ "lstrip": false,
1024
+ "normalized": false,
1025
+ "rstrip": false,
1026
+ "single_word": false,
1027
+ "special": false
1028
+ },
1029
+ "128": {
1030
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1031
+ "lstrip": false,
1032
+ "normalized": false,
1033
+ "rstrip": false,
1034
+ "single_word": false,
1035
+ "special": false
1036
+ },
1037
+ "129": {
1038
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1039
+ "lstrip": false,
1040
+ "normalized": false,
1041
+ "rstrip": false,
1042
+ "single_word": false,
1043
+ "special": false
1044
+ },
1045
+ "130": {
1046
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1047
+ "lstrip": false,
1048
+ "normalized": false,
1049
+ "rstrip": false,
1050
+ "single_word": false,
1051
+ "special": false
1052
+ },
1053
+ "131": {
1054
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1055
+ "lstrip": false,
1056
+ "normalized": false,
1057
+ "rstrip": false,
1058
+ "single_word": false,
1059
+ "special": false
1060
+ },
1061
+ "132": {
1062
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1063
+ "lstrip": false,
1064
+ "normalized": false,
1065
+ "rstrip": false,
1066
+ "single_word": false,
1067
+ "special": false
1068
+ },
1069
+ "133": {
1070
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1071
+ "lstrip": false,
1072
+ "normalized": false,
1073
+ "rstrip": false,
1074
+ "single_word": false,
1075
+ "special": false
1076
+ },
1077
+ "134": {
1078
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1079
+ "lstrip": false,
1080
+ "normalized": false,
1081
+ "rstrip": false,
1082
+ "single_word": false,
1083
+ "special": false
1084
+ },
1085
+ "135": {
1086
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1087
+ "lstrip": false,
1088
+ "normalized": false,
1089
+ "rstrip": false,
1090
+ "single_word": false,
1091
+ "special": false
1092
+ },
1093
+ "136": {
1094
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1095
+ "lstrip": false,
1096
+ "normalized": false,
1097
+ "rstrip": false,
1098
+ "single_word": false,
1099
+ "special": false
1100
+ },
1101
+ "137": {
1102
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1103
+ "lstrip": false,
1104
+ "normalized": false,
1105
+ "rstrip": false,
1106
+ "single_word": false,
1107
+ "special": false
1108
+ },
1109
+ "138": {
1110
+ "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
1111
+ "lstrip": false,
1112
+ "normalized": false,
1113
+ "rstrip": false,
1114
+ "single_word": false,
1115
+ "special": false
1116
+ },
1117
+ "139": {
1118
+ "content": "▁▁",
1119
+ "lstrip": false,
1120
+ "normalized": false,
1121
+ "rstrip": false,
1122
+ "single_word": false,
1123
+ "special": false
1124
+ },
1125
+ "140": {
1126
+ "content": "▁▁▁",
1127
+ "lstrip": false,
1128
+ "normalized": false,
1129
+ "rstrip": false,
1130
+ "single_word": false,
1131
+ "special": false
1132
+ },
1133
+ "141": {
1134
+ "content": "▁▁▁▁",
1135
+ "lstrip": false,
1136
+ "normalized": false,
1137
+ "rstrip": false,
1138
+ "single_word": false,
1139
+ "special": false
1140
+ },
1141
+ "142": {
1142
+ "content": "▁▁▁▁▁",
1143
+ "lstrip": false,
1144
+ "normalized": false,
1145
+ "rstrip": false,
1146
+ "single_word": false,
1147
+ "special": false
1148
+ },
1149
+ "143": {
1150
+ "content": "▁▁▁▁▁▁",
1151
+ "lstrip": false,
1152
+ "normalized": false,
1153
+ "rstrip": false,
1154
+ "single_word": false,
1155
+ "special": false
1156
+ },
1157
+ "144": {
1158
+ "content": "▁▁▁▁▁▁▁",
1159
+ "lstrip": false,
1160
+ "normalized": false,
1161
+ "rstrip": false,
1162
+ "single_word": false,
1163
+ "special": false
1164
+ },
1165
+ "145": {
1166
+ "content": "▁▁▁▁▁▁▁▁",
1167
+ "lstrip": false,
1168
+ "normalized": false,
1169
+ "rstrip": false,
1170
+ "single_word": false,
1171
+ "special": false
1172
+ },
1173
+ "146": {
1174
+ "content": "▁▁▁▁▁▁▁▁▁",
1175
+ "lstrip": false,
1176
+ "normalized": false,
1177
+ "rstrip": false,
1178
+ "single_word": false,
1179
+ "special": false
1180
+ },
1181
+ "147": {
1182
+ "content": "▁▁▁▁▁▁▁▁▁▁",
1183
+ "lstrip": false,
1184
+ "normalized": false,
1185
+ "rstrip": false,
1186
+ "single_word": false,
1187
+ "special": false
1188
+ },
1189
+ "148": {
1190
+ "content": "▁▁▁▁▁▁▁▁▁▁▁",
1191
+ "lstrip": false,
1192
+ "normalized": false,
1193
+ "rstrip": false,
1194
+ "single_word": false,
1195
+ "special": false
1196
+ },
1197
+ "149": {
1198
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁",
1199
+ "lstrip": false,
1200
+ "normalized": false,
1201
+ "rstrip": false,
1202
+ "single_word": false,
1203
+ "special": false
1204
+ },
1205
+ "150": {
1206
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁",
1207
+ "lstrip": false,
1208
+ "normalized": false,
1209
+ "rstrip": false,
1210
+ "single_word": false,
1211
+ "special": false
1212
+ },
1213
+ "151": {
1214
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1215
+ "lstrip": false,
1216
+ "normalized": false,
1217
+ "rstrip": false,
1218
+ "single_word": false,
1219
+ "special": false
1220
+ },
1221
+ "152": {
1222
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1223
+ "lstrip": false,
1224
+ "normalized": false,
1225
+ "rstrip": false,
1226
+ "single_word": false,
1227
+ "special": false
1228
+ },
1229
+ "153": {
1230
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1231
+ "lstrip": false,
1232
+ "normalized": false,
1233
+ "rstrip": false,
1234
+ "single_word": false,
1235
+ "special": false
1236
+ },
1237
+ "154": {
1238
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1239
+ "lstrip": false,
1240
+ "normalized": false,
1241
+ "rstrip": false,
1242
+ "single_word": false,
1243
+ "special": false
1244
+ },
1245
+ "155": {
1246
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1247
+ "lstrip": false,
1248
+ "normalized": false,
1249
+ "rstrip": false,
1250
+ "single_word": false,
1251
+ "special": false
1252
+ },
1253
+ "156": {
1254
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1255
+ "lstrip": false,
1256
+ "normalized": false,
1257
+ "rstrip": false,
1258
+ "single_word": false,
1259
+ "special": false
1260
+ },
1261
+ "157": {
1262
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1263
+ "lstrip": false,
1264
+ "normalized": false,
1265
+ "rstrip": false,
1266
+ "single_word": false,
1267
+ "special": false
1268
+ },
1269
+ "158": {
1270
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1271
+ "lstrip": false,
1272
+ "normalized": false,
1273
+ "rstrip": false,
1274
+ "single_word": false,
1275
+ "special": false
1276
+ },
1277
+ "159": {
1278
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1279
+ "lstrip": false,
1280
+ "normalized": false,
1281
+ "rstrip": false,
1282
+ "single_word": false,
1283
+ "special": false
1284
+ },
1285
+ "160": {
1286
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1287
+ "lstrip": false,
1288
+ "normalized": false,
1289
+ "rstrip": false,
1290
+ "single_word": false,
1291
+ "special": false
1292
+ },
1293
+ "161": {
1294
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1295
+ "lstrip": false,
1296
+ "normalized": false,
1297
+ "rstrip": false,
1298
+ "single_word": false,
1299
+ "special": false
1300
+ },
1301
+ "162": {
1302
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1303
+ "lstrip": false,
1304
+ "normalized": false,
1305
+ "rstrip": false,
1306
+ "single_word": false,
1307
+ "special": false
1308
+ },
1309
+ "163": {
1310
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1311
+ "lstrip": false,
1312
+ "normalized": false,
1313
+ "rstrip": false,
1314
+ "single_word": false,
1315
+ "special": false
1316
+ },
1317
+ "164": {
1318
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1319
+ "lstrip": false,
1320
+ "normalized": false,
1321
+ "rstrip": false,
1322
+ "single_word": false,
1323
+ "special": false
1324
+ },
1325
+ "165": {
1326
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1327
+ "lstrip": false,
1328
+ "normalized": false,
1329
+ "rstrip": false,
1330
+ "single_word": false,
1331
+ "special": false
1332
+ },
1333
+ "166": {
1334
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1335
+ "lstrip": false,
1336
+ "normalized": false,
1337
+ "rstrip": false,
1338
+ "single_word": false,
1339
+ "special": false
1340
+ },
1341
+ "167": {
1342
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1343
+ "lstrip": false,
1344
+ "normalized": false,
1345
+ "rstrip": false,
1346
+ "single_word": false,
1347
+ "special": false
1348
+ },
1349
+ "168": {
1350
+ "content": "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
1351
+ "lstrip": false,
1352
+ "normalized": false,
1353
+ "rstrip": false,
1354
+ "single_word": false,
1355
+ "special": false
1356
+ },
1357
+ "169": {
1358
+ "content": "<table>",
1359
+ "lstrip": false,
1360
+ "normalized": false,
1361
+ "rstrip": false,
1362
+ "single_word": false,
1363
+ "special": false
1364
+ },
1365
+ "170": {
1366
+ "content": "<caption>",
1367
+ "lstrip": false,
1368
+ "normalized": false,
1369
+ "rstrip": false,
1370
+ "single_word": false,
1371
+ "special": false
1372
+ },
1373
+ "171": {
1374
+ "content": "<thead>",
1375
+ "lstrip": false,
1376
+ "normalized": false,
1377
+ "rstrip": false,
1378
+ "single_word": false,
1379
+ "special": false
1380
+ },
1381
+ "172": {
1382
+ "content": "<tbody>",
1383
+ "lstrip": false,
1384
+ "normalized": false,
1385
+ "rstrip": false,
1386
+ "single_word": false,
1387
+ "special": false
1388
+ },
1389
+ "173": {
1390
+ "content": "<tfoot>",
1391
+ "lstrip": false,
1392
+ "normalized": false,
1393
+ "rstrip": false,
1394
+ "single_word": false,
1395
+ "special": false
1396
+ },
1397
+ "174": {
1398
+ "content": "<tr>",
1399
+ "lstrip": false,
1400
+ "normalized": false,
1401
+ "rstrip": false,
1402
+ "single_word": false,
1403
+ "special": false
1404
+ },
1405
+ "175": {
1406
+ "content": "<th>",
1407
+ "lstrip": false,
1408
+ "normalized": false,
1409
+ "rstrip": false,
1410
+ "single_word": false,
1411
+ "special": false
1412
+ },
1413
+ "176": {
1414
+ "content": "<td>",
1415
+ "lstrip": false,
1416
+ "normalized": false,
1417
+ "rstrip": false,
1418
+ "single_word": false,
1419
+ "special": false
1420
+ },
1421
+ "177": {
1422
+ "content": "</table>",
1423
+ "lstrip": false,
1424
+ "normalized": false,
1425
+ "rstrip": false,
1426
+ "single_word": false,
1427
+ "special": false
1428
+ },
1429
+ "178": {
1430
+ "content": "</caption>",
1431
+ "lstrip": false,
1432
+ "normalized": false,
1433
+ "rstrip": false,
1434
+ "single_word": false,
1435
+ "special": false
1436
+ },
1437
+ "179": {
1438
+ "content": "</thead>",
1439
+ "lstrip": false,
1440
+ "normalized": false,
1441
+ "rstrip": false,
1442
+ "single_word": false,
1443
+ "special": false
1444
+ },
1445
+ "180": {
1446
+ "content": "</tbody>",
1447
+ "lstrip": false,
1448
+ "normalized": false,
1449
+ "rstrip": false,
1450
+ "single_word": false,
1451
+ "special": false
1452
+ },
1453
+ "181": {
1454
+ "content": "</tfoot>",
1455
+ "lstrip": false,
1456
+ "normalized": false,
1457
+ "rstrip": false,
1458
+ "single_word": false,
1459
+ "special": false
1460
+ },
1461
+ "182": {
1462
+ "content": "</tr>",
1463
+ "lstrip": false,
1464
+ "normalized": false,
1465
+ "rstrip": false,
1466
+ "single_word": false,
1467
+ "special": false
1468
+ },
1469
+ "183": {
1470
+ "content": "</th>",
1471
+ "lstrip": false,
1472
+ "normalized": false,
1473
+ "rstrip": false,
1474
+ "single_word": false,
1475
+ "special": false
1476
+ },
1477
+ "184": {
1478
+ "content": "</td>",
1479
+ "lstrip": false,
1480
+ "normalized": false,
1481
+ "rstrip": false,
1482
+ "single_word": false,
1483
+ "special": false
1484
+ },
1485
+ "185": {
1486
+ "content": "<h1>",
1487
+ "lstrip": false,
1488
+ "normalized": false,
1489
+ "rstrip": false,
1490
+ "single_word": false,
1491
+ "special": false
1492
+ },
1493
+ "186": {
1494
+ "content": "<h2>",
1495
+ "lstrip": false,
1496
+ "normalized": false,
1497
+ "rstrip": false,
1498
+ "single_word": false,
1499
+ "special": false
1500
+ },
1501
+ "187": {
1502
+ "content": "<h3>",
1503
+ "lstrip": false,
1504
+ "normalized": false,
1505
+ "rstrip": false,
1506
+ "single_word": false,
1507
+ "special": false
1508
+ },
1509
+ "188": {
1510
+ "content": "<h4>",
1511
+ "lstrip": false,
1512
+ "normalized": false,
1513
+ "rstrip": false,
1514
+ "single_word": false,
1515
+ "special": false
1516
+ },
1517
+ "189": {
1518
+ "content": "<h5>",
1519
+ "lstrip": false,
1520
+ "normalized": false,
1521
+ "rstrip": false,
1522
+ "single_word": false,
1523
+ "special": false
1524
+ },
1525
+ "190": {
1526
+ "content": "<h6>",
1527
+ "lstrip": false,
1528
+ "normalized": false,
1529
+ "rstrip": false,
1530
+ "single_word": false,
1531
+ "special": false
1532
+ },
1533
+ "191": {
1534
+ "content": "<blockquote>",
1535
+ "lstrip": false,
1536
+ "normalized": false,
1537
+ "rstrip": false,
1538
+ "single_word": false,
1539
+ "special": false
1540
+ },
1541
+ "192": {
1542
+ "content": "</h1>",
1543
+ "lstrip": false,
1544
+ "normalized": false,
1545
+ "rstrip": false,
1546
+ "single_word": false,
1547
+ "special": false
1548
+ },
1549
+ "193": {
1550
+ "content": "</h2>",
1551
+ "lstrip": false,
1552
+ "normalized": false,
1553
+ "rstrip": false,
1554
+ "single_word": false,
1555
+ "special": false
1556
+ },
1557
+ "194": {
1558
+ "content": "</h3>",
1559
+ "lstrip": false,
1560
+ "normalized": false,
1561
+ "rstrip": false,
1562
+ "single_word": false,
1563
+ "special": false
1564
+ },
1565
+ "195": {
1566
+ "content": "</h4>",
1567
+ "lstrip": false,
1568
+ "normalized": false,
1569
+ "rstrip": false,
1570
+ "single_word": false,
1571
+ "special": false
1572
+ },
1573
+ "196": {
1574
+ "content": "</h5>",
1575
+ "lstrip": false,
1576
+ "normalized": false,
1577
+ "rstrip": false,
1578
+ "single_word": false,
1579
+ "special": false
1580
+ },
1581
+ "197": {
1582
+ "content": "</h6>",
1583
+ "lstrip": false,
1584
+ "normalized": false,
1585
+ "rstrip": false,
1586
+ "single_word": false,
1587
+ "special": false
1588
+ },
1589
+ "198": {
1590
+ "content": "</blockquote>",
1591
+ "lstrip": false,
1592
+ "normalized": false,
1593
+ "rstrip": false,
1594
+ "single_word": false,
1595
+ "special": false
1596
+ },
1597
+ "199": {
1598
+ "content": "<strong>",
1599
+ "lstrip": false,
1600
+ "normalized": false,
1601
+ "rstrip": false,
1602
+ "single_word": false,
1603
+ "special": false
1604
+ },
1605
+ "200": {
1606
+ "content": "<em>",
1607
+ "lstrip": false,
1608
+ "normalized": false,
1609
+ "rstrip": false,
1610
+ "single_word": false,
1611
+ "special": false
1612
+ },
1613
+ "201": {
1614
+ "content": "<b>",
1615
+ "lstrip": false,
1616
+ "normalized": false,
1617
+ "rstrip": false,
1618
+ "single_word": false,
1619
+ "special": false
1620
+ },
1621
+ "202": {
1622
+ "content": "<i>",
1623
+ "lstrip": false,
1624
+ "normalized": false,
1625
+ "rstrip": false,
1626
+ "single_word": false,
1627
+ "special": false
1628
+ },
1629
+ "203": {
1630
+ "content": "<u>",
1631
+ "lstrip": false,
1632
+ "normalized": false,
1633
+ "rstrip": false,
1634
+ "single_word": false,
1635
+ "special": false
1636
+ },
1637
+ "204": {
1638
+ "content": "<s>",
1639
+ "lstrip": false,
1640
+ "normalized": false,
1641
+ "rstrip": false,
1642
+ "single_word": false,
1643
+ "special": false
1644
+ },
1645
+ "205": {
1646
+ "content": "<sub>",
1647
+ "lstrip": false,
1648
+ "normalized": false,
1649
+ "rstrip": false,
1650
+ "single_word": false,
1651
+ "special": false
1652
+ },
1653
+ "206": {
1654
+ "content": "<sup>",
1655
+ "lstrip": false,
1656
+ "normalized": false,
1657
+ "rstrip": false,
1658
+ "single_word": false,
1659
+ "special": false
1660
+ },
1661
+ "207": {
1662
+ "content": "<code>",
1663
+ "lstrip": false,
1664
+ "normalized": false,
1665
+ "rstrip": false,
1666
+ "single_word": false,
1667
+ "special": false
1668
+ },
1669
+ "208": {
1670
+ "content": "</strong>",
1671
+ "lstrip": false,
1672
+ "normalized": false,
1673
+ "rstrip": false,
1674
+ "single_word": false,
1675
+ "special": false
1676
+ },
1677
+ "209": {
1678
+ "content": "</em>",
1679
+ "lstrip": false,
1680
+ "normalized": false,
1681
+ "rstrip": false,
1682
+ "single_word": false,
1683
+ "special": false
1684
+ },
1685
+ "210": {
1686
+ "content": "</b>",
1687
+ "lstrip": false,
1688
+ "normalized": false,
1689
+ "rstrip": false,
1690
+ "single_word": false,
1691
+ "special": false
1692
+ },
1693
+ "211": {
1694
+ "content": "</i>",
1695
+ "lstrip": false,
1696
+ "normalized": false,
1697
+ "rstrip": false,
1698
+ "single_word": false,
1699
+ "special": false
1700
+ },
1701
+ "212": {
1702
+ "content": "</u>",
1703
+ "lstrip": false,
1704
+ "normalized": false,
1705
+ "rstrip": false,
1706
+ "single_word": false,
1707
+ "special": false
1708
+ },
1709
+ "213": {
1710
+ "content": "</s>",
1711
+ "lstrip": false,
1712
+ "normalized": false,
1713
+ "rstrip": false,
1714
+ "single_word": false,
1715
+ "special": false
1716
+ },
1717
+ "214": {
1718
+ "content": "</sub>",
1719
+ "lstrip": false,
1720
+ "normalized": false,
1721
+ "rstrip": false,
1722
+ "single_word": false,
1723
+ "special": false
1724
+ },
1725
+ "215": {
1726
+ "content": "</sup>",
1727
+ "lstrip": false,
1728
+ "normalized": false,
1729
+ "rstrip": false,
1730
+ "single_word": false,
1731
+ "special": false
1732
+ },
1733
+ "216": {
1734
+ "content": "</code>",
1735
+ "lstrip": false,
1736
+ "normalized": false,
1737
+ "rstrip": false,
1738
+ "single_word": false,
1739
+ "special": false
1740
+ },
1741
+ "255968": {
1742
+ "content": "[toxicity=0]",
1743
+ "lstrip": false,
1744
+ "normalized": false,
1745
+ "rstrip": false,
1746
+ "single_word": false,
1747
+ "special": false
1748
+ },
1749
+ "255969": {
1750
+ "content": "\t\t",
1751
+ "lstrip": false,
1752
+ "normalized": false,
1753
+ "rstrip": false,
1754
+ "single_word": false,
1755
+ "special": false
1756
+ },
1757
+ "255970": {
1758
+ "content": "\t\t\t",
1759
+ "lstrip": false,
1760
+ "normalized": false,
1761
+ "rstrip": false,
1762
+ "single_word": false,
1763
+ "special": false
1764
+ },
1765
+ "255971": {
1766
+ "content": "\t\t\t\t",
1767
+ "lstrip": false,
1768
+ "normalized": false,
1769
+ "rstrip": false,
1770
+ "single_word": false,
1771
+ "special": false
1772
+ },
1773
+ "255972": {
1774
+ "content": "\t\t\t\t\t",
1775
+ "lstrip": false,
1776
+ "normalized": false,
1777
+ "rstrip": false,
1778
+ "single_word": false,
1779
+ "special": false
1780
+ },
1781
+ "255973": {
1782
+ "content": "\t\t\t\t\t\t",
1783
+ "lstrip": false,
1784
+ "normalized": false,
1785
+ "rstrip": false,
1786
+ "single_word": false,
1787
+ "special": false
1788
+ },
1789
+ "255974": {
1790
+ "content": "\t\t\t\t\t\t\t",
1791
+ "lstrip": false,
1792
+ "normalized": false,
1793
+ "rstrip": false,
1794
+ "single_word": false,
1795
+ "special": false
1796
+ },
1797
+ "255975": {
1798
+ "content": "\t\t\t\t\t\t\t\t",
1799
+ "lstrip": false,
1800
+ "normalized": false,
1801
+ "rstrip": false,
1802
+ "single_word": false,
1803
+ "special": false
1804
+ },
1805
+ "255976": {
1806
+ "content": "\t\t\t\t\t\t\t\t\t",
1807
+ "lstrip": false,
1808
+ "normalized": false,
1809
+ "rstrip": false,
1810
+ "single_word": false,
1811
+ "special": false
1812
+ },
1813
+ "255977": {
1814
+ "content": "\t\t\t\t\t\t\t\t\t\t",
1815
+ "lstrip": false,
1816
+ "normalized": false,
1817
+ "rstrip": false,
1818
+ "single_word": false,
1819
+ "special": false
1820
+ },
1821
+ "255978": {
1822
+ "content": "\t\t\t\t\t\t\t\t\t\t\t",
1823
+ "lstrip": false,
1824
+ "normalized": false,
1825
+ "rstrip": false,
1826
+ "single_word": false,
1827
+ "special": false
1828
+ },
1829
+ "255979": {
1830
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t",
1831
+ "lstrip": false,
1832
+ "normalized": false,
1833
+ "rstrip": false,
1834
+ "single_word": false,
1835
+ "special": false
1836
+ },
1837
+ "255980": {
1838
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t",
1839
+ "lstrip": false,
1840
+ "normalized": false,
1841
+ "rstrip": false,
1842
+ "single_word": false,
1843
+ "special": false
1844
+ },
1845
+ "255981": {
1846
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1847
+ "lstrip": false,
1848
+ "normalized": false,
1849
+ "rstrip": false,
1850
+ "single_word": false,
1851
+ "special": false
1852
+ },
1853
+ "255982": {
1854
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1855
+ "lstrip": false,
1856
+ "normalized": false,
1857
+ "rstrip": false,
1858
+ "single_word": false,
1859
+ "special": false
1860
+ },
1861
+ "255983": {
1862
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1863
+ "lstrip": false,
1864
+ "normalized": false,
1865
+ "rstrip": false,
1866
+ "single_word": false,
1867
+ "special": false
1868
+ },
1869
+ "255984": {
1870
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1871
+ "lstrip": false,
1872
+ "normalized": false,
1873
+ "rstrip": false,
1874
+ "single_word": false,
1875
+ "special": false
1876
+ },
1877
+ "255985": {
1878
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1879
+ "lstrip": false,
1880
+ "normalized": false,
1881
+ "rstrip": false,
1882
+ "single_word": false,
1883
+ "special": false
1884
+ },
1885
+ "255986": {
1886
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1887
+ "lstrip": false,
1888
+ "normalized": false,
1889
+ "rstrip": false,
1890
+ "single_word": false,
1891
+ "special": false
1892
+ },
1893
+ "255987": {
1894
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1895
+ "lstrip": false,
1896
+ "normalized": false,
1897
+ "rstrip": false,
1898
+ "single_word": false,
1899
+ "special": false
1900
+ },
1901
+ "255988": {
1902
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1903
+ "lstrip": false,
1904
+ "normalized": false,
1905
+ "rstrip": false,
1906
+ "single_word": false,
1907
+ "special": false
1908
+ },
1909
+ "255989": {
1910
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1911
+ "lstrip": false,
1912
+ "normalized": false,
1913
+ "rstrip": false,
1914
+ "single_word": false,
1915
+ "special": false
1916
+ },
1917
+ "255990": {
1918
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1919
+ "lstrip": false,
1920
+ "normalized": false,
1921
+ "rstrip": false,
1922
+ "single_word": false,
1923
+ "special": false
1924
+ },
1925
+ "255991": {
1926
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1927
+ "lstrip": false,
1928
+ "normalized": false,
1929
+ "rstrip": false,
1930
+ "single_word": false,
1931
+ "special": false
1932
+ },
1933
+ "255992": {
1934
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1935
+ "lstrip": false,
1936
+ "normalized": false,
1937
+ "rstrip": false,
1938
+ "single_word": false,
1939
+ "special": false
1940
+ },
1941
+ "255993": {
1942
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1943
+ "lstrip": false,
1944
+ "normalized": false,
1945
+ "rstrip": false,
1946
+ "single_word": false,
1947
+ "special": false
1948
+ },
1949
+ "255994": {
1950
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1951
+ "lstrip": false,
1952
+ "normalized": false,
1953
+ "rstrip": false,
1954
+ "single_word": false,
1955
+ "special": false
1956
+ },
1957
+ "255995": {
1958
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1959
+ "lstrip": false,
1960
+ "normalized": false,
1961
+ "rstrip": false,
1962
+ "single_word": false,
1963
+ "special": false
1964
+ },
1965
+ "255996": {
1966
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1967
+ "lstrip": false,
1968
+ "normalized": false,
1969
+ "rstrip": false,
1970
+ "single_word": false,
1971
+ "special": false
1972
+ },
1973
+ "255997": {
1974
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1975
+ "lstrip": false,
1976
+ "normalized": false,
1977
+ "rstrip": false,
1978
+ "single_word": false,
1979
+ "special": false
1980
+ },
1981
+ "255998": {
1982
+ "content": "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
1983
+ "lstrip": false,
1984
+ "normalized": false,
1985
+ "rstrip": false,
1986
+ "single_word": false,
1987
+ "special": false
1988
+ },
1989
+ "255999": {
1990
+ "content": "<unused99>",
1991
+ "lstrip": false,
1992
+ "normalized": false,
1993
+ "rstrip": false,
1994
+ "single_word": false,
1995
+ "special": false
1996
+ }
1997
+ },
1998
+ "additional_special_tokens": [
1999
+ "<start_of_turn>",
2000
+ "<end_of_turn>"
2001
+ ],
2002
+ "bos_token": "<bos>",
2003
+ "chat_template": "{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}",
2004
+ "clean_up_tokenization_spaces": false,
2005
+ "eos_token": "<eos>",
2006
+ "model_max_length": 1000000000000000019884624838656,
2007
+ "pad_token": "<pad>",
2008
+ "sp_model_kwargs": {},
2009
+ "spaces_between_special_tokens": false,
2010
+ "tokenizer_class": "GemmaTokenizer",
2011
+ "unk_token": "<unk>",
2012
+ "use_default_system_prompt": false
2013
+ }