lunaticzzz commited on
Commit
9e77032
·
verified ·
1 Parent(s): 1e17846

Upload 11 files

Browse files
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  JT-Coder.png 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
  JT-Coder.png filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE.txt ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
added_tokens.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|begin_of_thought|>": 151665,
5
+ "<|box_end|>": 151649,
6
+ "<|box_start|>": 151648,
7
+ "<|end_of_thought|>": 151666,
8
+ "<|endoftext|>": 151643,
9
+ "<|file_sep|>": 151664,
10
+ "<|fim_middle|>": 151660,
11
+ "<|fim_pad|>": 151662,
12
+ "<|fim_prefix|>": 151659,
13
+ "<|fim_suffix|>": 151661,
14
+ "<|im_end|>": 151645,
15
+ "<|im_start|>": 151644,
16
+ "<|image_pad|>": 151655,
17
+ "<|object_ref_end|>": 151647,
18
+ "<|object_ref_start|>": 151646,
19
+ "<|quad_end|>": 151651,
20
+ "<|quad_start|>": 151650,
21
+ "<|repo_name|>": 151663,
22
+ "<|video_pad|>": 151656,
23
+ "<|vision_end|>": 151653,
24
+ "<|vision_pad|>": 151654,
25
+ "<|vision_start|>": 151652
26
+ }
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "JiutianForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_jiutian.JiutianConfig",
8
+ "AutoModelForCausalLM": "modeling_jiutian.JiutianForCausalLM"
9
+ },
10
+ "eos_token_id": 151645,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 4096,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 13312,
15
+ "max_position_embeddings": 8192,
16
+ "model_type": "jiutian",
17
+ "num_attention_heads": 32,
18
+ "num_hidden_layers": 32,
19
+ "num_key_value_heads": 8,
20
+ "pad_token_id": 151645,
21
+ "pretraining_tp": 1,
22
+ "qkv_bias": true,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_scaling": null,
25
+ "rope_theta": 10000.0,
26
+ "tie_word_embeddings": false,
27
+ "torch_dtype": "bfloat16",
28
+ "transformers_version": "4.51.3",
29
+ "use_cache": true,
30
+ "vocab_size": 152064
31
+ }
configuration_jiutian.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers.configuration_utils import PretrainedConfig
2
+ from transformers.utils import logging
3
+ logger = logging.get_logger(__name__)
4
+
5
+ CM_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
6
+
7
+
8
+ class JiutianConfig(PretrainedConfig):
9
+ model_type = "jiutian"
10
+ keys_to_ignore_at_inference = ["past_key_values"]
11
+
12
+ def __init__(
13
+ self,
14
+ vocab_size=152064,
15
+ hidden_size=8192,
16
+ intermediate_size=13312,
17
+ num_hidden_layers=32,
18
+ num_attention_heads=32,
19
+ num_key_value_heads=8,
20
+ hidden_act="silu",
21
+ max_position_embeddings=8192,
22
+ initializer_range=0.02,
23
+ rms_norm_eps=1e-6,
24
+ use_cache=True,
25
+ pad_token_id=151645,
26
+ bos_token_id=None,
27
+ eos_token_id=151645,
28
+ pretraining_tp=1,
29
+ tie_word_embeddings=False,
30
+ rope_theta=500000,
31
+ rope_scaling=None,
32
+ qkv_bias=True,
33
+ attention_dropout=0.0,
34
+ **kwargs,
35
+ ):
36
+ self.vocab_size = vocab_size
37
+ self.max_position_embeddings = max_position_embeddings
38
+ self.hidden_size = hidden_size
39
+ self.intermediate_size = intermediate_size
40
+ self.num_hidden_layers = num_hidden_layers
41
+ self.num_attention_heads = num_attention_heads
42
+ self.hidden_act = hidden_act
43
+ self.initializer_range = initializer_range
44
+ self.rms_norm_eps = rms_norm_eps
45
+ self.pretraining_tp = pretraining_tp
46
+ self.use_cache = use_cache
47
+ self.rope_theta = rope_theta
48
+ self.rope_scaling = None
49
+ self.qkv_bias = qkv_bias
50
+ self.attention_dropout = attention_dropout
51
+ if num_key_value_heads is None:
52
+ num_key_value_heads = num_attention_heads
53
+ self.num_key_value_heads = num_key_value_heads
54
+
55
+ super().__init__(
56
+ pad_token_id=pad_token_id,
57
+ bos_token_id=bos_token_id,
58
+ eos_token_id=eos_token_id,
59
+ tie_word_embeddings=tie_word_embeddings,
60
+ **kwargs,
61
+ )
62
+
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": 151645,
4
+ "pad_token_id": 151645,
5
+ "transformers_version": "4.51.3"
6
+ }
modeling_jiutian.py ADDED
@@ -0,0 +1,621 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+ import copy
3
+ from typing import List, Optional, Tuple, Union, Dict
4
+ from threading import Thread
5
+
6
+ import torch
7
+ import torch.nn.functional as F
8
+ import torch.utils.checkpoint
9
+ from torch import nn
10
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
11
+
12
+ from transformers.activations import ACT2FN
13
+ from transformers import GenerationConfig
14
+ from transformers.cache_utils import Cache, DynamicCache
15
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
16
+ from transformers.modeling_utils import PreTrainedModel
17
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13
18
+ from transformers.utils import (
19
+ add_start_docstrings,
20
+ add_start_docstrings_to_model_forward,
21
+ is_flash_attn_2_available,
22
+ is_flash_attn_greater_or_equal_2_10,
23
+ logging,
24
+ replace_return_docstrings,
25
+ )
26
+ from .configuration_jiutian import JiutianConfig
27
+
28
+ if is_flash_attn_2_available():
29
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
30
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
31
+
32
+
33
+ logger = logging.get_logger(__name__)
34
+
35
+ _CONFIG_FOR_DOC = "JiutianConfig"
36
+
37
+
38
+ class JiutianRMSNorm(nn.Module):
39
+ def __init__(self, hidden_size, eps=1e-5):
40
+ """
41
+ Root Mean Square Layer Normalization
42
+ :param hidden_size: model size
43
+ :param eps: epsilon value, default 1e-5
44
+ """
45
+ super().__init__()
46
+ self.weight = torch.nn.Parameter(torch.ones(hidden_size))
47
+ self.epsilon = eps
48
+ self.d = hidden_size
49
+
50
+ def forward(self, hidden_states):
51
+ input_dtype = hidden_states.dtype
52
+ hidden_states = hidden_states.to(torch.float32)
53
+ norm_states = hidden_states.norm(2, dim=-1, keepdim=True)
54
+ d_states = self.d
55
+ rms_states = norm_states * d_states ** (-1.0 / 2)
56
+ states_normed = hidden_states / (rms_states + self.epsilon)
57
+ return self.weight * states_normed.to(input_dtype)
58
+
59
+
60
+ ALL_LAYERNORM_LAYERS.append(JiutianRMSNorm)
61
+
62
+
63
+ class JiutianRotaryEmbedding(nn.Module):
64
+ def __init__(self, dim, max_position_embeddings=4096, base=10000, device=None):
65
+ super().__init__()
66
+ inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float().to(device) / dim))
67
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
68
+ self.seq_len_cached = None
69
+ self.cos_cached = None
70
+ self.sin_cached = None
71
+
72
+ def forward(self, x, seq_len=None):
73
+ # x: [bs, num_attention_heads, seq_len, head_size]
74
+ if self.seq_len_cached is None:
75
+ self.seq_len_cached = 0
76
+ if seq_len > self.seq_len_cached:
77
+ self.seq_len_cached = seq_len
78
+ t = torch.arange(seq_len, device=x.device).type_as(self.inv_freq)
79
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
80
+ emb = torch.cat((freqs, freqs), dim=-1).to(x.device)
81
+ self.cos_cached = emb.float().cos()[:, :]
82
+ self.sin_cached = emb.float().sin()[:, :]
83
+ return (
84
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
85
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
86
+ )
87
+
88
+
89
+ def rotate_half(x):
90
+ x1, x2 = x[..., : x.shape[-1] // 2], x[..., x.shape[-1] // 2 :]
91
+ return torch.cat((-x2, x1), dim=-1)
92
+
93
+
94
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
95
+ cos, sin = cos[position_ids].unsqueeze(unsqueeze_dim), sin[position_ids].unsqueeze(unsqueeze_dim)
96
+ q_embed, k_embed = (q * cos) + (rotate_half(q) * sin), (k * cos) + (rotate_half(k) * sin)
97
+ return q_embed, k_embed
98
+
99
+
100
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
101
+ """
102
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
103
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
104
+ """
105
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
106
+ if n_rep == 1:
107
+ return hidden_states
108
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
109
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
110
+
111
+ class JiutianMLP(nn.Module):
112
+ def __init__(self, config):
113
+ super().__init__()
114
+ self.config = config
115
+ self.hidden_size = config.hidden_size
116
+ self.intermediate_size = config.intermediate_size
117
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
118
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
119
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
120
+ self.act_fn = ACT2FN[config.hidden_act]
121
+
122
+ def forward(self, x):
123
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
124
+
125
+
126
+ class JiutianFlashAttention2(nn.Module):
127
+ def __init__(self, config: JiutianConfig, layer_idx: Optional[int] = None):
128
+ super().__init__()
129
+ self.config = config
130
+ self.layer_idx = layer_idx
131
+ self.attention_dropout = config.attention_dropout
132
+ self.hidden_size = config.hidden_size
133
+ self.num_heads = config.num_attention_heads
134
+ self.num_key_value_heads = config.num_key_value_heads
135
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
136
+ self.head_dim = self.hidden_size // self.num_heads
137
+ self.max_position_embeddings = config.max_position_embeddings
138
+ self.rope_theta = config.rope_theta
139
+ self.is_causal = True
140
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
141
+
142
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.qkv_bias)
143
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.qkv_bias)
144
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.qkv_bias)
145
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
146
+ self.rotary_emb = JiutianRotaryEmbedding(
147
+ self.head_dim,
148
+ max_position_embeddings=self.max_position_embeddings,
149
+ base=self.rope_theta,
150
+ )
151
+
152
+ def forward(
153
+ self,
154
+ hidden_states: torch.Tensor,
155
+ attention_mask: Optional[torch.LongTensor] = None,
156
+ position_ids: Optional[torch.LongTensor] = None,
157
+ past_key_value: Optional[Cache] = None,
158
+ use_cache: bool = False,
159
+ **kwargs,
160
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
161
+ # JiutianFlashAttention2 attention does not support output_attentions
162
+ if "padding_mask" in kwargs:
163
+ warnings.warn(
164
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
165
+ )
166
+ # overwrite attention_mask with padding_mask
167
+ attention_mask = kwargs.pop("padding_mask")
168
+ bsz, q_len, _ = hidden_states.size()
169
+
170
+ query_states = self.q_proj(hidden_states)
171
+ key_states = self.k_proj(hidden_states)
172
+ value_states = self.v_proj(hidden_states)
173
+
174
+ # Flash attention requires the input (bsz, sq_len, head_dim, hidden_dim )
175
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
176
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
177
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
178
+ kv_seq_len = key_states.shape[-2]
179
+ if past_key_value is not None:
180
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
181
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
182
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
183
+
184
+ if past_key_value is not None:
185
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
186
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
187
+
188
+
189
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
190
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
191
+
192
+ # 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
193
+ # to be able to avoid many of these transpose/reshape/view.
194
+ query_states = query_states.transpose(1, 2)
195
+ key_states = key_states.transpose(1, 2)
196
+ value_states = value_states.transpose(1, 2)
197
+
198
+ dropout_rate = self.attention_dropout if self.training else 0.0
199
+ query_length = q_len
200
+ if not self._flash_attn_uses_top_left_mask:
201
+ causal = self.is_causal
202
+ else:
203
+ causal = self.is_causal and query_length != 1
204
+
205
+ # Contains at least one padding token in the sequence
206
+ if attention_mask is not None:
207
+ batch_size = query_states.shape[0]
208
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
209
+ query_states, key_states, value_states, attention_mask, query_length
210
+ )
211
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
212
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
213
+ attn_output_unpad = flash_attn_varlen_func(
214
+ query_states,
215
+ key_states,
216
+ value_states,
217
+ cu_seqlens_q=cu_seqlens_q,
218
+ cu_seqlens_k=cu_seqlens_k,
219
+ max_seqlen_q=max_seqlen_in_batch_q,
220
+ max_seqlen_k=max_seqlen_in_batch_k,
221
+ dropout_p=dropout_rate,
222
+ causal=causal,
223
+ )
224
+
225
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
226
+ else:
227
+ attn_output = flash_attn_func(
228
+ query_states, key_states, value_states, dropout_rate, causal=causal
229
+ )
230
+
231
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
232
+ attn_output = self.o_proj(attn_output)
233
+ attn_weights = None
234
+
235
+ return attn_output, attn_weights, past_key_value
236
+
237
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
238
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
239
+ indices_k = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
240
+ max_seqlen_in_batch_k = seqlens_in_batch.max().item()
241
+ cu_seqlens_k = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
242
+
243
+ batch_size, kv_seq_len, num_heads, head_dim = key_layer.shape
244
+
245
+ key_layer = index_first_axis(
246
+ key_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k
247
+ )
248
+ value_layer = index_first_axis(
249
+ value_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k
250
+ )
251
+ if query_length == kv_seq_len:
252
+ query_layer = index_first_axis(
253
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
254
+ )
255
+ cu_seqlens_q = cu_seqlens_k
256
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
257
+ indices_q = indices_k
258
+ elif query_length == 1:
259
+ max_seqlen_in_batch_q = 1
260
+ cu_seqlens_q = torch.arange(
261
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
262
+ ) # There is a memcpy here, that is very bad.
263
+ indices_q = cu_seqlens_q[:-1]
264
+ query_layer = query_layer.squeeze(1)
265
+ else:
266
+ # The -q_len: slice assumes left padding.
267
+ attention_mask = attention_mask[:, -query_length:]
268
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
269
+
270
+ return (
271
+ query_layer,
272
+ key_layer,
273
+ value_layer,
274
+ indices_q,
275
+ (cu_seqlens_q, cu_seqlens_k),
276
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
277
+ )
278
+
279
+
280
+ class JiutianDecoderLayer(nn.Module):
281
+ def __init__(self, config: JiutianConfig, layer_idx: int):
282
+ super().__init__()
283
+ self.hidden_size = config.hidden_size
284
+ self.self_attn = JiutianFlashAttention2(config=config, layer_idx=layer_idx)
285
+ self.mlp = JiutianMLP(config)
286
+ self.input_layernorm = JiutianRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
287
+ self.post_attention_layernorm = JiutianRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
288
+
289
+ def forward(
290
+ self,
291
+ hidden_states: torch.Tensor,
292
+ attention_mask: Optional[torch.Tensor] = None,
293
+ position_ids: Optional[torch.LongTensor] = None,
294
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
295
+ use_cache: Optional[bool] = False,
296
+ **kwargs,
297
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
298
+
299
+ if "padding_mask" in kwargs:
300
+ warnings.warn(
301
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
302
+ )
303
+
304
+ residual = hidden_states
305
+ hidden_states = self.input_layernorm(hidden_states)
306
+
307
+ # Self Attention
308
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
309
+ hidden_states=hidden_states,
310
+ attention_mask=attention_mask,
311
+ position_ids=position_ids,
312
+ past_key_value=past_key_value,
313
+ use_cache=use_cache,
314
+ **kwargs,
315
+ )
316
+ hidden_states = residual + hidden_states
317
+
318
+ # Fully Connected
319
+ residual = hidden_states
320
+ hidden_states = self.post_attention_layernorm(hidden_states)
321
+ hidden_states = self.mlp(hidden_states)
322
+ hidden_states = residual + hidden_states
323
+
324
+ outputs = (hidden_states,)
325
+
326
+ if use_cache:
327
+ outputs += (present_key_value,)
328
+
329
+ return outputs
330
+
331
+
332
+ class JiutianPreTrainedModel(PreTrainedModel):
333
+ config_class = JiutianConfig
334
+ base_model_prefix = "model"
335
+ supports_gradient_checkpointing = True
336
+ _no_split_modules = ["JiutianDecoderLayer"]
337
+ _skip_keys_device_placement = "past_key_values"
338
+ _supports_flash_attn_2 = True
339
+ _supports_cache_class = True
340
+
341
+ def _init_weights(self, module):
342
+ std = self.config.initializer_range
343
+ if isinstance(module, nn.Linear):
344
+ module.weight.data.normal_(mean=0.0, std=std)
345
+ if module.bias is not None:
346
+ module.bias.data.zero_()
347
+ elif isinstance(module, nn.Embedding):
348
+ module.weight.data.normal_(mean=0.0, std=std)
349
+ if module.padding_idx is not None:
350
+ module.weight.data[module.padding_idx].zero_()
351
+
352
+ def _set_gradient_checkpointing(self, module: nn.Module, value: bool = False):
353
+ if isinstance(module, JiutianModel):
354
+ module.gradient_checkpointing = value
355
+
356
+
357
+ class JiutianModel(JiutianPreTrainedModel):
358
+ def __init__(self, config: JiutianConfig):
359
+ super().__init__(config)
360
+ self.padding_idx = config.pad_token_id
361
+ self.vocab_size = config.vocab_size
362
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
363
+ self.layers = nn.ModuleList(
364
+ [JiutianDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
365
+ )
366
+ self.norm = JiutianRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
367
+ self.gradient_checkpointing = False
368
+ # Initialize weights and apply final processing
369
+ self.post_init()
370
+
371
+ def get_input_embeddings(self):
372
+ return self.embed_tokens
373
+
374
+ def set_input_embeddings(self, value):
375
+ self.embed_tokens = value
376
+
377
+ def forward(
378
+ self,
379
+ input_ids: torch.LongTensor = None,
380
+ attention_mask: Optional[torch.Tensor] = None,
381
+ position_ids: Optional[torch.LongTensor] = None,
382
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
383
+ inputs_embeds: Optional[torch.FloatTensor] = None,
384
+ use_cache: Optional[bool] = None,
385
+ output_hidden_states: Optional[bool] = None,
386
+ return_dict: Optional[bool] = None,
387
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
388
+
389
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
390
+
391
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
392
+
393
+ if input_ids is not None:
394
+ batch_size, seq_length = input_ids.shape
395
+ elif inputs_embeds is not None:
396
+ batch_size, seq_length = inputs_embeds.shape
397
+
398
+ if self.gradient_checkpointing and self.training:
399
+ if use_cache:
400
+ use_cache = False
401
+
402
+ past_key_values_length = 0
403
+ if use_cache:
404
+ use_legacy_cache = not isinstance(past_key_values, Cache)
405
+ if use_legacy_cache:
406
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
407
+ past_key_values_length = past_key_values.get_usable_length(seq_length)
408
+
409
+ if position_ids is None:
410
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
411
+ position_ids = torch.arange(
412
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
413
+ )
414
+ position_ids = position_ids.unsqueeze(0)
415
+
416
+ if inputs_embeds is None:
417
+ inputs_embeds = self.embed_tokens(input_ids)
418
+
419
+ # 2d mask is passed through the layers
420
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
421
+
422
+ # embed positions
423
+ hidden_states = inputs_embeds
424
+
425
+ # decoder layers
426
+ all_hidden_states = () if output_hidden_states else None
427
+ all_self_attns = None
428
+ next_decoder_cache = None
429
+
430
+ for decoder_layer in self.layers:
431
+ if output_hidden_states:
432
+ all_hidden_states += (hidden_states,)
433
+
434
+ if self.gradient_checkpointing and self.training:
435
+ def create_custom_forward(module):
436
+ def custom_forward(*inputs):
437
+ return module(*inputs, use_cache=use_cache)
438
+ return custom_forward
439
+ layer_outputs = torch.utils.checkpoint.checkpoint(
440
+ create_custom_forward(decoder_layer),
441
+ hidden_states,
442
+ attention_mask,
443
+ None,
444
+ )
445
+ else:
446
+ layer_outputs = decoder_layer(
447
+ hidden_states,
448
+ attention_mask=attention_mask,
449
+ position_ids=position_ids,
450
+ past_key_value=past_key_values,
451
+ use_cache=use_cache,
452
+ )
453
+
454
+ hidden_states = layer_outputs[0]
455
+
456
+ if use_cache:
457
+ next_decoder_cache = layer_outputs[1]
458
+
459
+ hidden_states = self.norm(hidden_states)
460
+
461
+ # add hidden states from the last decoder layer
462
+ if output_hidden_states:
463
+ all_hidden_states += (hidden_states,)
464
+
465
+ next_cache = None
466
+ if use_cache:
467
+ next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
468
+ if not return_dict:
469
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
470
+ return BaseModelOutputWithPast(
471
+ last_hidden_state=hidden_states,
472
+ past_key_values=next_cache,
473
+ hidden_states=all_hidden_states,
474
+ attentions=all_self_attns,
475
+ )
476
+
477
+
478
+ class JiutianForCausalLM(JiutianPreTrainedModel):
479
+ def __init__(self, config):
480
+ super().__init__(config)
481
+ self.model = JiutianModel(config)
482
+ self.vocab_size = config.vocab_size
483
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
484
+ # Initialize weights and apply final processing
485
+ self.post_init()
486
+
487
+ def get_input_embeddings(self):
488
+ return self.model.embed_tokens
489
+
490
+ def set_input_embeddings(self, value):
491
+ self.model.embed_tokens = value
492
+
493
+ def get_output_embeddings(self):
494
+ return self.lm_head
495
+
496
+ def set_output_embeddings(self, new_embeddings):
497
+ self.lm_head = new_embeddings
498
+
499
+ def set_decoder(self, decoder):
500
+ self.model = decoder
501
+
502
+ def get_decoder(self):
503
+ return self.model
504
+
505
+ def forward(
506
+ self,
507
+ input_ids: torch.LongTensor = None,
508
+ attention_mask: Optional[torch.Tensor] = None,
509
+ position_ids: Optional[torch.LongTensor] = None,
510
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
511
+ inputs_embeds: Optional[torch.FloatTensor] = None,
512
+ labels: Optional[torch.LongTensor] = None,
513
+ use_cache: Optional[bool] = None,
514
+ output_attentions: Optional[bool] = None,
515
+ output_hidden_states: Optional[bool] = None,
516
+ return_dict: Optional[bool] = None,
517
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
518
+
519
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
520
+
521
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
522
+ outputs = self.model(
523
+ input_ids=input_ids,
524
+ attention_mask=attention_mask,
525
+ position_ids=position_ids,
526
+ past_key_values=past_key_values,
527
+ inputs_embeds=inputs_embeds,
528
+ use_cache=use_cache,
529
+ output_hidden_states=output_hidden_states,
530
+ return_dict=return_dict,
531
+ )
532
+ hidden_states = outputs[0]
533
+ logits = self.lm_head(hidden_states)
534
+ logits = logits.float()
535
+
536
+ loss = None
537
+ if labels is not None:
538
+ shift_logits = logits[..., :-1, :].contiguous()
539
+ shift_labels = labels[..., 1:].contiguous()
540
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
541
+ shift_labels = shift_labels.view(-1)
542
+ shift_labels = shift_labels.to(shift_logits.device)
543
+ loss_fct = CrossEntropyLoss()
544
+ loss = loss_fct(shift_logits, shift_labels)
545
+
546
+ if not return_dict:
547
+ output = (logits,) + outputs[1:]
548
+ return (loss,) + output if loss is not None else output
549
+
550
+ return CausalLMOutputWithPast(
551
+ loss=loss,
552
+ logits=logits,
553
+ past_key_values=outputs.past_key_values,
554
+ hidden_states=outputs.hidden_states,
555
+ attentions=outputs.attentions,
556
+ )
557
+
558
+ def prepare_inputs_for_generation(
559
+ self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
560
+ ):
561
+ if past_key_values is not None:
562
+ if isinstance(past_key_values, Cache):
563
+ cache_length = past_key_values.get_seq_length()
564
+ past_length = past_key_values.seen_tokens
565
+ max_cache_length = past_key_values.get_max_length()
566
+ else:
567
+ cache_length = past_length = past_key_values[0][0].shape[2]
568
+ max_cache_length = None
569
+
570
+ # Keep only the unprocessed tokens:
571
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
572
+ # some of the inputs are exclusivelly passed as part of the cache (e.g. when passing input_embeds as
573
+ # input)
574
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
575
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
576
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
577
+ # input_ids based on the past_length.
578
+ elif past_length < input_ids.shape[1]:
579
+ input_ids = input_ids[:, past_length:]
580
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
581
+
582
+ # If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
583
+ if (
584
+ max_cache_length is not None
585
+ and attention_mask is not None
586
+ and cache_length + input_ids.shape[1] > max_cache_length
587
+ ):
588
+ attention_mask = attention_mask[:, -max_cache_length:]
589
+
590
+ position_ids = kwargs.get("position_ids", None)
591
+ if attention_mask is not None and position_ids is None:
592
+ # create position_ids on the fly for batch generation
593
+ position_ids = attention_mask.long().cumsum(-1) - 1
594
+ position_ids.masked_fill_(attention_mask == 0, 1)
595
+ if past_key_values:
596
+ position_ids = position_ids[:, -input_ids.shape[1] :]
597
+
598
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
599
+ if inputs_embeds is not None and past_key_values is None:
600
+ model_inputs = {"inputs_embeds": inputs_embeds}
601
+ else:
602
+ model_inputs = {"input_ids": input_ids}
603
+
604
+ model_inputs.update(
605
+ {
606
+ "position_ids": position_ids,
607
+ "past_key_values": past_key_values,
608
+ "use_cache": kwargs.get("use_cache"),
609
+ "attention_mask": attention_mask,
610
+ }
611
+ )
612
+ return model_inputs
613
+
614
+ @staticmethod
615
+ def _reorder_cache(past_key_values, beam_idx):
616
+ reordered_past = ()
617
+ for layer_past in past_key_values:
618
+ reordered_past += (
619
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
620
+ )
621
+ return reordered_past
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 15645679616
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00004-of-00004.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00004.bin",
8
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
9
+ "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
10
+ "model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
11
+ "model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
12
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
13
+ "model.layers.0.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
14
+ "model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
15
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
16
+ "model.layers.0.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
17
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
18
+ "model.layers.0.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
19
+ "model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
20
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
21
+ "model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
22
+ "model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
23
+ "model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
24
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
25
+ "model.layers.1.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
26
+ "model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
27
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
28
+ "model.layers.1.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
29
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
30
+ "model.layers.1.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
31
+ "model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
32
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
33
+ "model.layers.10.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
34
+ "model.layers.10.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
35
+ "model.layers.10.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
36
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
37
+ "model.layers.10.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
38
+ "model.layers.10.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
39
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
40
+ "model.layers.10.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
41
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
42
+ "model.layers.10.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
43
+ "model.layers.10.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
44
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
45
+ "model.layers.11.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
46
+ "model.layers.11.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
47
+ "model.layers.11.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
48
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
49
+ "model.layers.11.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
50
+ "model.layers.11.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
51
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
52
+ "model.layers.11.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
53
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
54
+ "model.layers.11.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
55
+ "model.layers.11.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
56
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
57
+ "model.layers.12.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
58
+ "model.layers.12.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
59
+ "model.layers.12.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
60
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
61
+ "model.layers.12.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
62
+ "model.layers.12.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
63
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
64
+ "model.layers.12.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
65
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
66
+ "model.layers.12.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
67
+ "model.layers.12.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
68
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
69
+ "model.layers.13.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
70
+ "model.layers.13.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
71
+ "model.layers.13.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
72
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
73
+ "model.layers.13.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
74
+ "model.layers.13.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
75
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
76
+ "model.layers.13.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
77
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
78
+ "model.layers.13.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
79
+ "model.layers.13.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
80
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
81
+ "model.layers.14.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
82
+ "model.layers.14.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
83
+ "model.layers.14.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
84
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
85
+ "model.layers.14.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
86
+ "model.layers.14.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
87
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
88
+ "model.layers.14.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
89
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
90
+ "model.layers.14.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
91
+ "model.layers.14.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
92
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
93
+ "model.layers.15.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
94
+ "model.layers.15.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
95
+ "model.layers.15.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
96
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
97
+ "model.layers.15.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
98
+ "model.layers.15.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
99
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
100
+ "model.layers.15.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
101
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
102
+ "model.layers.15.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
103
+ "model.layers.15.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
104
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
105
+ "model.layers.16.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
106
+ "model.layers.16.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
107
+ "model.layers.16.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
108
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
109
+ "model.layers.16.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
110
+ "model.layers.16.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
111
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
112
+ "model.layers.16.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
113
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
114
+ "model.layers.16.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
115
+ "model.layers.16.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
116
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
117
+ "model.layers.17.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
118
+ "model.layers.17.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
119
+ "model.layers.17.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
120
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
121
+ "model.layers.17.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
122
+ "model.layers.17.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
123
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
124
+ "model.layers.17.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
125
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
126
+ "model.layers.17.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
127
+ "model.layers.17.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
128
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
129
+ "model.layers.18.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
130
+ "model.layers.18.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
131
+ "model.layers.18.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
132
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
133
+ "model.layers.18.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
134
+ "model.layers.18.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
135
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
136
+ "model.layers.18.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
137
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
138
+ "model.layers.18.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
139
+ "model.layers.18.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
140
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
141
+ "model.layers.19.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
142
+ "model.layers.19.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
143
+ "model.layers.19.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
144
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
145
+ "model.layers.19.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
146
+ "model.layers.19.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
147
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
148
+ "model.layers.19.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
149
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
150
+ "model.layers.19.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
151
+ "model.layers.19.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
152
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
153
+ "model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
154
+ "model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
155
+ "model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
156
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
157
+ "model.layers.2.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
158
+ "model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
159
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
160
+ "model.layers.2.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
161
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
162
+ "model.layers.2.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
163
+ "model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
164
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
165
+ "model.layers.20.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
166
+ "model.layers.20.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
167
+ "model.layers.20.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
168
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
169
+ "model.layers.20.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
170
+ "model.layers.20.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
171
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
172
+ "model.layers.20.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
173
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
174
+ "model.layers.20.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
175
+ "model.layers.20.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
176
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
177
+ "model.layers.21.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
178
+ "model.layers.21.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
179
+ "model.layers.21.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
180
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
181
+ "model.layers.21.self_attn.k_proj.bias": "pytorch_model-00002-of-00004.bin",
182
+ "model.layers.21.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
183
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
184
+ "model.layers.21.self_attn.q_proj.bias": "pytorch_model-00002-of-00004.bin",
185
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
186
+ "model.layers.21.self_attn.v_proj.bias": "pytorch_model-00002-of-00004.bin",
187
+ "model.layers.21.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
188
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
189
+ "model.layers.22.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
190
+ "model.layers.22.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
191
+ "model.layers.22.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
192
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
193
+ "model.layers.22.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
194
+ "model.layers.22.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
195
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
196
+ "model.layers.22.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
197
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
198
+ "model.layers.22.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
199
+ "model.layers.22.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
200
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
201
+ "model.layers.23.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
202
+ "model.layers.23.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
203
+ "model.layers.23.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
204
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
205
+ "model.layers.23.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
206
+ "model.layers.23.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
207
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
208
+ "model.layers.23.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
209
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
210
+ "model.layers.23.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
211
+ "model.layers.23.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
212
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
213
+ "model.layers.24.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
214
+ "model.layers.24.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
215
+ "model.layers.24.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
216
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
217
+ "model.layers.24.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
218
+ "model.layers.24.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
219
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
220
+ "model.layers.24.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
221
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
222
+ "model.layers.24.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
223
+ "model.layers.24.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
224
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
225
+ "model.layers.25.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
226
+ "model.layers.25.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
227
+ "model.layers.25.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
228
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
229
+ "model.layers.25.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
230
+ "model.layers.25.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
231
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
232
+ "model.layers.25.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
233
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
234
+ "model.layers.25.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
235
+ "model.layers.25.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
236
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
237
+ "model.layers.26.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
238
+ "model.layers.26.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
239
+ "model.layers.26.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
240
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
241
+ "model.layers.26.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
242
+ "model.layers.26.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
243
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
244
+ "model.layers.26.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
245
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
246
+ "model.layers.26.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
247
+ "model.layers.26.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
248
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
249
+ "model.layers.27.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
250
+ "model.layers.27.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
251
+ "model.layers.27.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
252
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
253
+ "model.layers.27.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
254
+ "model.layers.27.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
255
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
256
+ "model.layers.27.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
257
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
258
+ "model.layers.27.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
259
+ "model.layers.27.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
260
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
261
+ "model.layers.28.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
262
+ "model.layers.28.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
263
+ "model.layers.28.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
264
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
265
+ "model.layers.28.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
266
+ "model.layers.28.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
267
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
268
+ "model.layers.28.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
269
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
270
+ "model.layers.28.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
271
+ "model.layers.28.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
272
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
273
+ "model.layers.29.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
274
+ "model.layers.29.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
275
+ "model.layers.29.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
276
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
277
+ "model.layers.29.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
278
+ "model.layers.29.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
279
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
280
+ "model.layers.29.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
281
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
282
+ "model.layers.29.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
283
+ "model.layers.29.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
284
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
285
+ "model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
286
+ "model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
287
+ "model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
288
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
289
+ "model.layers.3.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
290
+ "model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
291
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
292
+ "model.layers.3.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
293
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
294
+ "model.layers.3.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
295
+ "model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
296
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
297
+ "model.layers.30.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
298
+ "model.layers.30.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
299
+ "model.layers.30.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
300
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
301
+ "model.layers.30.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
302
+ "model.layers.30.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
303
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
304
+ "model.layers.30.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
305
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
306
+ "model.layers.30.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
307
+ "model.layers.30.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
308
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
309
+ "model.layers.31.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
310
+ "model.layers.31.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
311
+ "model.layers.31.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
312
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
313
+ "model.layers.31.self_attn.k_proj.bias": "pytorch_model-00003-of-00004.bin",
314
+ "model.layers.31.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
315
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
316
+ "model.layers.31.self_attn.q_proj.bias": "pytorch_model-00003-of-00004.bin",
317
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
318
+ "model.layers.31.self_attn.v_proj.bias": "pytorch_model-00003-of-00004.bin",
319
+ "model.layers.31.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
320
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
321
+ "model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
322
+ "model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
323
+ "model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
324
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
325
+ "model.layers.4.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
326
+ "model.layers.4.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
327
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
328
+ "model.layers.4.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
329
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
330
+ "model.layers.4.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
331
+ "model.layers.4.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
332
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
333
+ "model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
334
+ "model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
335
+ "model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
336
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
337
+ "model.layers.5.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
338
+ "model.layers.5.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
339
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
340
+ "model.layers.5.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
341
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
342
+ "model.layers.5.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
343
+ "model.layers.5.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
344
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
345
+ "model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
346
+ "model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
347
+ "model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
348
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
349
+ "model.layers.6.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
350
+ "model.layers.6.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
351
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
352
+ "model.layers.6.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
353
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
354
+ "model.layers.6.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
355
+ "model.layers.6.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
356
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
357
+ "model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
358
+ "model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
359
+ "model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
360
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
361
+ "model.layers.7.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
362
+ "model.layers.7.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
363
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
364
+ "model.layers.7.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
365
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
366
+ "model.layers.7.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
367
+ "model.layers.7.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
368
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
369
+ "model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
370
+ "model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
371
+ "model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
372
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
373
+ "model.layers.8.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
374
+ "model.layers.8.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
375
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
376
+ "model.layers.8.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
377
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
378
+ "model.layers.8.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
379
+ "model.layers.8.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
380
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
381
+ "model.layers.9.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
382
+ "model.layers.9.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
383
+ "model.layers.9.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
384
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
385
+ "model.layers.9.self_attn.k_proj.bias": "pytorch_model-00001-of-00004.bin",
386
+ "model.layers.9.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
387
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
388
+ "model.layers.9.self_attn.q_proj.bias": "pytorch_model-00001-of-00004.bin",
389
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
390
+ "model.layers.9.self_attn.v_proj.bias": "pytorch_model-00001-of-00004.bin",
391
+ "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
392
+ "model.norm.weight": "pytorch_model-00003-of-00004.bin"
393
+ }
394
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8c6ebc13d608c51bf7b628339948e92e58981c4c30f34299b8b3795cbdcc856
3
+ size 11422290
tokenizer_config.json ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<|begin_of_thought|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "<|end_of_thought|>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ }
197
+ },
198
+ "additional_special_tokens": [
199
+ "<|im_start|>",
200
+ "<|im_end|>",
201
+ "<|object_ref_start|>",
202
+ "<|object_ref_end|>",
203
+ "<|box_start|>",
204
+ "<|box_end|>",
205
+ "<|quad_start|>",
206
+ "<|quad_end|>",
207
+ "<|vision_start|>",
208
+ "<|vision_end|>",
209
+ "<|vision_pad|>",
210
+ "<|image_pad|>",
211
+ "<|video_pad|>"
212
+ ],
213
+ "bos_token": null,
214
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
215
+ "clean_up_tokenization_spaces": false,
216
+ "eos_token": "<|im_end|>",
217
+ "errors": "replace",
218
+ "extra_special_tokens": {},
219
+ "model_max_length": 131072,
220
+ "pad_token": "<|endoftext|>",
221
+ "padding_side": "right",
222
+ "split_special_tokens": false,
223
+ "tokenizer_class": "Qwen2Tokenizer",
224
+ "unk_token": null
225
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff