seanmanifest commited on
Commit
9a9cbe3
·
verified ·
1 Parent(s): 2860323

Add files using upload-large-folder tool

Browse files
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Brumby-14b-base
2
+
3
+ **Model Developer**: [Manifest AI](https://manifestai.com/)
4
+
5
+ **Number of Parameters**: 14B
6
+
7
+ **Number of Layers**: 14B
8
+
9
+
10
+ ## Model Overview
11
+
12
+ **Brumby-14b-base** is a completely attention-free LLM whose performance is competitive with state-of-the-art models. This
13
+ model, which we call **Brumby-14B-Base**, has a familiar Transformer-style architecture, except it uses
14
+ [power retention](https://manifestai.com/articles/release-power-retention/)
15
+ layers instead of attention layers. It is available [on Huggingface](todo).
16
+ Here is how it compares to other models at a similar scale on popular benchmarks.
17
+
18
+ ### Evaluation Results
19
+ | Task/Model | Brumby-14B-base | falcon-mamba-7b | mamba-codestral-7b-v0.1 | nvidia-nemotron-nano-12b-v2-base | qwen3-14b-base | glm-4.5-air-base | mistral-nemo-base-2407 | | |
20
+ |----------------|-----------------|-----------------|-------------------------|----------------------------------|----------------|------------------|-------------------------|---|---|
21
+ | ARC | 0.89 | 0.74 | 0.47 | 0.93 | 0.94 | 0.92 | 0.76 | | |
22
+ | GSM8K | 0.88 | 0.52 | 0.23 | 0.84 | 0.84 | 0.83 | 0.54 | | |
23
+ | GSM8K Platinum | 0.87 | 0.54 | 0.24 | 0.87 | 0.88 | 0.85 | 0.57 | | |
24
+ | HELLASWAG | 0.77 | 0.8 | 0.7 | 0.82 | 0.81 | 0.85 | 0.83 | | |
25
+ | MMLU | 0.71 | 0.6 | 0.46 | 0.78 | 0.78 | 0.77 | 0.64 | | |
26
+ | MMLU Pro | 0.36 | 0.23 | 0.19 | 0.53 | 0.55 | 0.51 | 0.35 | | |
27
+ | MBPP | 0.57 | 0.4 | 0.48 | 0.71 | 0.75 | 0.73 | 0.54 | | |
28
+ | MATH | 0.62 | 0.19 | 0.12 | 0.26 | 0.54 | 0.47 | 0.2 | | |
29
+
30
+
31
+
32
+ ### Training
33
+
34
+ <div style="text-align: center;">
35
+ <img src="img/eval_comparison.png" width="100%">
36
+ </div>
37
+
38
+ The training budget for this model was $4,000, trained 60 hours on a cluster of 32 H100s. (For comparison, training
39
+ an LLM of this scale from scratch typically costs ~$200k.) We were able to achieve this low cost thanks to the
40
+ mathematical similarity between attention and power retention. We used a technique we call _retraining_, which
41
+ repurposes the weights of a pretrained Transformer as an initialization for power retention.
42
+ This results in the following loss curve.
43
+
44
+ <div style="text-align: center;">
45
+ <img src="img/train_curve_brumby.png" width="100%">
46
+ </div>
47
+
48
+ The initial weights for Brumby-14B-Base came from Qwen3-14B-Base. The jumps in loss correspond to changes in the
49
+ underlying training distribution, following the three-phase dataset of
50
+ [Nemotron Nano](https://research.nvidia.com/labs/adlr/files/NVIDIA-Nemotron-Nano-2-Technical-Report.pdf).
51
+ After 3000 steps of training, it reaches the same training loss on this data as Qwen3-14B-Base.
52
+ This trend is mirrored by performance on downstream evaluations.
53
+
54
+ <div style="text-align: center;">
55
+ <img src="img/model_progression.png" width="100%">
56
+ </div>
57
+
58
+ So what is power retention? Similar to attention, power retention is a layer that takes $Q,K,V \in R^{t \times d}$ as
59
+ inputs, and gives $Y \in R^{t \times d}$ as an output. It also accepts a gating signal $g \in R^t$.
60
+ It is a “true” RNN, in that every prediction can be influenced by information arbitrarily far back in the past.
61
+ The state of the RNN is a matrix $S \in R^{d \times D}, which is updated according to
62
+
63
+ $$
64
+ S_t = g_t S_{t-1} + V_t \phi_p(K_t)^T \qquad Y_t = S_t Q_t
65
+ $$
66
+
67
+ The function $\phi_p: R^d \to R^D$ is related to the tensor power (the “power” in power retention).
68
+ The power $p$ controls the dimension $D$, giving us a hyperparameter to scale the state size of the RNN,
69
+ just as one might use the width to scale the parameter count.
70
+ For our experiments, power $p=2$ resulted in the optimal state size for the model.
71
+
72
+ What makes this a retention layer, as opposed to just a recurrent layer, is that it also has an attention form.
73
+ This second formulation is critical to any hardware-efficient implementation. If you want to learn more about the
74
+ power retention layer and how to implement it efficiently, see our preprint paper and related blog post. Our
75
+ hardware-efficient power retention kernels are available open-source and can be installed with `pip install retention`.
76
+
77
+ ### Reproduce Evaluation
78
+
79
+ To reproduce evaluation results, first install the latest version of [lm-evaluation-harnesss](https://github.com/EleutherAI/lm-evaluation-harness), then run:
80
+
81
+ ```
82
+ lm_eval --model hf --model_args "pretrained=manifestai/brumby-14b-base,trust_remote_code=True" --tasks "gsm8k" --batch_size 8
83
+ ```
84
+
85
+ Note that the huggingface generation implementation relies on compiling triton kernels and is thus slow to start and inefficient, we are planning to rollout efficient inference kernels in the coming weeks.
86
+
87
+
88
+ ### Coming soon
89
+
90
+ **Fast long-context inference:** Our fastest power retention inference kernels are hundreds of times faster than
91
+ equivalent attention kernels on long contexts. We will update the architecture to incorporate these fast kernels.
92
+
93
+ **Long-context SFT:** A finetune of Brumby-14B-Base at context length 1,000,000 is no more expensive (per token) than a
94
+ finetune of Qwen3-14B-Base at context length 10,000. We will release a long context SFT toolkit so that anyone can
95
+ perform these long-context finetunes, unlocking new capabilities for LLMs in domains like search and coding.
96
+
97
+ **VLLM integration:** A robust inference engine is an essential complement to any SOTA LLM. We are developing kernels
98
+ to integrate power retention with VLLM. Expect to see both unmatched inference speeds and reduced memory
99
+ requirements, allowing more users to fit on each GPU.
100
+
101
+ **The Brumby Band:** Brumby-14B-Base is just the first of a coming family of models. In the coming weeks, we will
102
+ retrain and release power retention base models at a variety of scales, from as small as 1B parameters up to >100B
103
+ parameters.
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BrumbyForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_brumby.BrumbyConfig",
9
+ "AutoModelForCausalLM": "modeling_brumby.BrumbyForCausalLM"
10
+ },
11
+ "bos_token_id": 151643,
12
+ "eos_token_id": 151643,
13
+ "head_dim": 128,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 5120,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 17408,
18
+ "max_position_embeddings": 32768,
19
+ "max_window_layers": 40,
20
+ "model_type": "brumby",
21
+ "num_attention_heads": 40,
22
+ "num_hidden_layers": 40,
23
+ "num_key_value_heads": 8,
24
+ "rms_norm_eps": 1e-06,
25
+ "rope_scaling": null,
26
+ "rope_theta": 1000000,
27
+ "sliding_window": null,
28
+ "tie_word_embeddings": false,
29
+ "torch_dtype": "bfloat16",
30
+ "transformers_version": "4.51.0",
31
+ "use_cache": true,
32
+ "use_sliding_window": false,
33
+ "vocab_size": 151936
34
+ }
configuration_brumby.py ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2025 Manifest AI.
3
+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """Brumby model configuration"""
17
+
18
+ from transformers.configuration_utils import PretrainedConfig, layer_type_validation
19
+ from transformers.modeling_rope_utils import rope_config_validation
20
+ from transformers.utils import logging
21
+
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+
26
+ class BrumbyConfig(PretrainedConfig):
27
+ r"""
28
+ This is the configuration class to store the configuration of a [`BrumbyModel`]. It is used to instantiate a
29
+ Brumby model according to the specified arguments, defining the model architecture. Instantiating a configuration
30
+ with the defaults will yield a similar configuration to that of
31
+ Brumby-14B-base [Brumby/Brumby-14B-base](https://huggingface.co/manifestai/Brumby-14B-base).
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 Brumby model. Defines the number of different tokens that can be represented by the
40
+ `inputs_ids` passed when calling [`BrumbyModel`]
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, check out [this
55
+ paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to `32`.
56
+ head_dim (`int`, *optional*, defaults to 128):
57
+ The attention head dimension.
58
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
59
+ The non-linear activation function (function or string) in the decoder.
60
+ max_position_embeddings (`int`, *optional*, defaults to 32768):
61
+ The maximum sequence length that this model might ever be used with.
62
+ initializer_range (`float`, *optional*, defaults to 0.02):
63
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
64
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
65
+ The epsilon used by the rms normalization layers.
66
+ use_cache (`bool`, *optional*, defaults to `True`):
67
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
68
+ relevant if `config.is_decoder=True`.
69
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
70
+ Whether the model's input and output word embeddings should be tied.
71
+ rope_theta (`float`, *optional*, defaults to 10000.0):
72
+ The base period of the RoPE embeddings.
73
+ rope_scaling (`Dict`, *optional*):
74
+ Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
75
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
76
+ accordingly.
77
+ Expected contents:
78
+ `rope_type` (`str`):
79
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
80
+ 'llama3'], with 'default' being the original RoPE implementation.
81
+ `factor` (`float`, *optional*):
82
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
83
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
84
+ original maximum pre-trained length.
85
+ `original_max_position_embeddings` (`int`, *optional*):
86
+ Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
87
+ pretraining.
88
+ `attention_factor` (`float`, *optional*):
89
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
90
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
91
+ `factor` field to infer the suggested value.
92
+ `beta_fast` (`float`, *optional*):
93
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
94
+ ramp function. If unspecified, it defaults to 32.
95
+ `beta_slow` (`float`, *optional*):
96
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
97
+ ramp function. If unspecified, it defaults to 1.
98
+ `short_factor` (`list[float]`, *optional*):
99
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
100
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
101
+ size divided by the number of attention heads divided by 2
102
+ `long_factor` (`list[float]`, *optional*):
103
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
104
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
105
+ size divided by the number of attention heads divided by 2
106
+ `low_freq_factor` (`float`, *optional*):
107
+ Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
108
+ `high_freq_factor` (`float`, *optional*):
109
+ Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
110
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
111
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
112
+ use_sliding_window (`bool`, *optional*, defaults to `False`):
113
+ Whether to use sliding window attention.
114
+ sliding_window (`int`, *optional*, defaults to 4096):
115
+ Sliding window attention (SWA) window size. If not specified, will default to `4096`.
116
+ max_window_layers (`int`, *optional*, defaults to 28):
117
+ The number of layers using full attention. The first `max_window_layers` layers will use full attention, while any
118
+ additional layer afterwards will use SWA (Sliding Window Attention).
119
+ layer_types (`list`, *optional*):
120
+ Attention pattern for each layer.
121
+ attention_dropout (`float`, *optional*, defaults to 0.0):
122
+ The dropout ratio for the attention probabilities.
123
+
124
+ ```python
125
+ >>> from transformers import BrumbyModel, BrumbyConfig
126
+
127
+ >>> # Initializing a Brumby style configuration
128
+ >>> configuration = BrumbyConfig()
129
+
130
+ >>> # Initializing a model from the Brumby-14B-base style configuration
131
+ >>> model = BrumbyModel(configuration)
132
+
133
+ >>> # Accessing the model configuration
134
+ >>> configuration = model.config
135
+ ```"""
136
+
137
+ model_type = "brumby"
138
+ keys_to_ignore_at_inference = ["past_key_values"]
139
+
140
+ # Default tensor parallel plan for base model `Brumby`
141
+ base_model_tp_plan = {
142
+ "layers.*.self_attn.q_proj": "colwise",
143
+ "layers.*.self_attn.k_proj": "colwise",
144
+ "layers.*.self_attn.v_proj": "colwise",
145
+ "layers.*.self_attn.o_proj": "rowwise",
146
+ "layers.*.mlp.gate_proj": "colwise",
147
+ "layers.*.mlp.up_proj": "colwise",
148
+ "layers.*.mlp.down_proj": "rowwise",
149
+ }
150
+ base_model_pp_plan = {
151
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
152
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
153
+ "norm": (["hidden_states"], ["hidden_states"]),
154
+ }
155
+
156
+ def __init__(
157
+ self,
158
+ vocab_size=151936,
159
+ hidden_size=5120,
160
+ intermediate_size=17408,
161
+ num_hidden_layers=40,
162
+ num_attention_heads=40,
163
+ num_key_value_heads=8,
164
+ head_dim=128,
165
+ hidden_act="silu",
166
+ max_position_embeddings=32768,
167
+ initializer_range=0.02,
168
+ rms_norm_eps=1e-6,
169
+ use_cache=True,
170
+ tie_word_embeddings=False,
171
+ rope_theta=10000.0,
172
+ rope_scaling=None,
173
+ attention_bias=False,
174
+ use_sliding_window=False,
175
+ sliding_window=4096,
176
+ max_window_layers=40,
177
+ layer_types=None,
178
+ attention_dropout=0.0,
179
+ chunk_size=64,
180
+ switch_over_seq_len=8192,
181
+ prefill_chunk_size=1024,
182
+ use_exp=False,
183
+ **kwargs,
184
+ ):
185
+ self.vocab_size = vocab_size
186
+ self.max_position_embeddings = max_position_embeddings
187
+ self.hidden_size = hidden_size
188
+ self.intermediate_size = intermediate_size
189
+ self.num_hidden_layers = num_hidden_layers
190
+ self.num_attention_heads = num_attention_heads
191
+ self.use_sliding_window = use_sliding_window
192
+ self.sliding_window = sliding_window if self.use_sliding_window else None
193
+ self.max_window_layers = max_window_layers
194
+
195
+ # for backward compatibility
196
+ if num_key_value_heads is None:
197
+ num_key_value_heads = num_attention_heads
198
+
199
+ self.num_key_value_heads = num_key_value_heads
200
+ self.head_dim = head_dim
201
+ self.hidden_act = hidden_act
202
+ self.initializer_range = initializer_range
203
+ self.rms_norm_eps = rms_norm_eps
204
+ self.use_cache = use_cache
205
+ self.rope_theta = rope_theta
206
+ self.rope_scaling = rope_scaling
207
+ self.attention_bias = attention_bias
208
+ self.attention_dropout = attention_dropout
209
+ # Validate the correctness of rotary position embeddings parameters
210
+ # BC: if there is a 'type' field, move it to 'rope_type'.
211
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
212
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
213
+ rope_config_validation(self)
214
+
215
+ self.layer_types = layer_types
216
+ if self.layer_types is None:
217
+ self.layer_types = [
218
+ "sliding_attention"
219
+ if self.sliding_window is not None and i >= self.max_window_layers
220
+ else "full_attention"
221
+ for i in range(self.num_hidden_layers)
222
+ ]
223
+ layer_type_validation(self.layer_types, self.num_hidden_layers)
224
+ self.chunk_size = chunk_size
225
+ self.switch_over_seq_len = switch_over_seq_len
226
+ self.prefill_chunk_size = prefill_chunk_size
227
+ self.use_exp = use_exp
228
+ self.p = 2 # power of expansion for power attention, only 2 is supported for now
229
+ super().__init__(
230
+ tie_word_embeddings=tie_word_embeddings,
231
+ **kwargs,
232
+ )
233
+
234
+
235
+ __all__ = ["BrumbyConfig"]
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": 151643,
5
+ "max_new_tokens": 2048,
6
+ "transformers_version": "4.37.0"
7
+ }
model-00001-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d23de74408c97b4ffe27b85d399785cb1878c3893ae1b4447c83538dce7e39b
3
+ size 7683572632
model-00002-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aee2694c59b488aedbd13740ecf50f146d1a6441ff7715f0855ee7e386a7c539
3
+ size 7927494533
model-00003-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eabe7964f5c842624b81e61b52cf0cdd68a7eb792a868a0081d824044c66d91c
3
+ size 7927494599
model-00004-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb12b5e82d450211de6c94b023dd9cdb22d040f5e9f8815cadfe94f67004bd80
3
+ size 7927494599
model-00005-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19bc64b987b06fdcfc46c898ba3d88fcc087989d0c33b3afd81034ced14b7d8e
3
+ size 7927494599
model-00006-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0b1719c36606a0ef2e24e5e434e1b9608258eb9d0424b2fc37052fa7041eacc
3
+ size 7927494599
model-00007-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8162199011379d46d260d5e30b6ffbcb0cfd99b00849f84b09cce961553ac65
3
+ size 7927494599
model-00008-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bec4134ab2b40ab24f88aab2e61b1c6c94b17d77a1c2cf71ea2b9725324dab90
3
+ size 3831301603
model.safetensors.index.json ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 59079782400
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00008-of-00008.safetensors",
7
+ "model.layers.39.input_layernorm.weight": "model-00008-of-00008.safetensors",
8
+ "model.layers.39.mlp.down_proj.weight": "model-00008-of-00008.safetensors",
9
+ "model.layers.39.mlp.up_proj.weight": "model-00008-of-00008.safetensors",
10
+ "model.layers.39.post_attention_layernorm.weight": "model-00008-of-00008.safetensors",
11
+ "model.norm.weight": "model-00008-of-00008.safetensors",
12
+ "model.layers.0.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
13
+ "model.layers.1.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
14
+ "model.layers.2.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
15
+ "model.layers.3.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
16
+ "model.layers.4.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
17
+ "model.layers.5.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
18
+ "model.layers.6.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
19
+ "model.layers.7.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
20
+ "model.layers.8.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
21
+ "model.layers.9.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
22
+ "model.layers.10.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
23
+ "model.layers.11.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
24
+ "model.layers.12.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
25
+ "model.layers.13.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
26
+ "model.layers.14.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
27
+ "model.layers.15.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
28
+ "model.layers.16.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
29
+ "model.layers.17.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
30
+ "model.layers.18.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
31
+ "model.layers.19.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
32
+ "model.layers.20.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
33
+ "model.layers.21.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
34
+ "model.layers.22.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
35
+ "model.layers.23.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
36
+ "model.layers.24.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
37
+ "model.layers.25.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
38
+ "model.layers.26.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
39
+ "model.layers.27.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
40
+ "model.layers.28.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
41
+ "model.layers.29.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
42
+ "model.layers.30.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
43
+ "model.layers.31.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
44
+ "model.layers.32.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
45
+ "model.layers.33.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
46
+ "model.layers.34.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
47
+ "model.layers.35.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
48
+ "model.layers.36.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
49
+ "model.layers.37.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
50
+ "model.layers.38.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
51
+ "model.layers.39.self_attn.g_proj.weight": "model-00008-of-00008.safetensors",
52
+ "model.embed_tokens.weight": "model-00001-of-00008.safetensors",
53
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00008.safetensors",
54
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00008.safetensors",
55
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
56
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00008.safetensors",
57
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00008.safetensors",
58
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00008.safetensors",
59
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
60
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
61
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00008.safetensors",
62
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
63
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
64
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00008.safetensors",
65
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00008.safetensors",
66
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
67
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00008.safetensors",
68
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00008.safetensors",
69
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00008.safetensors",
70
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
71
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
72
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00008.safetensors",
73
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
74
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
75
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00008.safetensors",
76
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00008.safetensors",
77
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
78
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00008.safetensors",
79
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00008.safetensors",
80
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00008.safetensors",
81
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
82
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
83
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00008.safetensors",
84
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
85
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
86
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
87
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00008.safetensors",
88
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
89
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
90
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00008.safetensors",
91
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
92
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
93
+ "model.layers.10.input_layernorm.weight": "model-00003-of-00008.safetensors",
94
+ "model.layers.10.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
95
+ "model.layers.10.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
96
+ "model.layers.10.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
97
+ "model.layers.10.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
98
+ "model.layers.10.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
99
+ "model.layers.10.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
100
+ "model.layers.10.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
101
+ "model.layers.10.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
102
+ "model.layers.10.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
103
+ "model.layers.10.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
104
+ "model.layers.11.input_layernorm.weight": "model-00003-of-00008.safetensors",
105
+ "model.layers.11.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
106
+ "model.layers.11.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
107
+ "model.layers.11.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
108
+ "model.layers.11.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
109
+ "model.layers.11.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
110
+ "model.layers.11.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
111
+ "model.layers.11.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
112
+ "model.layers.11.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
113
+ "model.layers.11.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
114
+ "model.layers.11.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
115
+ "model.layers.12.input_layernorm.weight": "model-00003-of-00008.safetensors",
116
+ "model.layers.12.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
117
+ "model.layers.12.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
118
+ "model.layers.12.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
119
+ "model.layers.12.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
120
+ "model.layers.12.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
121
+ "model.layers.12.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
122
+ "model.layers.12.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
123
+ "model.layers.12.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
124
+ "model.layers.12.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
125
+ "model.layers.12.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
126
+ "model.layers.13.input_layernorm.weight": "model-00003-of-00008.safetensors",
127
+ "model.layers.13.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
128
+ "model.layers.13.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
129
+ "model.layers.13.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
130
+ "model.layers.13.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
131
+ "model.layers.13.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
132
+ "model.layers.13.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
133
+ "model.layers.13.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
134
+ "model.layers.13.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
135
+ "model.layers.13.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
136
+ "model.layers.13.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
137
+ "model.layers.14.input_layernorm.weight": "model-00003-of-00008.safetensors",
138
+ "model.layers.14.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
139
+ "model.layers.14.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
140
+ "model.layers.14.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
141
+ "model.layers.14.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
142
+ "model.layers.14.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
143
+ "model.layers.14.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
144
+ "model.layers.14.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
145
+ "model.layers.14.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
146
+ "model.layers.14.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
147
+ "model.layers.14.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
148
+ "model.layers.15.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
149
+ "model.layers.15.self_attn.k_norm.weight": "model-00003-of-00008.safetensors",
150
+ "model.layers.15.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
151
+ "model.layers.15.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
152
+ "model.layers.15.self_attn.q_norm.weight": "model-00003-of-00008.safetensors",
153
+ "model.layers.15.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
154
+ "model.layers.15.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
155
+ "model.layers.9.input_layernorm.weight": "model-00003-of-00008.safetensors",
156
+ "model.layers.9.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
157
+ "model.layers.9.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
158
+ "model.layers.9.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
159
+ "model.layers.15.input_layernorm.weight": "model-00004-of-00008.safetensors",
160
+ "model.layers.15.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
161
+ "model.layers.15.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
162
+ "model.layers.15.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
163
+ "model.layers.16.input_layernorm.weight": "model-00004-of-00008.safetensors",
164
+ "model.layers.16.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
165
+ "model.layers.16.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
166
+ "model.layers.16.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
167
+ "model.layers.16.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
168
+ "model.layers.16.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
169
+ "model.layers.16.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
170
+ "model.layers.16.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
171
+ "model.layers.16.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
172
+ "model.layers.16.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
173
+ "model.layers.16.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
174
+ "model.layers.17.input_layernorm.weight": "model-00004-of-00008.safetensors",
175
+ "model.layers.17.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
176
+ "model.layers.17.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
177
+ "model.layers.17.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
178
+ "model.layers.17.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
179
+ "model.layers.17.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
180
+ "model.layers.17.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
181
+ "model.layers.17.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
182
+ "model.layers.17.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
183
+ "model.layers.17.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
184
+ "model.layers.17.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
185
+ "model.layers.18.input_layernorm.weight": "model-00004-of-00008.safetensors",
186
+ "model.layers.18.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
187
+ "model.layers.18.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
188
+ "model.layers.18.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
189
+ "model.layers.18.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
190
+ "model.layers.18.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
191
+ "model.layers.18.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
192
+ "model.layers.18.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
193
+ "model.layers.18.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
194
+ "model.layers.18.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
195
+ "model.layers.18.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
196
+ "model.layers.19.input_layernorm.weight": "model-00004-of-00008.safetensors",
197
+ "model.layers.19.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
198
+ "model.layers.19.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
199
+ "model.layers.19.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
200
+ "model.layers.19.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
201
+ "model.layers.19.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
202
+ "model.layers.19.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
203
+ "model.layers.19.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
204
+ "model.layers.19.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
205
+ "model.layers.19.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
206
+ "model.layers.19.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
207
+ "model.layers.20.input_layernorm.weight": "model-00004-of-00008.safetensors",
208
+ "model.layers.20.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
209
+ "model.layers.20.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
210
+ "model.layers.20.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
211
+ "model.layers.20.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
212
+ "model.layers.20.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
213
+ "model.layers.20.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
214
+ "model.layers.20.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
215
+ "model.layers.20.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
216
+ "model.layers.20.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
217
+ "model.layers.20.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
218
+ "model.layers.21.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
219
+ "model.layers.21.self_attn.k_norm.weight": "model-00004-of-00008.safetensors",
220
+ "model.layers.21.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
221
+ "model.layers.21.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
222
+ "model.layers.21.self_attn.q_norm.weight": "model-00004-of-00008.safetensors",
223
+ "model.layers.21.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
224
+ "model.layers.21.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
225
+ "model.layers.21.input_layernorm.weight": "model-00005-of-00008.safetensors",
226
+ "model.layers.21.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
227
+ "model.layers.21.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
228
+ "model.layers.21.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
229
+ "model.layers.22.input_layernorm.weight": "model-00005-of-00008.safetensors",
230
+ "model.layers.22.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
231
+ "model.layers.22.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
232
+ "model.layers.22.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
233
+ "model.layers.22.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
234
+ "model.layers.22.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
235
+ "model.layers.22.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
236
+ "model.layers.22.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
237
+ "model.layers.22.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
238
+ "model.layers.22.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
239
+ "model.layers.22.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
240
+ "model.layers.23.input_layernorm.weight": "model-00005-of-00008.safetensors",
241
+ "model.layers.23.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
242
+ "model.layers.23.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
243
+ "model.layers.23.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
244
+ "model.layers.23.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
245
+ "model.layers.23.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
246
+ "model.layers.23.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
247
+ "model.layers.23.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
248
+ "model.layers.23.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
249
+ "model.layers.23.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
250
+ "model.layers.23.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
251
+ "model.layers.24.input_layernorm.weight": "model-00005-of-00008.safetensors",
252
+ "model.layers.24.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
253
+ "model.layers.24.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
254
+ "model.layers.24.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
255
+ "model.layers.24.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
256
+ "model.layers.24.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
257
+ "model.layers.24.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
258
+ "model.layers.24.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
259
+ "model.layers.24.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
260
+ "model.layers.24.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
261
+ "model.layers.24.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
262
+ "model.layers.25.input_layernorm.weight": "model-00005-of-00008.safetensors",
263
+ "model.layers.25.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
264
+ "model.layers.25.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
265
+ "model.layers.25.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
266
+ "model.layers.25.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
267
+ "model.layers.25.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
268
+ "model.layers.25.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
269
+ "model.layers.25.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
270
+ "model.layers.25.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
271
+ "model.layers.25.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
272
+ "model.layers.25.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
273
+ "model.layers.26.input_layernorm.weight": "model-00005-of-00008.safetensors",
274
+ "model.layers.26.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
275
+ "model.layers.26.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
276
+ "model.layers.26.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
277
+ "model.layers.26.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
278
+ "model.layers.26.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
279
+ "model.layers.26.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
280
+ "model.layers.26.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
281
+ "model.layers.26.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
282
+ "model.layers.26.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
283
+ "model.layers.26.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
284
+ "model.layers.27.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
285
+ "model.layers.27.self_attn.k_norm.weight": "model-00005-of-00008.safetensors",
286
+ "model.layers.27.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
287
+ "model.layers.27.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
288
+ "model.layers.27.self_attn.q_norm.weight": "model-00005-of-00008.safetensors",
289
+ "model.layers.27.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
290
+ "model.layers.27.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
291
+ "model.layers.27.input_layernorm.weight": "model-00006-of-00008.safetensors",
292
+ "model.layers.27.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
293
+ "model.layers.27.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
294
+ "model.layers.27.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
295
+ "model.layers.28.input_layernorm.weight": "model-00006-of-00008.safetensors",
296
+ "model.layers.28.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
297
+ "model.layers.28.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
298
+ "model.layers.28.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
299
+ "model.layers.28.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
300
+ "model.layers.28.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
301
+ "model.layers.28.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
302
+ "model.layers.28.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
303
+ "model.layers.28.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
304
+ "model.layers.28.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
305
+ "model.layers.28.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
306
+ "model.layers.29.input_layernorm.weight": "model-00006-of-00008.safetensors",
307
+ "model.layers.29.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
308
+ "model.layers.29.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
309
+ "model.layers.29.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
310
+ "model.layers.29.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
311
+ "model.layers.29.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
312
+ "model.layers.29.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
313
+ "model.layers.29.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
314
+ "model.layers.29.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
315
+ "model.layers.29.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
316
+ "model.layers.29.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
317
+ "model.layers.30.input_layernorm.weight": "model-00006-of-00008.safetensors",
318
+ "model.layers.30.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
319
+ "model.layers.30.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
320
+ "model.layers.30.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
321
+ "model.layers.30.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
322
+ "model.layers.30.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
323
+ "model.layers.30.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
324
+ "model.layers.30.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
325
+ "model.layers.30.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
326
+ "model.layers.30.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
327
+ "model.layers.30.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
328
+ "model.layers.31.input_layernorm.weight": "model-00006-of-00008.safetensors",
329
+ "model.layers.31.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
330
+ "model.layers.31.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
331
+ "model.layers.31.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
332
+ "model.layers.31.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
333
+ "model.layers.31.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
334
+ "model.layers.31.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
335
+ "model.layers.31.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
336
+ "model.layers.31.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
337
+ "model.layers.31.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
338
+ "model.layers.31.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
339
+ "model.layers.32.input_layernorm.weight": "model-00006-of-00008.safetensors",
340
+ "model.layers.32.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
341
+ "model.layers.32.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
342
+ "model.layers.32.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
343
+ "model.layers.32.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
344
+ "model.layers.32.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
345
+ "model.layers.32.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
346
+ "model.layers.32.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
347
+ "model.layers.32.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
348
+ "model.layers.32.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
349
+ "model.layers.32.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
350
+ "model.layers.33.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
351
+ "model.layers.33.self_attn.k_norm.weight": "model-00006-of-00008.safetensors",
352
+ "model.layers.33.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
353
+ "model.layers.33.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
354
+ "model.layers.33.self_attn.q_norm.weight": "model-00006-of-00008.safetensors",
355
+ "model.layers.33.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
356
+ "model.layers.33.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
357
+ "model.layers.3.input_layernorm.weight": "model-00002-of-00008.safetensors",
358
+ "model.layers.3.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
359
+ "model.layers.3.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
360
+ "model.layers.3.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
361
+ "model.layers.4.input_layernorm.weight": "model-00002-of-00008.safetensors",
362
+ "model.layers.4.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
363
+ "model.layers.4.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
364
+ "model.layers.4.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
365
+ "model.layers.4.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
366
+ "model.layers.4.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
367
+ "model.layers.4.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
368
+ "model.layers.4.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
369
+ "model.layers.4.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
370
+ "model.layers.4.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
371
+ "model.layers.4.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
372
+ "model.layers.5.input_layernorm.weight": "model-00002-of-00008.safetensors",
373
+ "model.layers.5.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
374
+ "model.layers.5.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
375
+ "model.layers.5.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
376
+ "model.layers.5.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
377
+ "model.layers.5.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
378
+ "model.layers.5.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
379
+ "model.layers.5.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
380
+ "model.layers.5.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
381
+ "model.layers.5.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
382
+ "model.layers.5.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
383
+ "model.layers.6.input_layernorm.weight": "model-00002-of-00008.safetensors",
384
+ "model.layers.6.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
385
+ "model.layers.6.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
386
+ "model.layers.6.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
387
+ "model.layers.6.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
388
+ "model.layers.6.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
389
+ "model.layers.6.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
390
+ "model.layers.6.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
391
+ "model.layers.6.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
392
+ "model.layers.6.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
393
+ "model.layers.6.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
394
+ "model.layers.7.input_layernorm.weight": "model-00002-of-00008.safetensors",
395
+ "model.layers.7.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
396
+ "model.layers.7.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
397
+ "model.layers.7.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
398
+ "model.layers.7.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
399
+ "model.layers.7.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
400
+ "model.layers.7.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
401
+ "model.layers.7.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
402
+ "model.layers.7.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
403
+ "model.layers.7.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
404
+ "model.layers.7.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
405
+ "model.layers.8.input_layernorm.weight": "model-00002-of-00008.safetensors",
406
+ "model.layers.8.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
407
+ "model.layers.8.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
408
+ "model.layers.8.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
409
+ "model.layers.8.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
410
+ "model.layers.8.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
411
+ "model.layers.8.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
412
+ "model.layers.8.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
413
+ "model.layers.8.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
414
+ "model.layers.8.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
415
+ "model.layers.8.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
416
+ "model.layers.9.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
417
+ "model.layers.9.self_attn.k_norm.weight": "model-00002-of-00008.safetensors",
418
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
419
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
420
+ "model.layers.9.self_attn.q_norm.weight": "model-00002-of-00008.safetensors",
421
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
422
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
423
+ "model.layers.33.input_layernorm.weight": "model-00007-of-00008.safetensors",
424
+ "model.layers.33.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
425
+ "model.layers.33.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
426
+ "model.layers.33.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
427
+ "model.layers.34.input_layernorm.weight": "model-00007-of-00008.safetensors",
428
+ "model.layers.34.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
429
+ "model.layers.34.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
430
+ "model.layers.34.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
431
+ "model.layers.34.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
432
+ "model.layers.34.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
433
+ "model.layers.34.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
434
+ "model.layers.34.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
435
+ "model.layers.34.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
436
+ "model.layers.34.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
437
+ "model.layers.34.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
438
+ "model.layers.35.input_layernorm.weight": "model-00007-of-00008.safetensors",
439
+ "model.layers.35.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
440
+ "model.layers.35.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
441
+ "model.layers.35.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
442
+ "model.layers.35.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
443
+ "model.layers.35.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
444
+ "model.layers.35.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
445
+ "model.layers.35.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
446
+ "model.layers.35.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
447
+ "model.layers.35.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
448
+ "model.layers.35.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
449
+ "model.layers.36.input_layernorm.weight": "model-00007-of-00008.safetensors",
450
+ "model.layers.36.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
451
+ "model.layers.36.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
452
+ "model.layers.36.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
453
+ "model.layers.36.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
454
+ "model.layers.36.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
455
+ "model.layers.36.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
456
+ "model.layers.36.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
457
+ "model.layers.36.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
458
+ "model.layers.36.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
459
+ "model.layers.36.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
460
+ "model.layers.37.input_layernorm.weight": "model-00007-of-00008.safetensors",
461
+ "model.layers.37.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
462
+ "model.layers.37.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
463
+ "model.layers.37.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
464
+ "model.layers.37.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
465
+ "model.layers.37.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
466
+ "model.layers.37.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
467
+ "model.layers.37.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
468
+ "model.layers.37.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
469
+ "model.layers.37.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
470
+ "model.layers.37.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
471
+ "model.layers.38.input_layernorm.weight": "model-00007-of-00008.safetensors",
472
+ "model.layers.38.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
473
+ "model.layers.38.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
474
+ "model.layers.38.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
475
+ "model.layers.38.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
476
+ "model.layers.38.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
477
+ "model.layers.38.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
478
+ "model.layers.38.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
479
+ "model.layers.38.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
480
+ "model.layers.38.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
481
+ "model.layers.38.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
482
+ "model.layers.39.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
483
+ "model.layers.39.self_attn.k_norm.weight": "model-00007-of-00008.safetensors",
484
+ "model.layers.39.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
485
+ "model.layers.39.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
486
+ "model.layers.39.self_attn.q_norm.weight": "model-00007-of-00008.safetensors",
487
+ "model.layers.39.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
488
+ "model.layers.39.self_attn.v_proj.weight": "model-00007-of-00008.safetensors"
489
+ }
490
+ }
modeling_brumby.py ADDED
@@ -0,0 +1,738 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 HuggingFace Inc. team.
3
+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """PyTorch Brumby model."""
17
+
18
+ from typing import Callable, Optional, Union, Any, Dict, Tuple
19
+
20
+ import torch
21
+ from torch import nn
22
+
23
+ from transformers.activations import ACT2FN
24
+ from transformers.cache_utils import Cache, DynamicCache
25
+ from transformers.generation import GenerationMixin
26
+ from transformers.integrations import use_kernel_forward_from_hub
27
+ from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
28
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
29
+ from transformers.modeling_layers import (
30
+ GenericForQuestionAnswering,
31
+ GenericForSequenceClassification,
32
+ GenericForTokenClassification,
33
+ GradientCheckpointingLayer,
34
+ )
35
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
36
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
37
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
38
+ from transformers.processing_utils import Unpack
39
+ from transformers.utils import TransformersKwargs, auto_docstring, can_return_tuple
40
+ from transformers.utils.deprecation import deprecate_kwarg
41
+ from transformers.utils.generic import check_model_inputs
42
+ from .configuration_brumby import BrumbyConfig
43
+
44
+
45
+ try:
46
+ from retention.triton import power_retention, power_retention_inference
47
+ from retention._utils import compute_expanded_dim
48
+ except ImportError:
49
+ raise ImportError("Retention is required by the Brumby model. Please install it with `pip install retention`.")
50
+
51
+
52
+ class PowerAttentionDynamicCache(DynamicCache):
53
+ """
54
+ A dynamic cache that encompasses 2 sets of caches:
55
+ 1. attention cache with a short seq_len (determined by the chunk_size parameter):
56
+ - key_cache: [batch_size, num_heads, chunk_size, head_dim]
57
+ - value_cache: [batch_size, num_heads, chunk_size, head_dim]
58
+ - gating_cache: [batch_size, num_heads, chunk_size]
59
+ 2. fixed-size state-based cache:
60
+ - state: [batch_size, num_heads, state_dim, head_dim]
61
+ - sum_of_keys: [batch_size, num_heads, state_dim]
62
+
63
+ where state_dim is determined by the power of expansion for power attention.
64
+ """
65
+ def __init__(self, config: BrumbyConfig, batch_size: int, dtype=torch.bfloat16, device=None):
66
+ super().__init__()
67
+ self.config = config
68
+ self.batch_size = batch_size
69
+ self.chunk_size = config.chunk_size
70
+ self.head_dim = config.hidden_size // config.num_attention_heads
71
+ self.p = config.p
72
+ self.state_dim = compute_expanded_dim(self.head_dim, deg=self.p)
73
+
74
+ self.states = [None for _ in range(config.num_hidden_layers)]
75
+ self.sum_of_keys = [None for _ in range(config.num_hidden_layers)]
76
+ self.key_cache = [torch.tensor([[]] * batch_size, device=device, dtype=dtype) for _ in range(config.num_hidden_layers)]
77
+ self.value_cache = [torch.tensor([[]] * batch_size, device=device, dtype=dtype) for _ in range(config.num_hidden_layers)]
78
+ self.gate_cache = [torch.tensor([[]] * batch_size, device=device, dtype=torch.float32) for _ in range(config.num_hidden_layers)]
79
+
80
+ def clean_cache(self, layer_idx: int) -> None:
81
+ self.key_cache[layer_idx] = torch.tensor([[]] * self.batch_size, device=self.device, dtype=self.dtype)
82
+ self.value_cache[layer_idx] = torch.tensor([[]] * self.batch_size, device=self.device, dtype=self.dtype)
83
+ self.gate_cache[layer_idx] = torch.tensor([[]] * self.batch_size, device=self.device, dtype=torch.float32)
84
+
85
+ def update_cache(
86
+ self,
87
+ key_states: torch.Tensor,
88
+ value_states: torch.Tensor,
89
+ gate_states: torch.Tensor,
90
+ layer_idx: int,
91
+ cache_kwargs: Optional[Dict[str, Any]] = None,
92
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
93
+ if self.key_cache[layer_idx].shape[-1] == 0:
94
+ self.key_cache[layer_idx] = key_states
95
+ self.value_cache[layer_idx] = value_states
96
+ self.gate_cache[layer_idx] = gate_states
97
+ else:
98
+ self.key_cache[layer_idx] = torch.cat([self.key_cache[layer_idx], key_states], dim=2)
99
+ self.value_cache[layer_idx] = torch.cat([self.value_cache[layer_idx], value_states], dim=2)
100
+ self.gate_cache[layer_idx] = torch.cat([self.gate_cache[layer_idx], gate_states], dim=2)
101
+ return self.key_cache[layer_idx], self.value_cache[layer_idx], self.gate_cache[layer_idx], self.states[layer_idx], self.sum_of_keys[layer_idx]
102
+
103
+ def reorder_cache(self, beam_idx: torch.LongTensor):
104
+ """Reorders the cache for beam search, given the selected beam indices."""
105
+ for layer_idx in range(len(self.key_cache)):
106
+ device = self.key_cache[layer_idx].device
107
+ self.key_cache[layer_idx] = self.key_cache[layer_idx].index_select(0, beam_idx.to(device))
108
+ device = self.value_cache[layer_idx].device
109
+ self.value_cache[layer_idx] = self.value_cache[layer_idx].index_select(0, beam_idx.to(device))
110
+ device = self.gate_cache[layer_idx].device
111
+ self.gate_cache[layer_idx] = self.gate_cache[layer_idx].index_select(0, beam_idx.to(device))
112
+ device = self.states[layer_idx].device
113
+ self.states[layer_idx] = self.states[layer_idx].index_select(0, beam_idx.to(device))
114
+ device = self.sum_of_keys[layer_idx].device
115
+ self.sum_of_keys[layer_idx] = self.sum_of_keys[layer_idx].index_select(0, beam_idx.to(device))
116
+
117
+ def get_seq_length(self, layer_idx: Optional[int] = 0) -> int:
118
+ """Returns the sequence length of the cached states. A layer index can be optionally passed."""
119
+ # take any layer that contains cache and not empty tensor
120
+ if layer_idx is None:
121
+ layer_idx = 0
122
+ if layer_idx >= len(self.key_cache):
123
+ return 0
124
+ # Check if the cache for this layer is empty
125
+ if self.key_cache[layer_idx].numel() == 0:
126
+ return 0
127
+ return self.key_cache[layer_idx].shape[-2]
128
+
129
+ def to_legacy_cache(self) -> tuple[tuple[torch.Tensor, torch.Tensor]]:
130
+ raise NotImplementedError("PowerAttentionDynamicCache does not have a legacy cache equivalent.")
131
+
132
+ @classmethod
133
+ def from_legacy_cache(cls, past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None) -> "PowerAttentionDynamicCache":
134
+ raise NotImplementedError("PowerAttentionDynamicCache does not have a legacy cache equivalent.")
135
+
136
+ def update_state(self, layer_idx: int, new_state: torch.Tensor, new_sum_of_keys: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
137
+ self.states[layer_idx] = new_state
138
+ self.sum_of_keys[layer_idx] = new_sum_of_keys
139
+ return self.states[layer_idx], self.sum_of_keys[layer_idx]
140
+
141
+ def reset(self):
142
+ self.states.zero_()
143
+ self.sum_of_keys.zero_()
144
+ self.key_cache.zero_()
145
+ self.value_cache.zero_()
146
+ self.gate_cache.zero_()
147
+
148
+
149
+
150
+ @use_kernel_forward_from_hub("RMSNorm")
151
+ class BrumbyRMSNorm(nn.Module):
152
+ def __init__(self, hidden_size, eps: float = 1e-6) -> None:
153
+ """
154
+ BrumbyRMSNorm is equivalent to T5LayerNorm
155
+ """
156
+ super().__init__()
157
+ self.weight = nn.Parameter(torch.ones(hidden_size))
158
+ self.variance_epsilon = eps
159
+
160
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
161
+ input_dtype = hidden_states.dtype
162
+ hidden_states = hidden_states.to(torch.float32)
163
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
164
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
165
+ return self.weight * hidden_states.to(input_dtype)
166
+
167
+ def extra_repr(self):
168
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
169
+
170
+
171
+ class BrumbyMLP(nn.Module):
172
+ def __init__(self, config):
173
+ super().__init__()
174
+ self.config = config
175
+ self.hidden_size = config.hidden_size
176
+ self.intermediate_size = config.intermediate_size
177
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
178
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
179
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
180
+ self.act_fn = ACT2FN[config.hidden_act]
181
+
182
+ def forward(self, x):
183
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
184
+ return down_proj
185
+
186
+
187
+ def rotate_half(x):
188
+ """Rotates half the hidden dims of the input."""
189
+ x1 = x[..., : x.shape[-1] // 2]
190
+ x2 = x[..., x.shape[-1] // 2 :]
191
+ return torch.cat((-x2, x1), dim=-1)
192
+
193
+
194
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
195
+ """Applies Rotary Position Embedding to the query and key tensors.
196
+
197
+ Args:
198
+ q (`torch.Tensor`): The query tensor.
199
+ k (`torch.Tensor`): The key tensor.
200
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
201
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
202
+ position_ids (`torch.Tensor`, *optional*):
203
+ Deprecated and unused.
204
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
205
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
206
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
207
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
208
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
209
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
210
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
211
+ Returns:
212
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
213
+ """
214
+ cos = cos.unsqueeze(unsqueeze_dim)
215
+ sin = sin.unsqueeze(unsqueeze_dim)
216
+ q_embed = (q * cos) + (rotate_half(q) * sin)
217
+ k_embed = (k * cos) + (rotate_half(k) * sin)
218
+ return q_embed, k_embed
219
+
220
+
221
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
222
+ """
223
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
224
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
225
+ """
226
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
227
+ if n_rep == 1:
228
+ return hidden_states
229
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
230
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
231
+
232
+
233
+ def eager_attention_forward(
234
+ module: nn.Module,
235
+ query: torch.Tensor,
236
+ key: torch.Tensor,
237
+ value: torch.Tensor,
238
+ attention_mask: Optional[torch.Tensor],
239
+ scaling: float,
240
+ dropout: float = 0.0,
241
+ **kwargs: Unpack[TransformersKwargs],
242
+ ):
243
+ key_states = repeat_kv(key, module.num_key_value_groups)
244
+ value_states = repeat_kv(value, module.num_key_value_groups)
245
+
246
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
247
+ if attention_mask is not None:
248
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
249
+ attn_weights = attn_weights + causal_mask
250
+
251
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
252
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
253
+ attn_output = torch.matmul(attn_weights, value_states)
254
+ attn_output = attn_output.transpose(1, 2).contiguous()
255
+
256
+ return attn_output, attn_weights
257
+
258
+
259
+ class BrumbyAttention(nn.Module):
260
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
261
+
262
+ def __init__(self, config: BrumbyConfig, layer_idx: int):
263
+ super().__init__()
264
+ self.config = config
265
+ self.layer_idx = layer_idx
266
+ self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
267
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
268
+ self.scaling = self.head_dim**-0.5
269
+ self.attention_dropout = config.attention_dropout
270
+ self.is_causal = True
271
+ self.use_exp = config.use_exp
272
+ self.prefill_chunk_size = config.prefill_chunk_size
273
+ self.chunk_size = config.chunk_size
274
+ self.switch_over_seq_len = config.switch_over_seq_len
275
+
276
+ self.q_proj = nn.Linear(
277
+ config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
278
+ )
279
+ self.k_proj = nn.Linear(
280
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
281
+ )
282
+ self.v_proj = nn.Linear(
283
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
284
+ )
285
+ self.g_proj = nn.Linear(
286
+ config.hidden_size, config.num_key_value_heads, bias=config.attention_bias
287
+ )
288
+ self.o_proj = nn.Linear(
289
+ config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
290
+ )
291
+ self.q_norm = BrumbyRMSNorm(self.head_dim, eps=config.rms_norm_eps) # unlike olmo, only on the head dim!
292
+ self.k_norm = BrumbyRMSNorm(self.head_dim, eps=config.rms_norm_eps) # thus post q_norm does not need reshape
293
+ self.sliding_window = config.sliding_window if config.layer_types[layer_idx] == "sliding_attention" else None
294
+
295
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
296
+ def forward(
297
+ self,
298
+ hidden_states: torch.Tensor,
299
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
300
+ attention_mask: Optional[torch.Tensor],
301
+ past_key_values: Optional[PowerAttentionDynamicCache] = None,
302
+ cache_position: Optional[torch.LongTensor] = None,
303
+ **kwargs: Unpack[FlashAttentionKwargs],
304
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
305
+ input_shape = hidden_states.shape[:-1]
306
+ hidden_shape = (*input_shape, -1, self.head_dim)
307
+
308
+ query_states = self.q_norm(self.q_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
309
+ key_states = self.k_norm(self.k_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
310
+ value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
311
+ gate_states = self.g_proj(hidden_states).view(hidden_shape[:-1]).transpose(1, 2)
312
+ gate_states = nn.functional.logsigmoid(gate_states.to(torch.float32))
313
+
314
+ cos, sin = position_embeddings
315
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
316
+
317
+ if past_key_values is not None:
318
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
319
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
320
+ key_states, value_states, gate_states, state, sum_of_keys = past_key_values.update_cache(key_states, value_states, gate_states, self.layer_idx, cache_kwargs)
321
+
322
+ if self.use_exp:
323
+ attention_interface: Callable = eager_attention_forward
324
+ if self.config._attn_implementation != "eager":
325
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
326
+
327
+ attn_output, attn_weights = attention_interface(
328
+ self,
329
+ query_states,
330
+ key_states,
331
+ value_states,
332
+ attention_mask,
333
+ dropout=0.0 if not self.training else self.attention_dropout,
334
+ scaling=self.scaling,
335
+ sliding_window=self.sliding_window, # diff with Llama
336
+ **kwargs,
337
+ )
338
+
339
+ elif query_states.shape[2] == 1:
340
+ key_len = key_states.shape[2]
341
+ attn_output, state, sum_of_keys = power_retention_inference(
342
+ query_states.transpose(1, 2),
343
+ key_states.transpose(1, 2),
344
+ value_states.transpose(1, 2),
345
+ gate_states.transpose(1, 2),
346
+ initial_state=state,
347
+ sum_of_keys=sum_of_keys,
348
+ deg=2,
349
+ scale=self.scaling,
350
+ switch_over_seq_len=self.chunk_size,
351
+ )
352
+ if self.chunk_size is not None and key_len >= self.chunk_size:
353
+ past_key_values.clean_cache(self.layer_idx)
354
+ past_key_values.update_state(self.layer_idx, state, sum_of_keys)
355
+
356
+ attn_weights = None
357
+
358
+ else:
359
+ key_len = key_states.shape[2]
360
+ attn_output = power_retention(
361
+ query_states.transpose(1, 2),
362
+ key_states.transpose(1, 2),
363
+ value_states.transpose(1, 2),
364
+ gate_states.transpose(1, 2),
365
+ deg=2,
366
+ scale=self.scaling,
367
+ chunk_size=self.prefill_chunk_size, # enable chunked prefilling by default
368
+ switch_over_seq_len=self.switch_over_seq_len,
369
+ )
370
+ attn_weights = None
371
+
372
+
373
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
374
+ attn_output = self.o_proj(attn_output)
375
+ return attn_output, attn_weights
376
+
377
+
378
+ class BrumbyDecoderLayer(GradientCheckpointingLayer):
379
+ def __init__(self, config: BrumbyConfig, layer_idx: int):
380
+ super().__init__()
381
+ self.hidden_size = config.hidden_size
382
+
383
+ self.self_attn = BrumbyAttention(config=config, layer_idx=layer_idx)
384
+
385
+ self.mlp = BrumbyMLP(config)
386
+ self.input_layernorm = BrumbyRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
387
+ self.post_attention_layernorm = BrumbyRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
388
+ self.attention_type = config.layer_types[layer_idx]
389
+
390
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
391
+ def forward(
392
+ self,
393
+ hidden_states: torch.Tensor,
394
+ attention_mask: Optional[torch.Tensor] = None,
395
+ position_ids: Optional[torch.LongTensor] = None,
396
+ past_key_values: Optional[Cache] = None,
397
+ use_cache: Optional[bool] = False,
398
+ cache_position: Optional[torch.LongTensor] = None,
399
+ position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
400
+ **kwargs: Unpack[TransformersKwargs],
401
+ ) -> torch.Tensor:
402
+ residual = hidden_states
403
+ hidden_states = self.input_layernorm(hidden_states)
404
+ # Self Attention
405
+ hidden_states, _ = self.self_attn(
406
+ hidden_states=hidden_states,
407
+ attention_mask=attention_mask,
408
+ position_ids=position_ids,
409
+ past_key_values=past_key_values,
410
+ use_cache=use_cache,
411
+ cache_position=cache_position,
412
+ position_embeddings=position_embeddings,
413
+ **kwargs,
414
+ )
415
+ hidden_states = residual + hidden_states
416
+
417
+ # Fully Connected
418
+ residual = hidden_states
419
+ hidden_states = self.post_attention_layernorm(hidden_states)
420
+ hidden_states = self.mlp(hidden_states)
421
+ hidden_states = residual + hidden_states
422
+ return hidden_states
423
+
424
+
425
+ @auto_docstring
426
+ class BrumbyPreTrainedModel(PreTrainedModel):
427
+ config: BrumbyConfig
428
+ base_model_prefix = "model"
429
+ supports_gradient_checkpointing = True
430
+ _no_split_modules = ["BrumbyDecoderLayer"]
431
+ _skip_keys_device_placement = ["past_key_values"]
432
+ _supports_flash_attn = True
433
+ _supports_sdpa = True
434
+ _supports_flex_attn = True
435
+
436
+ _can_compile_fullgraph = True
437
+ _supports_attention_backend = True
438
+ _can_record_outputs = {
439
+ "hidden_states": BrumbyDecoderLayer,
440
+ "attentions": BrumbyAttention,
441
+ }
442
+
443
+
444
+ class BrumbyRotaryEmbedding(nn.Module):
445
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
446
+
447
+ def __init__(self, config: BrumbyConfig, device=None):
448
+ super().__init__()
449
+ # BC: "rope_type" was originally "type"
450
+ if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
451
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
452
+ else:
453
+ self.rope_type = "default"
454
+ self.max_seq_len_cached = config.max_position_embeddings
455
+ self.original_max_seq_len = config.max_position_embeddings
456
+
457
+ self.config = config
458
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
459
+
460
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
461
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
462
+ self.original_inv_freq = self.inv_freq
463
+
464
+ @torch.no_grad()
465
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
466
+ def forward(self, x, position_ids):
467
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
468
+ position_ids_expanded = position_ids[:, None, :].float()
469
+
470
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
471
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
472
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
473
+ emb = torch.cat((freqs, freqs), dim=-1)
474
+ cos = emb.cos() * self.attention_scaling
475
+ sin = emb.sin() * self.attention_scaling
476
+
477
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
478
+
479
+
480
+ @auto_docstring
481
+ class BrumbyModel(BrumbyPreTrainedModel):
482
+ def __init__(self, config: BrumbyConfig):
483
+ super().__init__(config)
484
+ self.padding_idx = config.pad_token_id
485
+ self.vocab_size = config.vocab_size
486
+
487
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
488
+ self.layers = nn.ModuleList(
489
+ [BrumbyDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
490
+ )
491
+ self.norm = BrumbyRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
492
+ self.rotary_emb = BrumbyRotaryEmbedding(config=config)
493
+ self.gradient_checkpointing = False
494
+ self.has_sliding_layers = "sliding_attention" in self.config.layer_types
495
+
496
+ # Initialize weights and apply final processing
497
+ self.post_init()
498
+
499
+ @check_model_inputs
500
+ @auto_docstring
501
+ def forward(
502
+ self,
503
+ input_ids: Optional[torch.LongTensor] = None,
504
+ attention_mask: Optional[torch.Tensor] = None,
505
+ position_ids: Optional[torch.LongTensor] = None,
506
+ past_key_values: Optional[PowerAttentionDynamicCache] = None,
507
+ inputs_embeds: Optional[torch.FloatTensor] = None,
508
+ use_cache: Optional[bool] = None,
509
+ cache_position: Optional[torch.LongTensor] = None,
510
+ **kwargs: Unpack[TransformersKwargs],
511
+ ) -> BaseModelOutputWithPast:
512
+ if (input_ids is None) ^ (inputs_embeds is not None):
513
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
514
+
515
+ if inputs_embeds is None:
516
+ inputs_embeds = self.embed_tokens(input_ids)
517
+
518
+ if use_cache and past_key_values is None:
519
+ raise ValueError("Brumby requires an initialized `PowerAttentionDynamicCache` to return a cache. None was provided, so no cache will be returned.")
520
+
521
+ if cache_position is None:
522
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
523
+ cache_position = torch.arange(
524
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
525
+ )
526
+
527
+ if position_ids is None:
528
+ position_ids = cache_position.unsqueeze(0)
529
+
530
+ # It may already have been prepared by e.g. `generate`
531
+ if not isinstance(causal_mask_mapping := attention_mask, dict):
532
+ # Prepare mask arguments
533
+ mask_kwargs = {
534
+ "config": self.config,
535
+ "input_embeds": inputs_embeds,
536
+ "attention_mask": attention_mask,
537
+ "cache_position": cache_position,
538
+ "past_key_values": past_key_values,
539
+ "position_ids": position_ids,
540
+ }
541
+ # Create the masks
542
+ causal_mask_mapping = {
543
+ "full_attention": create_causal_mask(**mask_kwargs),
544
+ }
545
+ # The sliding window alternating layers are not always activated depending on the config
546
+ if self.has_sliding_layers:
547
+ causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
548
+
549
+ hidden_states = inputs_embeds
550
+
551
+ # create position embeddings to be shared across the decoder layers
552
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
553
+
554
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
555
+ hidden_states = decoder_layer(
556
+ hidden_states,
557
+ attention_mask=causal_mask_mapping[decoder_layer.attention_type],
558
+ position_ids=position_ids,
559
+ past_key_values=past_key_values,
560
+ use_cache=use_cache,
561
+ cache_position=cache_position,
562
+ position_embeddings=position_embeddings,
563
+ **kwargs,
564
+ )
565
+
566
+ hidden_states = self.norm(hidden_states)
567
+ return BaseModelOutputWithPast(
568
+ last_hidden_state=hidden_states,
569
+ past_key_values=past_key_values if use_cache else None,
570
+ )
571
+
572
+
573
+ @auto_docstring
574
+ class BrumbyForCausalLM(BrumbyPreTrainedModel, GenerationMixin):
575
+ _tied_weights_keys = ["lm_head.weight"]
576
+ _tp_plan = {"lm_head": "colwise_rep"}
577
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
578
+
579
+ def __init__(self, config):
580
+ super().__init__(config)
581
+ self.model = BrumbyModel(config)
582
+ self.vocab_size = config.vocab_size
583
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
584
+
585
+ # Initialize weights and apply final processing
586
+ self.post_init()
587
+
588
+ def prepare_inputs_for_generation(
589
+ self,
590
+ input_ids,
591
+ past_key_values=None,
592
+ attention_mask=None,
593
+ inputs_embeds=None,
594
+ cache_position=None,
595
+ position_ids=None,
596
+ use_cache=True,
597
+ **kwargs,
598
+ ):
599
+ # Copy from https://github.com/huggingface/transformers/blob/main/src/transformers/models/jamba/modeling_jamba.py
600
+ # Overwitten -- uses `past_key_values` as opposed to `past_key_values`
601
+ empty_past_kv = past_key_values is None
602
+ all_dynamic_cache = isinstance(past_key_values, DynamicCache)
603
+ if all_dynamic_cache:
604
+ past_key_values = PowerAttentionDynamicCache(self.config, input_ids.shape[0], self.dtype, device=self.device)
605
+
606
+ # If we have cache: let's slice `input_ids` through `cache_position`, to keep only the unprocessed tokens
607
+ # Exception 1: when passing input_embeds, input_ids may be missing entries
608
+ # Exception 2: some generation methods do special slicing of input_ids, so we don't need to do it here
609
+ # Exception 3: with synced GPUs cache_position may go out of bounds, but we only want dummy token in that case.
610
+ # (we can't check exception 3 while compiling)
611
+ if not empty_past_kv:
612
+ if (
613
+ inputs_embeds is not None # Exception 1
614
+ or cache_position[-1] >= input_ids.shape[1] # Exception 3
615
+ ):
616
+ input_ids = input_ids[:, -cache_position.shape[0] :]
617
+ elif input_ids.shape[1] != cache_position.shape[0]: # Default case (the "else", a no op, is Exception 2)
618
+ input_ids = input_ids[:, cache_position]
619
+ else:
620
+ past_key_values = PowerAttentionDynamicCache(
621
+ self.config, input_ids.shape[0], self.dtype, device=self.device
622
+ )
623
+
624
+ if attention_mask is not None and position_ids is None:
625
+ # create position_ids on the fly for batch generation
626
+ position_ids = attention_mask.long().cumsum(-1) - 1
627
+ position_ids.masked_fill_(attention_mask == 0, 1)
628
+ if not empty_past_kv:
629
+ position_ids = position_ids[:, -input_ids.shape[1] :]
630
+
631
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
632
+ if inputs_embeds is not None and empty_past_kv:
633
+ # TODO(pjin): workaround fix for properly extending inputs_embeds;
634
+ # longer term, may be better handled elsewhere in .generate().
635
+ if input_ids is not None and inputs_embeds.shape[1] < input_ids.shape[1]:
636
+ new_token_embeds = self.get_input_embeddings()(input_ids[:,inputs_embeds.shape[1]:])
637
+ inputs_embeds = torch.cat([inputs_embeds, new_token_embeds], dim=1)
638
+ model_inputs = {"inputs_embeds": inputs_embeds}
639
+ else:
640
+ model_inputs = {"input_ids": input_ids.contiguous()} # `contiguous()` needed for compilation use cases
641
+
642
+ model_inputs.update(
643
+ {
644
+ "position_ids": position_ids,
645
+ "past_key_values": past_key_values,
646
+ "use_cache": use_cache,
647
+ "attention_mask": attention_mask,
648
+ "cache_position": cache_position,
649
+ }
650
+ )
651
+ return model_inputs
652
+
653
+ @can_return_tuple
654
+ @auto_docstring
655
+ def forward(
656
+ self,
657
+ input_ids: Optional[torch.LongTensor] = None,
658
+ attention_mask: Optional[torch.Tensor] = None,
659
+ position_ids: Optional[torch.LongTensor] = None,
660
+ past_key_values: Optional[PowerAttentionDynamicCache] = None,
661
+ inputs_embeds: Optional[torch.FloatTensor] = None,
662
+ labels: Optional[torch.LongTensor] = None,
663
+ use_cache: Optional[bool] = None,
664
+ cache_position: Optional[torch.LongTensor] = None,
665
+ logits_to_keep: Union[int, torch.Tensor] = 0,
666
+ **kwargs: Unpack[TransformersKwargs],
667
+ ) -> CausalLMOutputWithPast:
668
+ r"""
669
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
670
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
671
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
672
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
673
+
674
+ Example:
675
+
676
+ ```python
677
+ >>> from transformers import AutoTokenizer, BrumbyForCausalLM
678
+
679
+ >>> model = BrumbyForCausalLM.from_pretrained("Qwen/Brumby-8B")
680
+ >>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Brumby-8B")
681
+
682
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
683
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
684
+
685
+ >>> # Generate
686
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
687
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
688
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
689
+ ```"""
690
+ outputs: BaseModelOutputWithPast = self.model(
691
+ input_ids=input_ids,
692
+ attention_mask=attention_mask,
693
+ position_ids=position_ids,
694
+ past_key_values=past_key_values,
695
+ inputs_embeds=inputs_embeds,
696
+ use_cache=use_cache,
697
+ cache_position=cache_position,
698
+ **kwargs,
699
+ )
700
+
701
+ hidden_states = outputs.last_hidden_state
702
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
703
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
704
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
705
+
706
+ loss = None
707
+ if labels is not None:
708
+ loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
709
+
710
+ return CausalLMOutputWithPast(
711
+ loss=loss,
712
+ logits=logits,
713
+ past_key_values=outputs.past_key_values,
714
+ hidden_states=outputs.hidden_states,
715
+ attentions=outputs.attentions,
716
+ )
717
+
718
+
719
+ class BrumbyForSequenceClassification(GenericForSequenceClassification, BrumbyPreTrainedModel):
720
+ pass
721
+
722
+
723
+ class BrumbyForTokenClassification(GenericForTokenClassification, BrumbyPreTrainedModel):
724
+ pass
725
+
726
+
727
+ class BrumbyForQuestionAnswering(GenericForQuestionAnswering, BrumbyPreTrainedModel):
728
+ base_model_prefix = "transformer" # For BC, where `transformer` was used instead of `model`
729
+
730
+
731
+ __all__ = [
732
+ "BrumbyForCausalLM",
733
+ "BrumbyForQuestionAnswering",
734
+ "BrumbyPreTrainedModel",
735
+ "BrumbyModel",
736
+ "BrumbyForSequenceClassification",
737
+ "BrumbyForTokenClassification",
738
+ ]
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\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 {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in message.content %}\n {%- set content = message.content.split('</think>')[-1].lstrip('\\n') %}\n {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first 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 {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
231
+ "clean_up_tokenization_spaces": false,
232
+ "eos_token": "<|endoftext|>",
233
+ "errors": "replace",
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|endoftext|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "Qwen2Tokenizer",
238
+ "unk_token": null
239
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff