guoteng commited on
Commit
828053f
·
verified ·
1 Parent(s): e7a5df4

Upload folder using huggingface_hub

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% macro render_item_list(item_list, tag_name='required') %}
2
+ {%- if item_list is defined and item_list is iterable and item_list | length > 0 %}
3
+ {%- if tag_name %}{{- '\n<' ~ tag_name ~ '>' -}}{% endif %}
4
+ {{- '[' }}
5
+ {%- for item in item_list -%}
6
+ {%- if loop.index > 1 %}{{- ", "}}{% endif -%}
7
+ {%- if item is string -%}
8
+ {{ "`" ~ item ~ "`" }}
9
+ {%- else -%}
10
+ {{ item }}
11
+ {%- endif -%}
12
+ {%- endfor -%}
13
+ {{- ']' }}
14
+ {%- if tag_name %}{{- '</' ~ tag_name ~ '>' -}}{% endif %}
15
+ {%- endif %}
16
+ {% endmacro %}
17
+
18
+ {%- if not add_generation_prompt is defined %}
19
+ {% set add_generation_prompt = false %}
20
+ {%- endif %}
21
+
22
+ {%- set ns = namespace(is_first=false, system_prompt='You are Nex, a helpful assistant developed by Shanghai Innovation Institution and its entrepreneurial partners.', is_first_sp=true, is_last_user=false) %}
23
+ {%- for message in messages %}
24
+ {%- if message['role'] == 'system' %}
25
+ {%- if ns.is_first_sp %}
26
+ {% set ns.system_prompt = message['content'] %}
27
+ {% set ns.is_first_sp = false %}
28
+ {%- else %}
29
+ {% set ns.system_prompt = ns.system_prompt ~ '\n\n' ~ message['content'] %}
30
+ {%- endif %}
31
+ {%- endif %}
32
+ {%- endfor -%}
33
+
34
+ {%- if tools is defined and tools is not none %}
35
+ {% set tool_ns = namespace(text='You are a helpful assistant with tool calling capabilities. '
36
+ 'When a tool call is needed, you MUST use the following format to issue the call:\n\n'
37
+ '<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n'
38
+ 'IMPORTANT:\n'
39
+ '- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n'
40
+ '- Required parameters MUST be specified\n'
41
+ '- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n\n'
42
+ 'You have access to the following functions:\n\n'
43
+ '<tools>') %}
44
+ {% for tool in tools %}
45
+ {%- if tool.function is defined %}
46
+ {%- set tool = tool.function %}
47
+ {%- endif %}
48
+ {% set tool_ns.text = tool_ns.text ~ '\n<function>\n<name>' ~ tool.name ~ '</name>' %}
49
+ {% set tool_ns.text = tool_ns.text ~ '\n<description>' ~ (tool.description | trim) ~ '</description>' %}
50
+ {% set tool_ns.text = tool_ns.text ~ '\n<parameters>' %}
51
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
52
+ {% set tool_ns.text = tool_ns.text ~ '\n<parameter>' %}
53
+ {% set tool_ns.text = tool_ns.text ~ '\n<name>' ~ param_name ~ '</name>' %}
54
+ {%- if param_fields.type is defined %}
55
+ {% set tool_ns.text = tool_ns.text ~ '\n<type>' ~ (param_fields.type | string) ~ '</type>' %}
56
+ {%- endif %}
57
+ {%- if param_fields.description is defined %}
58
+ {% set tool_ns.text = tool_ns.text ~ '\n<description>' ~ (param_fields.description | trim) ~ '</description>' %}
59
+ {%- endif %}
60
+ {%- if param_fields.enum is defined and param_fields.enum is iterable and param_fields.enum | length > 0 %}
61
+ {% set tool_ns.text = tool_ns.text ~ render_item_list(param_fields.enum, 'enum') %}
62
+ {%- endif %}
63
+ {%- set handled_keys = ['type', 'description', 'enum', 'required'] %}
64
+ {%- for json_key in param_fields.keys() | reject("in", handled_keys) %}
65
+ {%- set normed_json_key = json_key | replace("-", "_") | replace(" ", "_") | replace("$", "") %}
66
+ {%- if param_fields[json_key] is mapping %}
67
+ {% set tool_ns.text = tool_ns.text ~ '\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | tojson | safe) ~ '</' ~ normed_json_key ~ '>' %}
68
+ {%- else %}
69
+ {% set tool_ns.text = tool_ns.text ~ '\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | string) ~ '</' ~ normed_json_key ~ '>' %}
70
+ {%- endif %}
71
+ {%- endfor %}
72
+ {%- if param_fields.required is defined and param_fields.required is iterable and param_fields.required | length > 0 %}
73
+ {% set tool_ns.text = tool_ns.text ~ render_item_list(param_fields.required, 'required') %}
74
+ {%- endif %}
75
+ {% set tool_ns.text = tool_ns.text ~ '\n</parameter>' %}
76
+ {%- endfor %}
77
+ {%- if tool.parameters.required is defined and tool.parameters.required is iterable and tool.parameters.required | length > 0 %}
78
+ {% set tool_ns.text = tool_ns.text ~ render_item_list(tool.parameters.required, 'required') %}
79
+ {%- endif %}
80
+ {% set tool_ns.text = tool_ns.text ~ '\n</parameters>' %}
81
+ {%- if tool.return is defined %}
82
+ {%- if tool.return is mapping %}
83
+ {% set tool_ns.text = tool_ns.text ~ '\n<return>' ~ (tool.return | tojson | safe) ~ '</return>' %}
84
+ {%- else %}
85
+ {% set tool_ns.text = tool_ns.text ~ '\n<return>' ~ (tool.return | string) ~ '</return>' %}
86
+ {%- endif %}
87
+ {%- endif %}
88
+ {% set tool_ns.text = tool_ns.text ~ '\n</function>' %}
89
+ {% endfor %}
90
+ {% set tool_ns.text = tool_ns.text ~ '\n</tools>' %}
91
+ {% set ns.system_prompt = ns.system_prompt ~ '\n\n' ~ tool_ns.text %}
92
+ {%- endif %}
93
+
94
+ {%- if ns.system_prompt %}
95
+ {{- '<|im_start|>system\n' ~ ns.system_prompt ~ '<|im_end|>\n' }}
96
+ {%- endif %}
97
+
98
+ {%- for message in messages %}
99
+ {% set content = message['content'] %}
100
+ {%- if content is none %}
101
+ {% set content = '' %}
102
+ {%- endif %}
103
+ {%- if message['role'] == 'user' %}
104
+ {%- set ns.is_first = false -%}
105
+ {%- set ns.is_last_user = true -%}
106
+ {{- '<|im_start|>user\n' ~ content ~ '<|im_end|>\n' }}
107
+ {%- endif %}
108
+ {%- if message['role'] == 'assistant' %}
109
+ {% if '</think>' in content %}
110
+ {% set content = content.split('</think>')[-1] %}
111
+ {% endif %}
112
+ {% endif %}
113
+ {%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}
114
+ {%- set ns.is_last_user = false -%}
115
+ {%- set ns.is_first = false %}
116
+ {{- '<|im_start|>assistant' }}
117
+ {%- if content is defined and content is not none and content | trim | length > 0 %}
118
+ {{- '\n' + content | trim + '\n' }}
119
+ {%- endif %}
120
+ {%- for tool in message['tool_calls'] %}
121
+ {%- if tool.function is defined %}
122
+ {%- set tool_call = tool.function %}
123
+ {%- else %}
124
+ {%- set tool_call = tool %}
125
+ {%- endif %}
126
+ {{- '\n<tool_call>\n<function=' ~ tool_call.name ~ '>\n' }}
127
+ {%- if tool_call.arguments is defined %}
128
+ {%- for args_name, args_value in tool_call.arguments|items %}
129
+ {{- '<parameter=' ~ args_name ~ '>\n' }}
130
+ {%- set args_value = args_value if args_value is string else args_value | string %}
131
+ {{- args_value }}
132
+ {{- '\n</parameter>\n' }}
133
+ {%- endfor %}
134
+ {%- endif %}
135
+ {{- '</function>\n</tool_call>' }}
136
+ {%- endfor %}
137
+ {{- '<|im_end|>\n'}}
138
+ {%- endif %}
139
+ {%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none)%}
140
+ {%- set ns.is_last_user = false -%}
141
+ {{- '<|im_start|>assistant\n' ~ content ~ '<|im_end|>\n'}}
142
+ {%- endif %}
143
+ {%- if message['role'] == 'tool' %}
144
+ {%- set ns.is_last_user = false -%}
145
+ {%- if loop.previtem and loop.previtem['role'] != 'tool' %}
146
+ {{- '<|im_start|>user\n' }}
147
+ {%- endif %}
148
+ {{- '<tool_response>\n' }}
149
+ {{- content }}
150
+ {{- '\n</tool_response>\n' }}
151
+ {%- if not loop.last and loop.nextitem['role'] != 'tool' %}
152
+ {{- '<|im_end|>\n' }}
153
+ {%- elif loop.last %}
154
+ {{- '<|im_end|>\n' }}
155
+ {%- endif %}
156
+ {%- endif %}
157
+ {%- endfor -%}
158
+ {% if add_generation_prompt %}
159
+ {{- '<|im_start|>assistant\n'}}
160
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "InternLM3ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_internlm3.InternLM3Config",
8
+ "AutoModel": "modeling_internlm3.InternLM3Model",
9
+ "AutoModelForCausalLM": "modeling_internlm3.InternLM3ForCausalLM"
10
+ },
11
+ "bias": false,
12
+ "bos_token_id": 1,
13
+ "eos_token_id": [
14
+ 2,
15
+ 128131,
16
+ 128129
17
+ ],
18
+ "head_dim": 128,
19
+ "hidden_act": "silu",
20
+ "hidden_size": 4096,
21
+ "initializer_range": 0.02,
22
+ "intermediate_size": 10240,
23
+ "max_position_embeddings": 131072,
24
+ "model_type": "internlm3",
25
+ "num_attention_heads": 32,
26
+ "num_hidden_layers": 48,
27
+ "num_key_value_heads": 2,
28
+ "pad_token_id": 2,
29
+ "qkv_bias": false,
30
+ "rms_norm_eps": 1e-05,
31
+ "rope_scaling": {
32
+ "factor": 6.0,
33
+ "rope_type": "dynamic"
34
+ },
35
+ "rope_theta": 50000000,
36
+ "tie_word_embeddings": false,
37
+ "torch_dtype": "bfloat16",
38
+ "transformers_version": "4.47.1",
39
+ "use_cache": true,
40
+ "vocab_size": 128512
41
+ }
configuration_internlm3.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright (c) The InternLM team and The HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # This code is based on transformers/src/transformers/models/llama/configuration_llama.py
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ """ InternLM3 model configuration"""
18
+
19
+ from transformers.configuration_utils import PretrainedConfig
20
+ from transformers.modeling_rope_utils import rope_config_validation
21
+ from transformers.utils import logging
22
+
23
+
24
+ logger = logging.get_logger(__name__)
25
+
26
+
27
+ class InternLM3Config(PretrainedConfig):
28
+ r"""
29
+ This is the configuration class to store the configuration of a [`InternLM2Model`]. It is used to instantiate
30
+ an InternLM2 model according to the specified arguments, defining the model architecture. Instantiating a
31
+ configuration with the defaults will yield a similar configuration to that of the InternLM2-7B.
32
+
33
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
34
+ documentation from [`PretrainedConfig`] for more information.
35
+
36
+
37
+ Args:
38
+ vocab_size (`int`, *optional*, defaults to 151936):
39
+ Vocabulary size of the InternLM3 model. Defines the number of different tokens that can be represented by the
40
+ `inputs_ids` passed when calling [`InternLM3Model`]
41
+ hidden_size (`int`, *optional*, defaults to 4096):
42
+ Dimension of the hidden representations.
43
+ intermediate_size (`int`, *optional*, defaults to 22016):
44
+ Dimension of the MLP representations.
45
+ num_hidden_layers (`int`, *optional*, defaults to 32):
46
+ Number of hidden layers in the Transformer encoder.
47
+ num_attention_heads (`int`, *optional*, defaults to 32):
48
+ Number of attention heads for each attention layer in the Transformer encoder.
49
+ num_key_value_heads (`int`, *optional*, defaults to 32):
50
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
51
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
52
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
53
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
54
+ by meanpooling all the original heads within that group. For more details checkout [this
55
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
56
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
57
+ The non-linear activation function (function or string) in the decoder.
58
+ max_position_embeddings (`int`, *optional*, defaults to 32768):
59
+ The maximum sequence length that this model might ever be used with.
60
+ initializer_range (`float`, *optional*, defaults to 0.02):
61
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
62
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
63
+ The epsilon used by the rms normalization layers.
64
+ use_cache (`bool`, *optional*, defaults to `True`):
65
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
66
+ relevant if `config.is_decoder=True`.
67
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
68
+ Whether the model's input and output word embeddings should be tied.
69
+ rope_theta (`float`, *optional*, defaults to 10000.0):
70
+ The base period of the RoPE embeddings.
71
+ rope_scaling (`Dict`, *optional*):
72
+ Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
73
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
74
+ accordingly.
75
+ Expected contents:
76
+ `rope_type` (`str`):
77
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
78
+ 'llama3'], with 'default' being the original RoPE implementation.
79
+ `factor` (`float`, *optional*):
80
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
81
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
82
+ original maximum pre-trained length.
83
+ `original_max_position_embeddings` (`int`, *optional*):
84
+ Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
85
+ pretraining.
86
+ `attention_factor` (`float`, *optional*):
87
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
88
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
89
+ `factor` field to infer the suggested value.
90
+ `beta_fast` (`float`, *optional*):
91
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
92
+ ramp function. If unspecified, it defaults to 32.
93
+ `beta_slow` (`float`, *optional*):
94
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
95
+ ramp function. If unspecified, it defaults to 1.
96
+ `short_factor` (`List[float]`, *optional*):
97
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
98
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
99
+ size divided by the number of attention heads divided by 2
100
+ `long_factor` (`List[float]`, *optional*):
101
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
102
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
103
+ size divided by the number of attention heads divided by 2
104
+ `low_freq_factor` (`float`, *optional*):
105
+ Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
106
+ `high_freq_factor` (`float`, *optional*):
107
+ Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
108
+ qkv_bias (`bool`, *optional*, defaults to `False`):
109
+ Whether to use a bias in the query, key and value projection layers during self-attention.
110
+ attention_dropout (`float`, *optional*, defaults to 0.0):
111
+ The dropout ratio for the attention probabilities.
112
+ bias (`bool`, *optional*, defaults to `False`):
113
+ Whether to use a bias in o_proj, up_proj, down_proj and gate_proj layers.
114
+ head_dim (`int`, *optional*):
115
+ The attention head dimension. If None, it will default to hidden_size // num_heads
116
+
117
+ ```python
118
+ >>> from transformers import InternLM3Model, InternLM3Config
119
+
120
+ >>> # Initializing a InternLM3 style configuration
121
+ >>> configuration = InternLM3Config()
122
+
123
+ >>> # Initializing a model from the InternLM3-8B style configuration
124
+ >>> model = InternLM3Model(configuration)
125
+
126
+ >>> # Accessing the model configuration
127
+ >>> configuration = model.config
128
+ ```"""
129
+
130
+ model_type = "internlm3"
131
+ keys_to_ignore_at_inference = ["past_key_values"]
132
+
133
+ # Default tensor parallel plan for base model `InternLM3`
134
+ base_model_tp_plan = {
135
+ "layers.*.self_attn.q_proj": "colwise",
136
+ "layers.*.self_attn.k_proj": "colwise",
137
+ "layers.*.self_attn.v_proj": "colwise",
138
+ "layers.*.self_attn.o_proj": "rowwise",
139
+ "layers.*.mlp.gate_proj": "colwise",
140
+ "layers.*.mlp.up_proj": "colwise",
141
+ "layers.*.mlp.down_proj": "rowwise",
142
+ }
143
+
144
+ def __init__(
145
+ self,
146
+ vocab_size=128512,
147
+ hidden_size=4096,
148
+ intermediate_size=11008,
149
+ num_hidden_layers=32,
150
+ num_attention_heads=32,
151
+ num_key_value_heads=32,
152
+ hidden_act="silu",
153
+ max_position_embeddings=32768,
154
+ initializer_range=0.02,
155
+ rms_norm_eps=1e-6,
156
+ use_cache=True,
157
+ tie_word_embeddings=False,
158
+ rope_theta=10000.0,
159
+ rope_scaling=None,
160
+ qkv_bias=False,
161
+ attention_dropout=0.0,
162
+ bias=False,
163
+ head_dim=None,
164
+ **kwargs,
165
+ ):
166
+ self.vocab_size = vocab_size
167
+ self.max_position_embeddings = max_position_embeddings
168
+ self.hidden_size = hidden_size
169
+ self.intermediate_size = intermediate_size
170
+ self.num_hidden_layers = num_hidden_layers
171
+ self.num_attention_heads = num_attention_heads
172
+
173
+ # for backward compatibility
174
+ if num_key_value_heads is None:
175
+ num_key_value_heads = num_attention_heads
176
+
177
+ self.num_key_value_heads = num_key_value_heads
178
+ self.hidden_act = hidden_act
179
+ self.initializer_range = initializer_range
180
+ self.rms_norm_eps = rms_norm_eps
181
+ self.use_cache = use_cache
182
+ self.rope_theta = rope_theta
183
+ self.rope_scaling = rope_scaling
184
+ self.qkv_bias = qkv_bias
185
+ self.attention_dropout = attention_dropout
186
+ self.bias = bias
187
+ self.head_dim = head_dim if head_dim is not None else self.hidden_size // self.num_attention_heads
188
+ # Validate the correctness of rotary position embeddings parameters
189
+ # BC: if there is a 'type' field, move it to 'rope_type'.
190
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
191
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
192
+ rope_config_validation(self)
193
+
194
+ super().__init__(
195
+ tie_word_embeddings=tie_word_embeddings,
196
+ **kwargs,
197
+ )
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "4.47.1"
7
+ }
model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e28ee05a0b63d7913996bc1d219b13385fa20813cfa92b5fead99bbcf74535d
3
+ size 4999820088
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0be81604dcef205a264dc3721c7016fca7c9ffcee306a10d1795fff0598df46
3
+ size 4928568784
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50407dba2bf0a72ac0ea640fe634ebe6e2c33c2727c1ba8398ad12f9c1641341
3
+ size 4928568784
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd243f94aae95bb1871f1ae4ecf2d01eaf2e41c385fc8bcd22c4e22e87d35748
3
+ size 2751575736
model.safetensors.index.json ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 17608482816
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00004-of-00004.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00004.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
13
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
14
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
15
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
16
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
17
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
18
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
19
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
20
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
21
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
22
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
23
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
24
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
25
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
26
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00004.safetensors",
27
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
28
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
29
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
30
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
31
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
32
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
33
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
34
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
35
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00004.safetensors",
36
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
37
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
38
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
39
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
40
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
41
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
42
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
43
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
44
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
45
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
46
+ "model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
47
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
48
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
49
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
50
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
51
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
52
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
53
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
54
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
55
+ "model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
56
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
57
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
58
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
59
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
60
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
61
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
62
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
63
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
64
+ "model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
65
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
66
+ "model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
67
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
68
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
69
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
70
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
71
+ "model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
72
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
73
+ "model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
74
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
75
+ "model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
76
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
77
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
78
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
79
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
80
+ "model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
81
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
82
+ "model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
83
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
84
+ "model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
85
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
86
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
87
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
88
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
89
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
90
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
91
+ "model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
92
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
93
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
94
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
95
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
96
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
97
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
98
+ "model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors",
99
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
100
+ "model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
101
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
102
+ "model.layers.18.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
103
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
104
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
105
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
106
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
107
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00004.safetensors",
108
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
109
+ "model.layers.19.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
110
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
111
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
112
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
113
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
114
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
115
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
116
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
117
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
118
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
119
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
120
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
121
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
122
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
123
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
124
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
125
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00004.safetensors",
126
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
127
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
128
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
129
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
130
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
131
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
132
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
133
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
134
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00004.safetensors",
135
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
136
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
137
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
138
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
139
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
140
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
141
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
142
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
143
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00004.safetensors",
144
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
145
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
146
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
147
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
148
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
149
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
150
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
151
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
152
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00004.safetensors",
153
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
154
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
155
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
156
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
157
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
158
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
159
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
160
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
161
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00004.safetensors",
162
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
163
+ "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
164
+ "model.layers.24.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
165
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
166
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
167
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
168
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
169
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
170
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00004.safetensors",
171
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
172
+ "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
173
+ "model.layers.25.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
174
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
175
+ "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
176
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
177
+ "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
178
+ "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
179
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00004.safetensors",
180
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
181
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
182
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
183
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
184
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
185
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
186
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
187
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
188
+ "model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
189
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
190
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
191
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
192
+ "model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
193
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
194
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
195
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
196
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
197
+ "model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors",
198
+ "model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
199
+ "model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
200
+ "model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
201
+ "model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
202
+ "model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
203
+ "model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
204
+ "model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
205
+ "model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
206
+ "model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors",
207
+ "model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
208
+ "model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
209
+ "model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
210
+ "model.layers.29.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
211
+ "model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
212
+ "model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
213
+ "model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
214
+ "model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
215
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
216
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
217
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
218
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
219
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
220
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
221
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
222
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
223
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
224
+ "model.layers.30.input_layernorm.weight": "model-00003-of-00004.safetensors",
225
+ "model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
226
+ "model.layers.30.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
227
+ "model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
228
+ "model.layers.30.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
229
+ "model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
230
+ "model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
231
+ "model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
232
+ "model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
233
+ "model.layers.31.input_layernorm.weight": "model-00003-of-00004.safetensors",
234
+ "model.layers.31.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
235
+ "model.layers.31.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
236
+ "model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
237
+ "model.layers.31.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
238
+ "model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
239
+ "model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
240
+ "model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
241
+ "model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
242
+ "model.layers.32.input_layernorm.weight": "model-00003-of-00004.safetensors",
243
+ "model.layers.32.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
244
+ "model.layers.32.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
245
+ "model.layers.32.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
246
+ "model.layers.32.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
247
+ "model.layers.32.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
248
+ "model.layers.32.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
249
+ "model.layers.32.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
250
+ "model.layers.32.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
251
+ "model.layers.33.input_layernorm.weight": "model-00003-of-00004.safetensors",
252
+ "model.layers.33.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
253
+ "model.layers.33.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
254
+ "model.layers.33.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
255
+ "model.layers.33.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
256
+ "model.layers.33.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
257
+ "model.layers.33.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
258
+ "model.layers.33.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
259
+ "model.layers.33.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
260
+ "model.layers.34.input_layernorm.weight": "model-00003-of-00004.safetensors",
261
+ "model.layers.34.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
262
+ "model.layers.34.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
263
+ "model.layers.34.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
264
+ "model.layers.34.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
265
+ "model.layers.34.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
266
+ "model.layers.34.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
267
+ "model.layers.34.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
268
+ "model.layers.34.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
269
+ "model.layers.35.input_layernorm.weight": "model-00003-of-00004.safetensors",
270
+ "model.layers.35.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
271
+ "model.layers.35.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
272
+ "model.layers.35.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
273
+ "model.layers.35.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
274
+ "model.layers.35.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
275
+ "model.layers.35.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
276
+ "model.layers.35.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
277
+ "model.layers.35.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
278
+ "model.layers.36.input_layernorm.weight": "model-00003-of-00004.safetensors",
279
+ "model.layers.36.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
280
+ "model.layers.36.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
281
+ "model.layers.36.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
282
+ "model.layers.36.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
283
+ "model.layers.36.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
284
+ "model.layers.36.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
285
+ "model.layers.36.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
286
+ "model.layers.36.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
287
+ "model.layers.37.input_layernorm.weight": "model-00003-of-00004.safetensors",
288
+ "model.layers.37.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
289
+ "model.layers.37.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
290
+ "model.layers.37.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
291
+ "model.layers.37.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
292
+ "model.layers.37.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
293
+ "model.layers.37.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
294
+ "model.layers.37.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
295
+ "model.layers.37.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
296
+ "model.layers.38.input_layernorm.weight": "model-00003-of-00004.safetensors",
297
+ "model.layers.38.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
298
+ "model.layers.38.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
299
+ "model.layers.38.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
300
+ "model.layers.38.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
301
+ "model.layers.38.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
302
+ "model.layers.38.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
303
+ "model.layers.38.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
304
+ "model.layers.38.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
305
+ "model.layers.39.input_layernorm.weight": "model-00003-of-00004.safetensors",
306
+ "model.layers.39.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
307
+ "model.layers.39.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
308
+ "model.layers.39.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
309
+ "model.layers.39.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
310
+ "model.layers.39.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
311
+ "model.layers.39.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
312
+ "model.layers.39.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
313
+ "model.layers.39.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
314
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
315
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
316
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
317
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
318
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
319
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
320
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
321
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
322
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
323
+ "model.layers.40.input_layernorm.weight": "model-00003-of-00004.safetensors",
324
+ "model.layers.40.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
325
+ "model.layers.40.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
326
+ "model.layers.40.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
327
+ "model.layers.40.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
328
+ "model.layers.40.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
329
+ "model.layers.40.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
330
+ "model.layers.40.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
331
+ "model.layers.40.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
332
+ "model.layers.41.input_layernorm.weight": "model-00003-of-00004.safetensors",
333
+ "model.layers.41.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
334
+ "model.layers.41.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
335
+ "model.layers.41.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
336
+ "model.layers.41.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
337
+ "model.layers.41.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
338
+ "model.layers.41.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
339
+ "model.layers.41.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
340
+ "model.layers.41.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
341
+ "model.layers.42.input_layernorm.weight": "model-00004-of-00004.safetensors",
342
+ "model.layers.42.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
343
+ "model.layers.42.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
344
+ "model.layers.42.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
345
+ "model.layers.42.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
346
+ "model.layers.42.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
347
+ "model.layers.42.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
348
+ "model.layers.42.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
349
+ "model.layers.42.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
350
+ "model.layers.43.input_layernorm.weight": "model-00004-of-00004.safetensors",
351
+ "model.layers.43.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
352
+ "model.layers.43.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
353
+ "model.layers.43.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
354
+ "model.layers.43.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
355
+ "model.layers.43.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
356
+ "model.layers.43.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
357
+ "model.layers.43.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
358
+ "model.layers.43.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
359
+ "model.layers.44.input_layernorm.weight": "model-00004-of-00004.safetensors",
360
+ "model.layers.44.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
361
+ "model.layers.44.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
362
+ "model.layers.44.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
363
+ "model.layers.44.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
364
+ "model.layers.44.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
365
+ "model.layers.44.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
366
+ "model.layers.44.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
367
+ "model.layers.44.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
368
+ "model.layers.45.input_layernorm.weight": "model-00004-of-00004.safetensors",
369
+ "model.layers.45.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
370
+ "model.layers.45.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
371
+ "model.layers.45.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
372
+ "model.layers.45.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
373
+ "model.layers.45.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
374
+ "model.layers.45.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
375
+ "model.layers.45.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
376
+ "model.layers.45.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
377
+ "model.layers.46.input_layernorm.weight": "model-00004-of-00004.safetensors",
378
+ "model.layers.46.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
379
+ "model.layers.46.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
380
+ "model.layers.46.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
381
+ "model.layers.46.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
382
+ "model.layers.46.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
383
+ "model.layers.46.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
384
+ "model.layers.46.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
385
+ "model.layers.46.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
386
+ "model.layers.47.input_layernorm.weight": "model-00004-of-00004.safetensors",
387
+ "model.layers.47.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
388
+ "model.layers.47.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
389
+ "model.layers.47.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
390
+ "model.layers.47.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
391
+ "model.layers.47.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
392
+ "model.layers.47.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
393
+ "model.layers.47.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
394
+ "model.layers.47.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
395
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
396
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
397
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
398
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
399
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
400
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
401
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
402
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
403
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
404
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
405
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
406
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
407
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
408
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
409
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
410
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
411
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
412
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
413
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
414
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
415
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
416
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
417
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
418
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
419
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
420
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
421
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
422
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00004.safetensors",
423
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
424
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
425
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
426
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
427
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
428
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
429
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
430
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
431
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00004.safetensors",
432
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
433
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
434
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
435
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
436
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
437
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
438
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
439
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
440
+ "model.norm.weight": "model-00004-of-00004.safetensors"
441
+ }
442
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|action_start|>",
6
+ "<|action_end|>",
7
+ "<|interpreter|>",
8
+ "<|plugin|>",
9
+ "<restate>",
10
+ "</restate>",
11
+ "<planning>",
12
+ "</planning>",
13
+ "<recollect>",
14
+ "</recollect>",
15
+ "<execution>",
16
+ "</execution>",
17
+ "<review>",
18
+ "</review>",
19
+ "<summarize>",
20
+ "</summarize>",
21
+ "<retry>",
22
+ "</retry>",
23
+ "<conclude>",
24
+ "</conclude>"
25
+ ],
26
+ "bos_token": {
27
+ "content": "<s>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ },
33
+ "eos_token": {
34
+ "content": "</s>",
35
+ "lstrip": false,
36
+ "normalized": false,
37
+ "rstrip": false,
38
+ "single_word": false
39
+ },
40
+ "pad_token": {
41
+ "content": "</s>",
42
+ "lstrip": false,
43
+ "normalized": false,
44
+ "rstrip": false,
45
+ "single_word": false
46
+ },
47
+ "unk_token": {
48
+ "content": "<unk>",
49
+ "lstrip": false,
50
+ "normalized": false,
51
+ "rstrip": false,
52
+ "single_word": false
53
+ }
54
+ }
tokenization_internlm3.py ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from shutil import copyfile
3
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
4
+
5
+ import sentencepiece as spm
6
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
7
+ from transformers.utils import logging
8
+
9
+ if TYPE_CHECKING:
10
+ from transformers.tokenization_utils_base import TextInput
11
+
12
+ logger = logging.get_logger(__name__)
13
+
14
+ VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
15
+
16
+ SPIECE_UNDERLINE = "▁"
17
+
18
+
19
+ class InternLM3Tokenizer(PreTrainedTokenizer):
20
+ """
21
+ Construct a InternLM3 tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
22
+ no padding token in the original model.
23
+
24
+ Args:
25
+ vocab_file (`str`):
26
+ Path to the vocabulary file.
27
+ unk_token (`str` or `tokenizers.AddedToken`, *optional*, defaults to `"<unk>"`):
28
+ The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
29
+ token instead.
30
+ bos_token (`str` or `tokenizers.AddedToken`, *optional*, defaults to `"<s>"`):
31
+ The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.
32
+ eos_token (`str` or `tokenizers.AddedToken`, *optional*, defaults to `"</s>"`):
33
+ The end of sequence token.
34
+ pad_token (`str` or `tokenizers.AddedToken`, *optional*):
35
+ A special token used to make arrays of tokens the same size for batching purpose. Will then be ignored by
36
+ attention mechanisms or loss computation.
37
+ sp_model_kwargs (`Dict[str, Any]`, `Optional`, *optional*):
38
+ Will be passed to the `SentencePieceProcessor.__init__()` method. The [Python wrapper for
39
+ SentencePiece](https://github.com/google/sentencepiece/tree/master/python) can be used, among other things,
40
+ to set:
41
+
42
+ - `enable_sampling`: Enable subword regularization.
43
+ - `nbest_size`: Sampling parameters for unigram. Invalid for BPE-Dropout.
44
+
45
+ - `nbest_size = {0,1}`: No sampling is performed.
46
+ - `nbest_size > 1`: samples from the nbest_size results.
47
+ - `nbest_size < 0`: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
48
+ using forward-filtering-and-backward-sampling algorithm.
49
+
50
+ - `alpha`: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
51
+ BPE-dropout.
52
+
53
+ add_bos_token (`bool`, *optional*, defaults to `True`):
54
+ Whether or not to add an `bos_token` at the start of sequences.
55
+ add_eos_token (`bool`, *optional*, defaults to `False`):
56
+ Whether or not to add an `eos_token` at the end of sequences.
57
+ clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`):
58
+ Whether or not to cleanup spaces after decoding, cleanup consists in removing potential artifacts like
59
+ extra spaces.
60
+ use_default_system_prompt (`bool`, *optional*, defaults to `False`):
61
+ Whether or not the default system prompt for InternLM3 should be used.
62
+ spaces_between_special_tokens (`bool`, *optional*, defaults to `False`):
63
+ Whether or not to add spaces between special tokens.
64
+ spaces_for_interleaved_special_tokens (`bool`, *optional*, defaults to `False`):
65
+ Whether or not to add spaces between special tokens that are interleaved with normal tokens.
66
+ add_prefix_space (`bool`, *optional*, defaults to `True`):
67
+ Whether or not to add an initial space to the input. This allows to treat the leading word just as any
68
+ other word. Again, this should be set with `from_slow=True` to make sure it's taken into account.
69
+ """
70
+
71
+ vocab_files_names = VOCAB_FILES_NAMES
72
+ model_input_names = ["input_ids", "attention_mask"]
73
+
74
+ def __init__(
75
+ self,
76
+ vocab_file,
77
+ unk_token="<unk>",
78
+ bos_token="<s>",
79
+ eos_token="</s>",
80
+ pad_token=None,
81
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
82
+ add_bos_token=True,
83
+ add_eos_token=False,
84
+ clean_up_tokenization_spaces=False,
85
+ use_default_system_prompt=False,
86
+ spaces_between_special_tokens=False,
87
+ spaces_for_interleaved_special_tokens=False,
88
+ add_prefix_space=True,
89
+ **kwargs,
90
+ ):
91
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
92
+ bos_token = AddedToken(bos_token, normalized=False, special=True) if isinstance(bos_token, str) else bos_token
93
+ eos_token = AddedToken(eos_token, normalized=False, special=True) if isinstance(eos_token, str) else eos_token
94
+ unk_token = AddedToken(unk_token, normalized=False, special=True) if isinstance(unk_token, str) else unk_token
95
+ pad_token = AddedToken(pad_token, normalized=False, special=True) if isinstance(pad_token, str) else pad_token
96
+
97
+ self.vocab_file = vocab_file
98
+ self.add_bos_token = add_bos_token
99
+ self.add_eos_token = add_eos_token
100
+ self.use_default_system_prompt = use_default_system_prompt
101
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
102
+ self.sp_model.Load(vocab_file)
103
+ self.add_prefix_space = add_prefix_space
104
+ self.spaces_for_interleaved_special_tokens = spaces_for_interleaved_special_tokens
105
+
106
+ vocab_size = self.sp_model.get_piece_size()
107
+ self.decoder = {i: self.sp_model.id_to_piece(i) for i in range(vocab_size)}
108
+
109
+ super().__init__(
110
+ bos_token=bos_token,
111
+ eos_token=eos_token,
112
+ unk_token=unk_token,
113
+ pad_token=pad_token,
114
+ add_bos_token=add_bos_token,
115
+ add_eos_token=add_eos_token,
116
+ sp_model_kwargs=sp_model_kwargs,
117
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
118
+ use_default_system_prompt=use_default_system_prompt,
119
+ spaces_between_special_tokens=spaces_between_special_tokens,
120
+ add_prefix_space=add_prefix_space,
121
+ **kwargs,
122
+ )
123
+
124
+ def __getstate__(self):
125
+ state = self.__dict__.copy()
126
+ state["sp_model"] = None
127
+ state["sp_model_proto"] = self.sp_model.serialized_model_proto()
128
+ return state
129
+
130
+ def __setstate__(self, d):
131
+ self.__dict__.update(d)
132
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
133
+ self.sp_model.LoadFromSerializedProto(self.sp_model_proto)
134
+
135
+ @property
136
+ def vocab_size(self):
137
+ """Returns vocab size"""
138
+ return self.sp_model.get_piece_size()
139
+
140
+ def get_vocab(self):
141
+ """Returns vocab as a dict"""
142
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
143
+ vocab.update(self.added_tokens_encoder)
144
+ return vocab
145
+
146
+ def tokenize(self, text: "TextInput", **kwargs) -> List[str]:
147
+ """
148
+ Args:
149
+ text: TextInput
150
+ Simply calls PreTrainedTokenizer's method
151
+ """
152
+ return super().tokenize(text, **kwargs)
153
+
154
+ def _tokenize(self, text, **kwargs):
155
+ """
156
+ Args:
157
+ text: TextInput
158
+ Returns a tokenized string. The Gemma tokenizer never adds a prefix space.
159
+ """
160
+ return self.sp_model.encode(text, out_type=str)
161
+
162
+ def _convert_token_to_id(self, token):
163
+ """Converts a token (str) in an id using the vocab."""
164
+ return self.sp_model.piece_to_id(token)
165
+
166
+ def _convert_id_to_token(self, index):
167
+ """Converts an index (integer) in a token (str) using the vocab."""
168
+ return self.decoder.get(index, "")
169
+
170
+ def convert_tokens_to_string(self, tokens):
171
+ """Converts a sequence of tokens (string) in a single string."""
172
+ # since we manually add the prefix space, we have to remove it when decoding
173
+ if tokens[0].startswith(SPIECE_UNDERLINE) and self.add_prefix_space:
174
+ tokens[0] = tokens[0][1:]
175
+
176
+ current_sub_tokens = []
177
+ out_string = ""
178
+ prev_is_special = False
179
+ for i, token in enumerate(tokens):
180
+ # make sure that special tokens are not decoded using sentencepiece model
181
+ if token in self.all_special_tokens:
182
+ if not prev_is_special and i != 0 and self.spaces_for_interleaved_special_tokens:
183
+ out_string += " "
184
+ out_string += self.sp_model.decode(current_sub_tokens) + token
185
+ prev_is_special = True
186
+ current_sub_tokens = []
187
+ else:
188
+ if (
189
+ prev_is_special
190
+ and i == 1
191
+ and self.add_prefix_space
192
+ and not token.startswith(SPIECE_UNDERLINE)
193
+ and self.spaces_for_interleaved_special_tokens
194
+ ):
195
+ out_string += " "
196
+ current_sub_tokens.append(token)
197
+ prev_is_special = False
198
+ out_string += self.sp_model.decode(current_sub_tokens)
199
+ return out_string
200
+
201
+ def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
202
+ """
203
+ Save the vocabulary and special tokens file to a directory.
204
+
205
+ Args:
206
+ save_directory (`str`):
207
+ The directory in which to save the vocabulary.
208
+
209
+ Returns:
210
+ `Tuple(str)`: Paths to the files saved.
211
+ """
212
+ if not os.path.isdir(save_directory):
213
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
214
+ return
215
+ out_vocab_file = os.path.join(save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"])
216
+
217
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
218
+ copyfile(self.vocab_file, out_vocab_file)
219
+ elif not os.path.isfile(self.vocab_file):
220
+ with open(out_vocab_file, "wb") as fi:
221
+ content_spiece_model = self.sp_model.serialized_model_proto()
222
+ fi.write(content_spiece_model)
223
+
224
+ return (out_vocab_file,)
225
+
226
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
227
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
228
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
229
+
230
+ output = bos_token_id + token_ids_0 + eos_token_id
231
+
232
+ if token_ids_1 is not None:
233
+ output = output + bos_token_id + token_ids_1 + eos_token_id
234
+
235
+ return output
236
+
237
+ def get_special_tokens_mask(
238
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
239
+ ) -> List[int]:
240
+ """
241
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
242
+ special tokens using the tokenizer `prepare_for_model` method.
243
+
244
+ Args:
245
+ token_ids_0 (`List[int]`):
246
+ List of IDs.
247
+ token_ids_1 (`List[int]`, *optional*):
248
+ Optional second list of IDs for sequence pairs.
249
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
250
+ Whether or not the token list is already formatted with special tokens for the model.
251
+
252
+ Returns:
253
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
254
+ """
255
+ if already_has_special_tokens:
256
+ return super().get_special_tokens_mask(token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True)
257
+
258
+ bos_token_id = [1] if self.add_bos_token else []
259
+ eos_token_id = [1] if self.add_eos_token else []
260
+
261
+ if token_ids_1 is None:
262
+ return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id
263
+ return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id + bos_token_id + ([0] * len(token_ids_1)) + eos_token_id
264
+
265
+ def create_token_type_ids_from_sequences(self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None) -> List[int]:
266
+ """
267
+ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
268
+ sequence pair mask has the following format:
269
+
270
+ ```
271
+ 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
272
+ | first sequence | second sequence |
273
+ ```
274
+
275
+ if token_ids_1 is None, only returns the first portion of the mask (0s).
276
+
277
+ Args:
278
+ token_ids_0 (`List[int]`):
279
+ List of ids.
280
+ token_ids_1 (`List[int]`, *optional*):
281
+ Optional second list of IDs for sequence pairs.
282
+
283
+ Returns:
284
+ `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
285
+ """
286
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
287
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
288
+
289
+ output = [0] * len(bos_token_id + token_ids_0 + eos_token_id)
290
+
291
+ if token_ids_1 is not None:
292
+ output += [1] * len(bos_token_id + token_ids_1 + eos_token_id)
293
+
294
+ return output
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcacff3229854f5103ee7a85473a30ca9a8b3a68f3aae9b7479574b23ac2256b
3
+ size 2475075
tokenizer_config.json ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": true,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "128111": {
31
+ "content": "<restate>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "128112": {
39
+ "content": "</restate>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "128113": {
47
+ "content": "<planning>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "128114": {
55
+ "content": "</planning>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "128115": {
63
+ "content": "<recollect>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "128116": {
71
+ "content": "</recollect>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "128117": {
79
+ "content": "<execution>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "128118": {
87
+ "content": "</execution>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "128119": {
95
+ "content": "<review>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "128120": {
103
+ "content": "</review>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "128121": {
111
+ "content": "<summarize>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ },
118
+ "128122": {
119
+ "content": "</summarize>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": true
125
+ },
126
+ "128123": {
127
+ "content": "<retry>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": true
133
+ },
134
+ "128124": {
135
+ "content": "</retry>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": true
141
+ },
142
+ "128125": {
143
+ "content": "<conclude>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": true
149
+ },
150
+ "128126": {
151
+ "content": "</conclude>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": true
157
+ },
158
+ "128127": {
159
+ "content": "<|plugin|>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": true
165
+ },
166
+ "128128": {
167
+ "content": "<|interpreter|>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": true
173
+ },
174
+ "128129": {
175
+ "content": "<|action_end|>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": true
181
+ },
182
+ "128130": {
183
+ "content": "<|action_start|>",
184
+ "lstrip": false,
185
+ "normalized": false,
186
+ "rstrip": false,
187
+ "single_word": false,
188
+ "special": true
189
+ },
190
+ "128131": {
191
+ "content": "<|im_end|>",
192
+ "lstrip": false,
193
+ "normalized": false,
194
+ "rstrip": false,
195
+ "single_word": false,
196
+ "special": true
197
+ },
198
+ "128132": {
199
+ "content": "<|im_start|>",
200
+ "lstrip": false,
201
+ "normalized": false,
202
+ "rstrip": false,
203
+ "single_word": false,
204
+ "special": true
205
+ }
206
+ },
207
+ "additional_special_tokens": [
208
+ "<|im_start|>",
209
+ "<|im_end|>",
210
+ "<|action_start|>",
211
+ "<|action_end|>",
212
+ "<|interpreter|>",
213
+ "<|plugin|>",
214
+ "<restate>",
215
+ "</restate>",
216
+ "<planning>",
217
+ "</planning>",
218
+ "<recollect>",
219
+ "</recollect>",
220
+ "<execution>",
221
+ "</execution>",
222
+ "<review>",
223
+ "</review>",
224
+ "<summarize>",
225
+ "</summarize>",
226
+ "<retry>",
227
+ "</retry>",
228
+ "<conclude>",
229
+ "</conclude>"
230
+ ],
231
+ "auto_map": {
232
+ "AutoTokenizer": [
233
+ "tokenization_internlm3.InternLM3Tokenizer",
234
+ null
235
+ ]
236
+ },
237
+ "bos_token": "<s>",
238
+ "clean_up_tokenization_spaces": false,
239
+ "eos_token": "</s>",
240
+ "extra_special_tokens": {},
241
+ "model_max_length": 1000000000000000019884624838656,
242
+ "pad_token": "</s>",
243
+ "sp_model_kwargs": {},
244
+ "spaces_between_special_tokens": false,
245
+ "tokenizer_class": "InternLM3Tokenizer",
246
+ "unk_token": "<unk>",
247
+ "use_default_system_prompt": false
248
+ }