reflectio commited on
Commit
5c94dfa
1 Parent(s): a42727d

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "original_models/gemma-2b",
3
+ "architectures": [
4
+ "GemmaForCausalLM"
5
+ ],
6
+ "auto_map": {
7
+ "AutoModelForCausalLM": "modeling_offload_gemma.GemmaforCausalLM"
8
+ },
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "bos_token_id": 2,
12
+ "eos_token_id": 1,
13
+ "head_dim": 256,
14
+ "hidden_act": "gelu",
15
+ "hidden_activation": "gelu_pytorch_tanh",
16
+ "hidden_size": 2048,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 16384,
19
+ "max_position_embeddings": 8192,
20
+ "model_type": "gemma",
21
+ "num_attention_heads": 8,
22
+ "num_hidden_layers": 18,
23
+ "num_key_value_heads": 1,
24
+ "pad_token_id": 0,
25
+ "rms_norm_eps": 1e-06,
26
+ "rope_scaling": null,
27
+ "rope_theta": 10000.0,
28
+ "torch_dtype": "bfloat16",
29
+ "transformers_version": "4.41.2",
30
+ "use_cache": true,
31
+ "vocab_size": 256000
32
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.41.2"
7
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28313e4f41d562d47d11611da72aaa3ae762fb7e7bbdf6ad7c1d2af388a5bbce
3
+ size 4945242264
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac3802c1097c8b9edca76d2ad337cc0d22134477a40f110587bebc34e630fc6d
3
+ size 67121608
model.safetensors.index.json ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 5012344832
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
7
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
16
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
18
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
28
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
40
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
42
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
52
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
54
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
64
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
66
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
68
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
70
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
74
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
76
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
78
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
86
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
88
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00002.safetensors",
89
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
90
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
92
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
93
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
96
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
97
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
98
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
100
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
102
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
104
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
106
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
108
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
109
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
111
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
112
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
114
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
116
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
118
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
120
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
121
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
122
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
124
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
126
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
127
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
128
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
129
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
130
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
131
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
132
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
133
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
134
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
135
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
136
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
137
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
138
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
139
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
140
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
141
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
142
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
143
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
144
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
145
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
146
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
147
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
148
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
149
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
150
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
151
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
152
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
153
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
154
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
155
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
156
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
157
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
158
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
159
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
160
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
161
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
162
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
163
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
164
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
165
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
166
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
167
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
168
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
169
+ "model.norm.weight": "model-00002-of-00002.safetensors"
170
+ }
171
+ }
modeling_offload_gemma.py ADDED
@@ -0,0 +1,1368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 Google Inc. HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """ PyTorch Gemma model."""
17
+
18
+ import math
19
+ from typing import List, Optional, Tuple, Union
20
+
21
+ import torch
22
+ import torch.nn.functional as F
23
+ import torch.utils.checkpoint
24
+ from torch import nn
25
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
26
+
27
+ from transformers.activations import ACT2FN
28
+ from transformers.cache_utils import Cache, DynamicCache, StaticCache
29
+ from transformers.modeling_attn_mask_utils import (
30
+ AttentionMaskConverter,
31
+ _prepare_4d_causal_attention_mask,
32
+ )
33
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
34
+ from transformers.modeling_utils import PreTrainedModel
35
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13
36
+ from transformers.utils import (
37
+ add_start_docstrings,
38
+ add_start_docstrings_to_model_forward,
39
+ is_flash_attn_2_available,
40
+ is_flash_attn_greater_or_equal_2_10,
41
+ logging,
42
+ replace_return_docstrings,
43
+ )
44
+ from transformers.utils.import_utils import is_torch_fx_available
45
+ from transformers.models.gemma.configuration_gemma import GemmaConfig
46
+
47
+
48
+ if is_flash_attn_2_available():
49
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
50
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
51
+
52
+
53
+ # This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
54
+ # It means that the function will not be traced through and simply appear as a node in the graph.
55
+ if is_torch_fx_available():
56
+ if not is_torch_greater_or_equal_than_1_13:
57
+ import torch.fx
58
+
59
+ _prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
60
+
61
+
62
+ logger = logging.get_logger(__name__)
63
+
64
+ _CONFIG_FOR_DOC = "GemmaConfig"
65
+
66
+
67
+ def _get_unpad_data(attention_mask):
68
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
69
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
70
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
71
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
72
+ return (
73
+ indices,
74
+ cu_seqlens,
75
+ max_seqlen_in_batch,
76
+ )
77
+
78
+
79
+ class GemmaRMSNorm(nn.Module):
80
+ def __init__(self, dim: int, eps: float = 1e-6):
81
+ super().__init__()
82
+ self.eps = eps
83
+ self.weight = nn.Parameter(torch.zeros(dim))
84
+
85
+ def _norm(self, x):
86
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
87
+
88
+ def forward(self, x):
89
+ output = self._norm(x.float())
90
+ # Llama does x.to(float16) * w whilst Gemma is (x * w).to(float16)
91
+ # See https://github.com/huggingface/transformers/pull/29402
92
+ output = output * (1.0 + self.weight.float())
93
+ return output.type_as(x)
94
+
95
+
96
+ ALL_LAYERNORM_LAYERS.append(GemmaRMSNorm)
97
+
98
+
99
+ class GemmaRotaryEmbedding(nn.Module):
100
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
101
+ super().__init__()
102
+
103
+ self.dim = dim
104
+ self.max_position_embeddings = max_position_embeddings
105
+ self.base = base
106
+
107
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64).float() / self.dim))
108
+ self.register_buffer("inv_freq", tensor=inv_freq, persistent=False)
109
+
110
+ @torch.no_grad()
111
+ def forward(self, x, position_ids, seq_len=None):
112
+ # x: [bs, num_attention_heads, seq_len, head_size]
113
+ self.inv_freq.to(x.device)
114
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
115
+ position_ids_expanded = position_ids[:, None, :].float()
116
+ # Force float32 since bfloat16 loses precision on long contexts
117
+ # See https://github.com/huggingface/transformers/pull/29285
118
+ device_type = x.device.type
119
+ device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
120
+ with torch.autocast(device_type=device_type, enabled=False):
121
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
122
+ emb = torch.cat((freqs, freqs), dim=-1)
123
+ cos = emb.cos()
124
+ sin = emb.sin()
125
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
126
+
127
+
128
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
129
+ def rotate_half(x):
130
+ """Rotates half the hidden dims of the input."""
131
+ x1 = x[..., : x.shape[-1] // 2]
132
+ x2 = x[..., x.shape[-1] // 2 :]
133
+ return torch.cat((-x2, x1), dim=-1)
134
+
135
+
136
+ # Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
137
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
138
+ """Applies Rotary Position Embedding to the query and key tensors.
139
+
140
+ Args:
141
+ q (`torch.Tensor`): The query tensor.
142
+ k (`torch.Tensor`): The key tensor.
143
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
144
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
145
+ position_ids (`torch.Tensor`, *optional*):
146
+ Deprecated and unused.
147
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
148
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
149
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
150
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
151
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
152
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
153
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
154
+ Returns:
155
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
156
+ """
157
+ cos = cos.unsqueeze(unsqueeze_dim)
158
+ sin = sin.unsqueeze(unsqueeze_dim)
159
+ q_embed = (q * cos) + (rotate_half(q) * sin)
160
+ k_embed = (k * cos) + (rotate_half(k) * sin)
161
+ return q_embed, k_embed
162
+
163
+
164
+ class GemmaMLP(nn.Module):
165
+ def __init__(self, config):
166
+ super().__init__()
167
+ self.config = config
168
+ self.hidden_size = config.hidden_size
169
+ self.intermediate_size = config.intermediate_size
170
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
171
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
172
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
173
+ if config.hidden_activation is None:
174
+ logger.warning_once(
175
+ "`config.hidden_act` is ignored, you should use `config.hidden_activation` instead.\n"
176
+ "Gemma's activation function will be set to `gelu_pytorch_tanh`. Please, use\n"
177
+ "`config.hidden_activation` if you want to override this behaviour.\n"
178
+ "See https://github.com/huggingface/transformers/pull/29402 for more details."
179
+ )
180
+ config.hidden_activation = "gelu_pytorch_tanh"
181
+ hidden_activation = config.hidden_activation
182
+ self.act_fn = ACT2FN[hidden_activation]
183
+
184
+ def forward(self, x):
185
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
186
+
187
+
188
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv
189
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
190
+ """
191
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
192
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
193
+ """
194
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
195
+ if n_rep == 1:
196
+ return hidden_states
197
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
198
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
199
+
200
+
201
+ class GemmaAttention(nn.Module):
202
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
203
+
204
+ # Ignore copy
205
+ def __init__(self, config: GemmaConfig, layer_idx: Optional[int] = None):
206
+ super().__init__()
207
+ self.config = config
208
+ self.layer_idx = layer_idx
209
+ if layer_idx is None:
210
+ logger.warning_once(
211
+ f"Instantiating {self.__class__.__name__} without passing a `layer_idx` is not recommended and will "
212
+ "lead to errors during the forward call if caching is used. Please make sure to provide a `layer_idx` "
213
+ "when creating this class."
214
+ )
215
+
216
+ self.attention_dropout = config.attention_dropout
217
+ self.hidden_size = config.hidden_size
218
+ self.num_heads = config.num_attention_heads
219
+ self.head_dim = config.head_dim
220
+ self.num_key_value_heads = config.num_key_value_heads
221
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
222
+ self.max_position_embeddings = config.max_position_embeddings
223
+ self.rope_theta = config.rope_theta
224
+ self.is_causal = True
225
+
226
+ if self.hidden_size % self.num_heads != 0:
227
+ raise ValueError(
228
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
229
+ f" and `num_heads`: {self.num_heads})."
230
+ )
231
+
232
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
233
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
234
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
235
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
236
+ self.rotary_emb = GemmaRotaryEmbedding(
237
+ self.head_dim,
238
+ max_position_embeddings=self.max_position_embeddings,
239
+ base=self.rope_theta,
240
+ )
241
+
242
+ def forward(
243
+ self,
244
+ hidden_states: torch.Tensor,
245
+ attention_mask: Optional[torch.Tensor] = None,
246
+ position_ids: Optional[torch.LongTensor] = None,
247
+ past_key_value: Optional[Cache] = None,
248
+ output_attentions: bool = False,
249
+ use_cache: bool = False,
250
+ cache_position: Optional[torch.LongTensor] = None,
251
+ **kwargs,
252
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
253
+ bsz, q_len, _ = hidden_states.size()
254
+
255
+ query_states = self.q_proj(hidden_states)
256
+ key_states = self.k_proj(hidden_states)
257
+ value_states = self.v_proj(hidden_states)
258
+
259
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
260
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
261
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
262
+
263
+ cos, sin = self.rotary_emb(value_states, position_ids, seq_len=None)
264
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, None)
265
+
266
+ if past_key_value is not None:
267
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
268
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
269
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
270
+
271
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
272
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
273
+
274
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
275
+
276
+ if attention_mask is not None: # no matter the length, we just slice it
277
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
278
+ attn_weights = attn_weights + causal_mask
279
+
280
+ # upcast attention to fp32
281
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
282
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
283
+ attn_output = torch.matmul(attn_weights, value_states)
284
+
285
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
286
+ raise ValueError(
287
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
288
+ f" {attn_output.size()}"
289
+ )
290
+
291
+ attn_output = attn_output.transpose(1, 2).contiguous()
292
+
293
+ attn_output = attn_output.view(bsz, q_len, -1)
294
+ attn_output = self.o_proj(attn_output)
295
+
296
+ if not output_attentions:
297
+ attn_weights = None
298
+
299
+ return attn_output, attn_weights, past_key_value
300
+
301
+
302
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2 with Llama->Gemma
303
+ class GemmaFlashAttention2(GemmaAttention):
304
+ """
305
+ Gemma flash attention module. This module inherits from `GemmaAttention` as the weights of the module stays
306
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
307
+ flash attention and deal with padding tokens in case the input contains any of them.
308
+ """
309
+
310
+ def __init__(self, *args, **kwargs):
311
+ super().__init__(*args, **kwargs)
312
+
313
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
314
+ # 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.
315
+ # 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).
316
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
317
+
318
+ # Ignore copy
319
+ def forward(
320
+ self,
321
+ hidden_states: torch.Tensor,
322
+ attention_mask: Optional[torch.LongTensor] = None,
323
+ position_ids: Optional[torch.LongTensor] = None,
324
+ past_key_value: Optional[Cache] = None,
325
+ output_attentions: bool = False,
326
+ use_cache: bool = False,
327
+ cache_position: Optional[torch.LongTensor] = None,
328
+ **kwargs,
329
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
330
+ if isinstance(past_key_value, StaticCache):
331
+ raise ValueError(
332
+ "`static` cache implementation is not compatible with `attn_implementation==flash_attention_2` "
333
+ "make sure to use `sdpa` in the mean time, and open an issue at https://github.com/huggingface/transformers"
334
+ )
335
+ output_attentions = False
336
+
337
+ bsz, q_len, _ = hidden_states.size()
338
+
339
+ query_states = self.q_proj(hidden_states)
340
+ key_states = self.k_proj(hidden_states)
341
+ value_states = self.v_proj(hidden_states)
342
+
343
+ # Flash attention requires the input to have the shape
344
+ # batch_size x seq_length x head_dim x hidden_dim
345
+ # therefore we just need to keep the original shape
346
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
347
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
348
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
349
+
350
+ cos, sin = self.rotary_emb(value_states, position_ids, seq_len=None)
351
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, None)
352
+
353
+ if past_key_value is not None:
354
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
355
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
356
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
357
+
358
+ # 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
359
+ # to be able to avoid many of these transpose/reshape/view.
360
+ query_states = query_states.transpose(1, 2)
361
+ key_states = key_states.transpose(1, 2)
362
+ value_states = value_states.transpose(1, 2)
363
+
364
+ dropout_rate = self.attention_dropout if self.training else 0.0
365
+
366
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
367
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
368
+ # cast them back in the correct dtype just to be sure everything works as expected.
369
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
370
+ # in fp32. (GemmaRMSNorm handles it correctly)
371
+
372
+ input_dtype = query_states.dtype
373
+ if input_dtype == torch.float32:
374
+ if torch.is_autocast_enabled():
375
+ target_dtype = torch.get_autocast_gpu_dtype()
376
+ # Handle the case where the model is quantized
377
+ elif hasattr(self.config, "_pre_quantization_dtype"):
378
+ target_dtype = self.config._pre_quantization_dtype
379
+ else:
380
+ target_dtype = self.q_proj.weight.dtype
381
+
382
+ logger.warning_once(
383
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
384
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
385
+ f" {target_dtype}."
386
+ )
387
+
388
+ query_states = query_states.to(target_dtype)
389
+ key_states = key_states.to(target_dtype)
390
+ value_states = value_states.to(target_dtype)
391
+
392
+ attn_output = self._flash_attention_forward(
393
+ query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
394
+ )
395
+
396
+ attn_output = attn_output.reshape(bsz, q_len, -1).contiguous()
397
+ attn_output = self.o_proj(attn_output)
398
+
399
+ if not output_attentions:
400
+ attn_weights = None
401
+
402
+ return attn_output, attn_weights, past_key_value
403
+
404
+ def _flash_attention_forward(
405
+ self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
406
+ ):
407
+ """
408
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
409
+ first unpad the input, then computes the attention scores and pad the final attention scores.
410
+
411
+ Args:
412
+ query_states (`torch.Tensor`):
413
+ Input query states to be passed to Flash Attention API
414
+ key_states (`torch.Tensor`):
415
+ Input key states to be passed to Flash Attention API
416
+ value_states (`torch.Tensor`):
417
+ Input value states to be passed to Flash Attention API
418
+ attention_mask (`torch.Tensor`):
419
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
420
+ position of padding tokens and 1 for the position of non-padding tokens.
421
+ dropout (`float`):
422
+ Attention dropout
423
+ softmax_scale (`float`, *optional*):
424
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
425
+ """
426
+ if not self._flash_attn_uses_top_left_mask:
427
+ causal = self.is_causal
428
+ else:
429
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in GemmaFlashAttention2 __init__.
430
+ causal = self.is_causal and query_length != 1
431
+
432
+ # Contains at least one padding token in the sequence
433
+ if attention_mask is not None:
434
+ batch_size = query_states.shape[0]
435
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
436
+ query_states, key_states, value_states, attention_mask, query_length
437
+ )
438
+
439
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
440
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
441
+
442
+ attn_output_unpad = flash_attn_varlen_func(
443
+ query_states,
444
+ key_states,
445
+ value_states,
446
+ cu_seqlens_q=cu_seqlens_q,
447
+ cu_seqlens_k=cu_seqlens_k,
448
+ max_seqlen_q=max_seqlen_in_batch_q,
449
+ max_seqlen_k=max_seqlen_in_batch_k,
450
+ dropout_p=dropout,
451
+ softmax_scale=softmax_scale,
452
+ causal=causal,
453
+ )
454
+
455
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
456
+ else:
457
+ attn_output = flash_attn_func(
458
+ query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
459
+ )
460
+
461
+ return attn_output
462
+
463
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
464
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
465
+ batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
466
+
467
+ key_layer = index_first_axis(
468
+ key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
469
+ )
470
+ value_layer = index_first_axis(
471
+ value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
472
+ )
473
+ if query_length == kv_seq_len:
474
+ query_layer = index_first_axis(
475
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
476
+ )
477
+ cu_seqlens_q = cu_seqlens_k
478
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
479
+ indices_q = indices_k
480
+ elif query_length == 1:
481
+ max_seqlen_in_batch_q = 1
482
+ cu_seqlens_q = torch.arange(
483
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
484
+ ) # There is a memcpy here, that is very bad.
485
+ indices_q = cu_seqlens_q[:-1]
486
+ query_layer = query_layer.squeeze(1)
487
+ else:
488
+ # The -q_len: slice assumes left padding.
489
+ attention_mask = attention_mask[:, -query_length:]
490
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
491
+
492
+ return (
493
+ query_layer,
494
+ key_layer,
495
+ value_layer,
496
+ indices_q,
497
+ (cu_seqlens_q, cu_seqlens_k),
498
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
499
+ )
500
+
501
+
502
+ # Copied from transformers.models.llama.modeling_llama.LlamaSdpaAttention with Llama->Gemma
503
+ class GemmaSdpaAttention(GemmaAttention):
504
+ """
505
+ Gemma attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
506
+ `GemmaAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
507
+ SDPA API.
508
+ """
509
+
510
+ # Ignore copy
511
+ def forward(
512
+ self,
513
+ hidden_states: torch.Tensor,
514
+ attention_mask: Optional[torch.Tensor] = None,
515
+ position_ids: Optional[torch.LongTensor] = None,
516
+ past_key_value: Optional[Cache] = None,
517
+ output_attentions: bool = False,
518
+ use_cache: bool = False,
519
+ cache_position: Optional[torch.LongTensor] = None,
520
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
521
+ if output_attentions:
522
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
523
+ logger.warning_once(
524
+ "GemmaModel is using GemmaSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
525
+ '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.'
526
+ )
527
+ return super().forward(
528
+ hidden_states=hidden_states,
529
+ attention_mask=attention_mask,
530
+ position_ids=position_ids,
531
+ past_key_value=past_key_value,
532
+ output_attentions=output_attentions,
533
+ use_cache=use_cache,
534
+ cache_position=cache_position,
535
+ )
536
+
537
+ bsz, q_len, _ = hidden_states.size()
538
+
539
+ query_states = self.q_proj(hidden_states)
540
+ key_states = self.k_proj(hidden_states)
541
+ value_states = self.v_proj(hidden_states)
542
+
543
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
544
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
545
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
546
+
547
+ cos, sin = self.rotary_emb(value_states, position_ids, seq_len=None)
548
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, None)
549
+
550
+ if past_key_value is not None:
551
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
552
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
553
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
554
+
555
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
556
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
557
+
558
+ causal_mask = attention_mask
559
+ if attention_mask is not None:
560
+ causal_mask = causal_mask[:, :, :, : key_states.shape[-2]]
561
+
562
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
563
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
564
+ if query_states.device.type == "cuda" and causal_mask is not None:
565
+ query_states = query_states.contiguous()
566
+ key_states = key_states.contiguous()
567
+ value_states = value_states.contiguous()
568
+
569
+ # We dispatch to SDPA's Flash Attention or Efficient kernels via this if statement instead of an
570
+ # inline conditional assignment to support both torch.compile's `dynamic=True` and `fullgraph=True`
571
+ is_causal = True if causal_mask is None and q_len > 1 else False
572
+
573
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
574
+ query_states,
575
+ key_states,
576
+ value_states,
577
+ attn_mask=causal_mask,
578
+ dropout_p=self.attention_dropout if self.training else 0.0,
579
+ is_causal=is_causal,
580
+ )
581
+
582
+ attn_output = attn_output.transpose(1, 2).contiguous()
583
+ attn_output = attn_output.view(bsz, q_len, -1)
584
+
585
+ attn_output = self.o_proj(attn_output)
586
+
587
+ return attn_output, None, past_key_value
588
+
589
+
590
+ GEMMA_ATTENTION_CLASSES = {
591
+ "eager": GemmaAttention,
592
+ "flash_attention_2": GemmaFlashAttention2,
593
+ "sdpa": GemmaSdpaAttention,
594
+ }
595
+
596
+
597
+ # Copied from transformers.models.llama.modeling_llama.LlamaDecoderLayer with LLAMA->GEMMA,Llama->Gemma
598
+ class GemmaDecoderLayer(nn.Module):
599
+ def __init__(self, config: GemmaConfig, layer_idx: int):
600
+ super().__init__()
601
+ self.hidden_size = config.hidden_size
602
+
603
+ self.self_attn = GEMMA_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx)
604
+
605
+ self.mlp = GemmaMLP(config)
606
+ self.input_layernorm = GemmaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
607
+ self.post_attention_layernorm = GemmaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
608
+
609
+ def forward(
610
+ self,
611
+ hidden_states: torch.Tensor,
612
+ attention_mask: Optional[torch.Tensor] = None,
613
+ position_ids: Optional[torch.LongTensor] = None,
614
+ past_key_value: Optional[Cache] = None,
615
+ output_attentions: Optional[bool] = False,
616
+ use_cache: Optional[bool] = False,
617
+ cache_position: Optional[torch.LongTensor] = None,
618
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
619
+ """
620
+ Args:
621
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
622
+ attention_mask (`torch.FloatTensor`, *optional*):
623
+ attention mask of size `(batch_size, sequence_length)` if flash attention is used or `(batch_size, 1,
624
+ query_sequence_length, key_sequence_length)` if default attention is used.
625
+ output_attentions (`bool`, *optional*):
626
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
627
+ returned tensors for more detail.
628
+ use_cache (`bool`, *optional*):
629
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
630
+ (see `past_key_values`).
631
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
632
+ """
633
+ residual = hidden_states
634
+
635
+ hidden_states = self.input_layernorm(hidden_states)
636
+
637
+ # Self Attention
638
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
639
+ hidden_states=hidden_states,
640
+ attention_mask=attention_mask,
641
+ position_ids=position_ids,
642
+ past_key_value=past_key_value,
643
+ output_attentions=output_attentions,
644
+ use_cache=use_cache,
645
+ cache_position=cache_position,
646
+ )
647
+ hidden_states = residual + hidden_states
648
+
649
+ # Fully Connected
650
+ residual = hidden_states
651
+ hidden_states = self.post_attention_layernorm(hidden_states)
652
+ hidden_states = self.mlp(hidden_states)
653
+ hidden_states = residual + hidden_states
654
+
655
+ outputs = (hidden_states,)
656
+
657
+ if output_attentions:
658
+ outputs += (self_attn_weights,)
659
+
660
+ if use_cache:
661
+ outputs += (present_key_value,)
662
+
663
+ return outputs
664
+
665
+
666
+ GEMMA_START_DOCSTRING = r"""
667
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
668
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
669
+ etc.)
670
+
671
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
672
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
673
+ and behavior.
674
+
675
+ Parameters:
676
+ config ([`GemmaConfig`]):
677
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
678
+ load the weights associated with the model, only the configuration. Check out the
679
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
680
+ """
681
+
682
+
683
+ @add_start_docstrings(
684
+ "The bare Gemma Model outputting raw hidden-states without any specific head on top.",
685
+ GEMMA_START_DOCSTRING,
686
+ )
687
+ class GemmaPreTrainedModel(PreTrainedModel):
688
+ config_class = GemmaConfig
689
+ base_model_prefix = "model"
690
+ supports_gradient_checkpointing = True
691
+ _keep_in_fp32_modules = ["inv_freq", "rotary_emb", "cos_cached", "sin_cached"]
692
+ _no_split_modules = ["GemmaDecoderLayer"]
693
+ _skip_keys_device_placement = ["past_key_values", "causal_mask"]
694
+ _supports_flash_attn_2 = True
695
+ _supports_sdpa = True
696
+ _supports_cache_class = True
697
+ _supports_static_cache = True
698
+
699
+ def _init_weights(self, module):
700
+ std = self.config.initializer_range
701
+ if isinstance(module, nn.Linear):
702
+ module.weight.data.normal_(mean=0.0, std=std)
703
+ if module.bias is not None:
704
+ module.bias.data.zero_()
705
+ elif isinstance(module, nn.Embedding):
706
+ module.weight.data.normal_(mean=0.0, std=std)
707
+ if module.padding_idx is not None:
708
+ module.weight.data[module.padding_idx].zero_()
709
+
710
+
711
+ GEMMA_INPUTS_DOCSTRING = r"""
712
+ Args:
713
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
714
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
715
+ it.
716
+
717
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
718
+ [`PreTrainedTokenizer.__call__`] for details.
719
+
720
+ [What are input IDs?](../glossary#input-ids)
721
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
722
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
723
+
724
+ - 1 for tokens that are **not masked**,
725
+ - 0 for tokens that are **masked**.
726
+
727
+ [What are attention masks?](../glossary#attention-mask)
728
+
729
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
730
+ [`PreTrainedTokenizer.__call__`] for details.
731
+
732
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
733
+ `past_key_values`).
734
+
735
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
736
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
737
+ information on the default strategy.
738
+
739
+ - 1 indicates the head is **not masked**,
740
+ - 0 indicates the head is **masked**.
741
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
742
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
743
+ config.n_positions - 1]`.
744
+
745
+ [What are position IDs?](../glossary#position-ids)
746
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
747
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
748
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
749
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
750
+
751
+ Two formats are allowed:
752
+ - a [`~cache_utils.Cache`] instance;
753
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
754
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
755
+ cache format.
756
+
757
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
758
+ legacy cache format will be returned.
759
+
760
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
761
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
762
+ of shape `(batch_size, sequence_length)`.
763
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
764
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
765
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
766
+ model's internal embedding lookup matrix.
767
+ use_cache (`bool`, *optional*):
768
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
769
+ `past_key_values`).
770
+ output_attentions (`bool`, *optional*):
771
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
772
+ tensors for more detail.
773
+ output_hidden_states (`bool`, *optional*):
774
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
775
+ more detail.
776
+ return_dict (`bool`, *optional*):
777
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
778
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
779
+ Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
780
+ this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
781
+ the complete sequence length.
782
+ """
783
+
784
+
785
+ @add_start_docstrings(
786
+ "The bare Gemma Model outputting raw hidden-states without any specific head on top.",
787
+ GEMMA_START_DOCSTRING,
788
+ )
789
+ class GemmaModel(GemmaPreTrainedModel):
790
+ """
791
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`GemmaDecoderLayer`]
792
+
793
+ Args:
794
+ config: GemmaConfig
795
+ """
796
+
797
+ def __init__(self, config: GemmaConfig):
798
+ super().__init__(config)
799
+ self.padding_idx = config.pad_token_id
800
+ self.vocab_size = config.vocab_size
801
+
802
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
803
+ self.layers = nn.ModuleList(
804
+ [GemmaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
805
+ )
806
+ self.norm = GemmaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
807
+ self.gradient_checkpointing = False
808
+
809
+ # Initialize weights and apply final processing
810
+ self.post_init()
811
+
812
+ def get_input_embeddings(self):
813
+ return self.embed_tokens
814
+
815
+ def set_input_embeddings(self, value):
816
+ self.embed_tokens = value
817
+
818
+ @add_start_docstrings_to_model_forward(GEMMA_INPUTS_DOCSTRING)
819
+ # Ignore copy
820
+ def forward(
821
+ self,
822
+ input_ids: torch.LongTensor = None,
823
+ attention_mask: Optional[torch.Tensor] = None,
824
+ position_ids: Optional[torch.LongTensor] = None,
825
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
826
+ inputs_embeds: Optional[torch.FloatTensor] = None,
827
+ use_cache: Optional[bool] = None,
828
+ output_attentions: Optional[bool] = None,
829
+ output_hidden_states: Optional[bool] = None,
830
+ return_dict: Optional[bool] = None,
831
+ cache_position: Optional[torch.LongTensor] = None,
832
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
833
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
834
+ output_hidden_states = (
835
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
836
+ )
837
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
838
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
839
+
840
+ if (input_ids is None) ^ (inputs_embeds is not None):
841
+ raise ValueError(
842
+ "You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
843
+ )
844
+
845
+ if self.gradient_checkpointing and self.training and use_cache:
846
+ logger.warning_once(
847
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
848
+ )
849
+ use_cache = False
850
+
851
+ if inputs_embeds is None:
852
+ if self.config.offload_tag: # TINGYUAN: offload
853
+ orig_device = input_ids.device
854
+ input_ids = input_ids.to(self.embed_tokens.weight.device)
855
+ inputs_embeds = self.embed_tokens(input_ids)
856
+ if self.config.offload_tag: # TINGYUAN: offload
857
+ inputs_embeds = inputs_embeds.to(orig_device)
858
+ torch.cuda.empty_cache()
859
+
860
+ return_legacy_cache = False
861
+ if use_cache and not isinstance(past_key_values, Cache): # kept for BC (non `Cache` `past_key_values` inputs)
862
+ return_legacy_cache = True
863
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
864
+
865
+ if cache_position is None:
866
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
867
+ cache_position = torch.arange(
868
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
869
+ )
870
+
871
+ if position_ids is None:
872
+ position_ids = cache_position.unsqueeze(0)
873
+
874
+ causal_mask = self._update_causal_mask(
875
+ attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
876
+ )
877
+
878
+ # embed positions
879
+ hidden_states = inputs_embeds
880
+
881
+ # normalized
882
+ # Gemma downcasts the below to float16, causing sqrt(3072)=55.4256 to become 55.5
883
+ # See https://github.com/huggingface/transformers/pull/29402
884
+ normalizer = torch.tensor(self.config.hidden_size**0.5, dtype=hidden_states.dtype)
885
+ hidden_states = hidden_states * normalizer
886
+
887
+ # decoder layers
888
+ all_hidden_states = () if output_hidden_states else None
889
+ all_self_attns = () if output_attentions else None
890
+ next_decoder_cache = None
891
+
892
+ for decoder_layer in self.layers:
893
+ if self.config.offload_tag: # TINGYUAN: offload
894
+ decoder_layer.to(hidden_states.device)
895
+ if output_hidden_states:
896
+ all_hidden_states += (hidden_states,)
897
+
898
+ if self.gradient_checkpointing and self.training:
899
+ layer_outputs = self._gradient_checkpointing_func(
900
+ decoder_layer.__call__,
901
+ hidden_states,
902
+ causal_mask,
903
+ position_ids,
904
+ past_key_values,
905
+ output_attentions,
906
+ use_cache,
907
+ cache_position,
908
+ )
909
+ else:
910
+ layer_outputs = decoder_layer(
911
+ hidden_states,
912
+ attention_mask=causal_mask,
913
+ position_ids=position_ids,
914
+ past_key_value=past_key_values,
915
+ output_attentions=output_attentions,
916
+ use_cache=use_cache,
917
+ cache_position=cache_position,
918
+ )
919
+ if self.config.offload_tag: # TINGYUAN: offload
920
+ decoder_layer.to("cpu")
921
+ torch.cuda.empty_cache()
922
+ hidden_states = layer_outputs[0]
923
+
924
+ if use_cache:
925
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
926
+
927
+ if output_attentions:
928
+ all_self_attns += (layer_outputs[1],)
929
+ if self.config.offload_tag: # TINGYUAN: offload
930
+ self.norm.to(hidden_states.device)
931
+ hidden_states = self.norm(hidden_states)
932
+ if self.config.offload_tag: # TINGYUAN: offload
933
+ self.norm.to("cpu")
934
+ torch.cuda.empty_cache()
935
+
936
+ # add hidden states from the last decoder layer
937
+ if output_hidden_states:
938
+ all_hidden_states += (hidden_states,)
939
+
940
+ next_cache = next_decoder_cache if use_cache else None
941
+ if return_legacy_cache:
942
+ next_cache = next_cache.to_legacy_cache()
943
+
944
+ if not return_dict:
945
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
946
+ return BaseModelOutputWithPast(
947
+ last_hidden_state=hidden_states,
948
+ past_key_values=next_cache,
949
+ hidden_states=all_hidden_states,
950
+ attentions=all_self_attns,
951
+ )
952
+
953
+ def _update_causal_mask(
954
+ self,
955
+ attention_mask: torch.Tensor,
956
+ input_tensor: torch.Tensor,
957
+ cache_position: torch.Tensor,
958
+ past_key_values: Cache,
959
+ output_attentions: bool,
960
+ ):
961
+ # TODO: As of torch==2.2.0, the `attention_mask` passed to the model in `generate` is 2D and of dynamic length even when the static
962
+ # KV cache is used. This is an issue for torch.compile which then recaptures cudagraphs at each decode steps due to the dynamic shapes.
963
+ # (`recording cudagraph tree for symint key 13`, etc.), which is VERY slow. A workaround is `@torch.compiler.disable`, but this prevents using
964
+ # `fullgraph=True`. See more context in https://github.com/huggingface/transformers/pull/29114
965
+
966
+ if self.config._attn_implementation == "flash_attention_2":
967
+ if attention_mask is not None and 0.0 in attention_mask:
968
+ return attention_mask
969
+ return None
970
+
971
+ # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
972
+ # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
973
+ # to infer the attention mask.
974
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
975
+ using_static_cache = isinstance(past_key_values, StaticCache)
976
+
977
+ # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
978
+ if self.config._attn_implementation == "sdpa" and not using_static_cache and not output_attentions:
979
+ if AttentionMaskConverter._ignore_causal_mask_sdpa(
980
+ attention_mask,
981
+ inputs_embeds=input_tensor,
982
+ past_key_values_length=past_seen_tokens,
983
+ is_training=self.training,
984
+ ):
985
+ return None
986
+
987
+ dtype, device = input_tensor.dtype, input_tensor.device
988
+ min_dtype = torch.finfo(dtype).min
989
+ sequence_length = input_tensor.shape[1]
990
+ if using_static_cache:
991
+ target_length = past_key_values.get_max_length()
992
+ else:
993
+ target_length = (
994
+ attention_mask.shape[-1]
995
+ if isinstance(attention_mask, torch.Tensor)
996
+ else past_seen_tokens + sequence_length + 1
997
+ )
998
+
999
+ if attention_mask is not None and attention_mask.dim() == 4:
1000
+ # in this case we assume that the mask comes already in inverted form and requires no inversion or slicing
1001
+ causal_mask = attention_mask
1002
+ else:
1003
+ causal_mask = torch.full(
1004
+ (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device
1005
+ )
1006
+ if sequence_length != 1:
1007
+ causal_mask = torch.triu(causal_mask, diagonal=1)
1008
+ causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
1009
+ causal_mask = causal_mask[None, None, :, :].expand(input_tensor.shape[0], 1, -1, -1)
1010
+ if attention_mask is not None:
1011
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
1012
+ mask_length = attention_mask.shape[-1]
1013
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
1014
+ padding_mask = padding_mask == 0
1015
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
1016
+ padding_mask, min_dtype
1017
+ )
1018
+ if (
1019
+ self.config._attn_implementation == "sdpa"
1020
+ and attention_mask is not None
1021
+ and attention_mask.device.type == "cuda"
1022
+ and not output_attentions
1023
+ ):
1024
+ # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
1025
+ # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
1026
+ # Details: https://github.com/pytorch/pytorch/issues/110213
1027
+ causal_mask = AttentionMaskConverter._unmask_unattended(causal_mask, min_dtype)
1028
+
1029
+ return causal_mask
1030
+
1031
+
1032
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM with LLAMA->GEMMA,Llama->Gemma,llama->gemma
1033
+ class GemmaForCausalLM(GemmaPreTrainedModel):
1034
+ _tied_weights_keys = ["lm_head.weight"]
1035
+
1036
+ def __init__(self, config):
1037
+ super().__init__(config)
1038
+ self.model = GemmaModel(config)
1039
+ self.vocab_size = config.vocab_size
1040
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1041
+
1042
+ # Initialize weights and apply final processing
1043
+ self.post_init()
1044
+
1045
+ def get_input_embeddings(self):
1046
+ return self.model.embed_tokens
1047
+
1048
+ def set_input_embeddings(self, value):
1049
+ self.model.embed_tokens = value
1050
+
1051
+ def get_output_embeddings(self):
1052
+ return self.lm_head
1053
+
1054
+ def set_output_embeddings(self, new_embeddings):
1055
+ self.lm_head = new_embeddings
1056
+
1057
+ def set_decoder(self, decoder):
1058
+ self.model = decoder
1059
+
1060
+ def get_decoder(self):
1061
+ return self.model
1062
+
1063
+ # Ignore copy
1064
+ @add_start_docstrings_to_model_forward(GEMMA_INPUTS_DOCSTRING)
1065
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1066
+ def forward(
1067
+ self,
1068
+ input_ids: torch.LongTensor = None,
1069
+ attention_mask: Optional[torch.Tensor] = None,
1070
+ position_ids: Optional[torch.LongTensor] = None,
1071
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1072
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1073
+ labels: Optional[torch.LongTensor] = None,
1074
+ use_cache: Optional[bool] = None,
1075
+ output_attentions: Optional[bool] = None,
1076
+ output_hidden_states: Optional[bool] = None,
1077
+ return_dict: Optional[bool] = None,
1078
+ cache_position: Optional[torch.LongTensor] = None,
1079
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1080
+ r"""
1081
+ Args:
1082
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1083
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1084
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1085
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1086
+
1087
+ Returns:
1088
+
1089
+ Example:
1090
+
1091
+ ```python
1092
+ >>> from transformers import AutoTokenizer, GemmaForCausalLM
1093
+
1094
+ >>> model = GemmaForCausalLM.from_pretrained("google/gemma-7b")
1095
+ >>> tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b")
1096
+
1097
+ >>> prompt = "What is your favorite condiment?"
1098
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1099
+
1100
+ >>> # Generate
1101
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1102
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1103
+ "What is your favorite condiment?"
1104
+ ```"""
1105
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1106
+ output_hidden_states = (
1107
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1108
+ )
1109
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1110
+
1111
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1112
+ outputs = self.model(
1113
+ input_ids=input_ids,
1114
+ attention_mask=attention_mask,
1115
+ position_ids=position_ids,
1116
+ past_key_values=past_key_values,
1117
+ inputs_embeds=inputs_embeds,
1118
+ use_cache=use_cache,
1119
+ output_attentions=output_attentions,
1120
+ output_hidden_states=output_hidden_states,
1121
+ return_dict=return_dict,
1122
+ cache_position=cache_position,
1123
+ )
1124
+
1125
+ hidden_states = outputs[0]
1126
+ if self.config.offload_tag: # TINGYUAN: offload
1127
+ orig_device = self.lm_head.weight.device
1128
+ self.lm_head.to(hidden_states.device)
1129
+ logits = self.lm_head(hidden_states)
1130
+ logits = logits.float()
1131
+ if self.config.offload_tag: # TINGYUAN: offload
1132
+ self.lm_head.to(orig_device)
1133
+ torch.cuda.empty_cache()
1134
+ loss = None
1135
+ if labels is not None:
1136
+ # Shift so that tokens < n predict n
1137
+ shift_logits = logits[..., :-1, :].contiguous()
1138
+ shift_labels = labels[..., 1:].contiguous()
1139
+ # Flatten the tokens
1140
+ loss_fct = CrossEntropyLoss()
1141
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1142
+ shift_labels = shift_labels.view(-1)
1143
+ # Enable model parallelism
1144
+ shift_labels = shift_labels.to(shift_logits.device)
1145
+ loss = loss_fct(shift_logits, shift_labels)
1146
+
1147
+ if not return_dict:
1148
+ output = (logits,) + outputs[1:]
1149
+ return (loss,) + output if loss is not None else output
1150
+
1151
+ return CausalLMOutputWithPast(
1152
+ loss=loss,
1153
+ logits=logits,
1154
+ past_key_values=outputs.past_key_values,
1155
+ hidden_states=outputs.hidden_states,
1156
+ attentions=outputs.attentions,
1157
+ )
1158
+
1159
+ def prepare_inputs_for_generation(
1160
+ self,
1161
+ input_ids,
1162
+ past_key_values=None,
1163
+ attention_mask=None,
1164
+ inputs_embeds=None,
1165
+ cache_position=None,
1166
+ use_cache=True,
1167
+ **kwargs,
1168
+ ):
1169
+ past_length = 0
1170
+ if past_key_values is not None:
1171
+ if isinstance(past_key_values, Cache):
1172
+ past_length = cache_position[0] if cache_position is not None else past_key_values.get_seq_length()
1173
+ max_cache_length = (
1174
+ torch.tensor(past_key_values.get_max_length(), device=input_ids.device)
1175
+ if past_key_values.get_max_length() is not None
1176
+ else None
1177
+ )
1178
+ cache_length = past_length if max_cache_length is None else torch.min(max_cache_length, past_length)
1179
+ # TODO joao: remove this `else` after `generate` prioritizes `Cache` objects
1180
+ else:
1181
+ cache_length = past_length = past_key_values[0][0].shape[2]
1182
+ max_cache_length = None
1183
+
1184
+ # Keep only the unprocessed tokens:
1185
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
1186
+ # some of the inputs are exclusively passed as part of the cache (e.g. when passing input_embeds as input)
1187
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
1188
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
1189
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
1190
+ # input_ids based on the past_length.
1191
+ elif past_length < input_ids.shape[1]:
1192
+ input_ids = input_ids[:, past_length:]
1193
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
1194
+
1195
+ # If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
1196
+ if (
1197
+ max_cache_length is not None
1198
+ and attention_mask is not None
1199
+ and cache_length + input_ids.shape[1] > max_cache_length
1200
+ ):
1201
+ attention_mask = attention_mask[:, -max_cache_length:]
1202
+
1203
+ position_ids = kwargs.get("position_ids", None)
1204
+ if attention_mask is not None and position_ids is None:
1205
+ # create position_ids on the fly for batch generation
1206
+ position_ids = attention_mask.long().cumsum(-1) - 1
1207
+ position_ids.masked_fill_(attention_mask == 0, 1)
1208
+ if past_key_values:
1209
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1210
+
1211
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1212
+ if inputs_embeds is not None and past_key_values is None:
1213
+ model_inputs = {"inputs_embeds": inputs_embeds}
1214
+ else:
1215
+ # The `contiguous()` here is necessary to have a static stride during decoding. torchdynamo otherwise
1216
+ # recompiles graphs as the stride of the inputs is a guard. Ref: https://github.com/huggingface/transformers/pull/29114
1217
+ # TODO: use `next_tokens` directly instead.
1218
+ model_inputs = {"input_ids": input_ids.contiguous()}
1219
+
1220
+ input_length = position_ids.shape[-1] if position_ids is not None else input_ids.shape[-1]
1221
+ if cache_position is None:
1222
+ cache_position = torch.arange(past_length, past_length + input_length, device=input_ids.device)
1223
+ elif use_cache:
1224
+ cache_position = cache_position[-input_length:]
1225
+
1226
+ model_inputs.update(
1227
+ {
1228
+ "position_ids": position_ids,
1229
+ "cache_position": cache_position,
1230
+ "past_key_values": past_key_values,
1231
+ "use_cache": use_cache,
1232
+ "attention_mask": attention_mask,
1233
+ }
1234
+ )
1235
+ return model_inputs
1236
+
1237
+ @staticmethod
1238
+ def _reorder_cache(past_key_values, beam_idx):
1239
+ reordered_past = ()
1240
+ for layer_past in past_key_values:
1241
+ reordered_past += (
1242
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
1243
+ )
1244
+ return reordered_past
1245
+
1246
+
1247
+ @add_start_docstrings(
1248
+ """
1249
+ The Gemma Model transformer with a sequence classification head on top (linear layer).
1250
+
1251
+ [`GemmaForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1252
+ (e.g. GPT-2) do.
1253
+
1254
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1255
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1256
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1257
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1258
+ each row of the batch).
1259
+ """,
1260
+ GEMMA_START_DOCSTRING,
1261
+ )
1262
+ # Copied from transformers.models.llama.modeling_llama.LlamaForSequenceClassification with LLAMA->GEMMA,Llama->Gemma
1263
+ class GemmaForSequenceClassification(GemmaPreTrainedModel):
1264
+ def __init__(self, config):
1265
+ super().__init__(config)
1266
+ self.num_labels = config.num_labels
1267
+ self.model = GemmaModel(config)
1268
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1269
+
1270
+ # Initialize weights and apply final processing
1271
+ self.post_init()
1272
+
1273
+ def get_input_embeddings(self):
1274
+ return self.model.embed_tokens
1275
+
1276
+ def set_input_embeddings(self, value):
1277
+ self.model.embed_tokens = value
1278
+
1279
+ @add_start_docstrings_to_model_forward(GEMMA_INPUTS_DOCSTRING)
1280
+ def forward(
1281
+ self,
1282
+ input_ids: torch.LongTensor = None,
1283
+ attention_mask: Optional[torch.Tensor] = None,
1284
+ position_ids: Optional[torch.LongTensor] = None,
1285
+ past_key_values: Optional[Union[Cache, List[torch.FloatTensor]]] = None,
1286
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1287
+ labels: Optional[torch.LongTensor] = None,
1288
+ use_cache: Optional[bool] = None,
1289
+ output_attentions: Optional[bool] = None,
1290
+ output_hidden_states: Optional[bool] = None,
1291
+ return_dict: Optional[bool] = None,
1292
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1293
+ r"""
1294
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1295
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1296
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1297
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1298
+ """
1299
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1300
+
1301
+ transformer_outputs = self.model(
1302
+ input_ids,
1303
+ attention_mask=attention_mask,
1304
+ position_ids=position_ids,
1305
+ past_key_values=past_key_values,
1306
+ inputs_embeds=inputs_embeds,
1307
+ use_cache=use_cache,
1308
+ output_attentions=output_attentions,
1309
+ output_hidden_states=output_hidden_states,
1310
+ return_dict=return_dict,
1311
+ )
1312
+ hidden_states = transformer_outputs[0]
1313
+ logits = self.score(hidden_states)
1314
+
1315
+ if input_ids is not None:
1316
+ batch_size = input_ids.shape[0]
1317
+ else:
1318
+ batch_size = inputs_embeds.shape[0]
1319
+
1320
+ if self.config.pad_token_id is None and batch_size != 1:
1321
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1322
+ if self.config.pad_token_id is None:
1323
+ sequence_lengths = -1
1324
+ else:
1325
+ if input_ids is not None:
1326
+ # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
1327
+ sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
1328
+ sequence_lengths = sequence_lengths % input_ids.shape[-1]
1329
+ sequence_lengths = sequence_lengths.to(logits.device)
1330
+ else:
1331
+ sequence_lengths = -1
1332
+
1333
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1334
+
1335
+ loss = None
1336
+ if labels is not None:
1337
+ labels = labels.to(logits.device)
1338
+ if self.config.problem_type is None:
1339
+ if self.num_labels == 1:
1340
+ self.config.problem_type = "regression"
1341
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1342
+ self.config.problem_type = "single_label_classification"
1343
+ else:
1344
+ self.config.problem_type = "multi_label_classification"
1345
+
1346
+ if self.config.problem_type == "regression":
1347
+ loss_fct = MSELoss()
1348
+ if self.num_labels == 1:
1349
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1350
+ else:
1351
+ loss = loss_fct(pooled_logits, labels)
1352
+ elif self.config.problem_type == "single_label_classification":
1353
+ loss_fct = CrossEntropyLoss()
1354
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1355
+ elif self.config.problem_type == "multi_label_classification":
1356
+ loss_fct = BCEWithLogitsLoss()
1357
+ loss = loss_fct(pooled_logits, labels)
1358
+ if not return_dict:
1359
+ output = (pooled_logits,) + transformer_outputs[1:]
1360
+ return ((loss,) + output) if loss is not None else output
1361
+
1362
+ return SequenceClassifierOutputWithPast(
1363
+ loss=loss,
1364
+ logits=pooled_logits,
1365
+ past_key_values=transformer_outputs.past_key_values,
1366
+ hidden_states=transformer_outputs.hidden_states,
1367
+ attentions=transformer_outputs.attentions,
1368
+ )
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b30749ae04bc7246a96b3e67a04afe5490a9cfb52ee1a1ec1f0beaaa63b198fa
3
+ size 20049484054
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6628f3e051bce7c57a19ecec03982a951583a94ef4c165dc4f368756bc2d5529
3
+ size 14512
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f615173e120df8811b43920719e2eadfe4d092e26f1d5cd533e1c0b8d1948501
3
+ size 14512
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05890418f024e9177b5c5779b8953c0a83ff40af5570103af8fb9df169cebfc7
3
+ size 14512
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69e124e0e92306ea9944fb33a36599e569571bd948cfd7253c2a0b0825f639de
3
+ size 14512
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7dccda9639b99b00ccb61aca07f46069511f885e62bb968ed2fc69419be9c05
3
+ size 1064
special_tokens_map.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7da53ca29fb16f6b2489482fc0bc6a394162cdab14d12764a1755ebc583fea79
3
+ size 17518525
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61a7b147390c64585d6c3543dd6fc636906c9af3865a5548f27f31aee1d4c8e2
3
+ size 4241003
tokenizer_config.json ADDED
@@ -0,0 +1,1757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
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
+ },
1742
+ "additional_special_tokens": [
1743
+ "<start_of_turn>",
1744
+ "<end_of_turn>"
1745
+ ],
1746
+ "bos_token": "<bos>",
1747
+ "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 %}",
1748
+ "clean_up_tokenization_spaces": false,
1749
+ "eos_token": "<eos>",
1750
+ "model_max_length": 1000000000000000019884624838656,
1751
+ "pad_token": "<pad>",
1752
+ "sp_model_kwargs": {},
1753
+ "spaces_between_special_tokens": false,
1754
+ "tokenizer_class": "GemmaTokenizer",
1755
+ "unk_token": "<unk>",
1756
+ "use_default_system_prompt": false
1757
+ }
trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a40b0ebea4286fc2acfb3970043c6d89632d459479c20b4a105fe48968ad0f9
3
+ size 5176