Harishapc01 commited on
Commit
68a9ee7
·
verified ·
1 Parent(s): 4daed8f

Initial upload of RishAI-Base-v2: Sparse MoE multilingual model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Rish AI
2
+
3
+ ## Model Description
4
+
5
+ Rish AI is a cutting-edge Mixture of Experts (MoE) transformer model designed for efficient and scalable language understanding and generation. It features sparse routing with 7 experts per token, advanced rotary position embeddings, and optimized attention mechanisms.
6
+
7
+ ## Key Features
8
+
9
+ - **Sparse Mixture of Experts**: 7 experts with 5 experts activated per token for optimal efficiency
10
+ - **Rotary Position Embeddings**: Dynamic RoPE scaling for better long-context handling
11
+ - **Grouped Query Attention**: Efficient attention with reduced key/value heads
12
+ - **RMSNorm**: Improved normalization for stable training
13
+ - **Load Balancing**: Automatic expert load balancing during training
14
+
15
+ ## Usage
16
+
17
+ ### Installation
18
+
19
+ ```bash
20
+ pip install transformers
21
+ ```
22
+
23
+ ### Basic Usage
24
+
25
+ ```python
26
+ from transformers import AutoTokenizer, AutoModelForCausalLM
27
+
28
+ # Load model and tokenizer
29
+ model_name = "your-org/RishAI-1B-7B"
30
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
31
+ model = AutoModelForCausalLM.from_pretrained(model_name)
32
+
33
+ # Prepare input
34
+ text = "Hello, how are you?"
35
+ inputs = tokenizer(text, return_tensors="pt")
36
+
37
+ # Generate response
38
+ outputs = model.generate(**inputs, max_length=50, do_sample=True, temperature=0.7)
39
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
40
+ print(response)
41
+ ```
42
+
43
+ ### Advanced Usage
44
+
45
+ ```python
46
+ import torch
47
+ from transformers import AutoTokenizer, AutoModelForCausalLM
48
+
49
+ # Load model with specific configuration
50
+ model = AutoModelForCausalLM.from_pretrained(
51
+ "your-org/RishAI-1B-7B",
52
+ torch_dtype=torch.bfloat16, # For memory efficiency
53
+ device_map="auto" # Automatic device placement
54
+ )
55
+
56
+ tokenizer = AutoTokenizer.from_pretrained("your-org/RishAI-1B-7B")
57
+
58
+ # Multi-turn conversation
59
+ conversation = [
60
+ {"role": "user", "content": "What is machine learning?"},
61
+ {"role": "assistant", "content": "Machine learning is a subset of AI..."},
62
+ {"role": "user", "content": "Can you give a practical example?"}
63
+ ]
64
+
65
+ # Format conversation
66
+ formatted_input = tokenizer.apply_chat_template(conversation, tokenize=False)
67
+ inputs = tokenizer(formatted_input, return_tensors="pt")
68
+
69
+ # Generate with controlled parameters
70
+ outputs = model.generate(
71
+ **inputs,
72
+ max_length=200,
73
+ temperature=0.8,
74
+ top_p=0.9,
75
+ do_sample=True,
76
+ pad_token_id=tokenizer.eos_token_id
77
+ )
78
+
79
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
80
+ print(response)
81
+ ```
82
+
83
+ ### Model Configuration
84
+
85
+ ```python
86
+ from transformers import RishAIConfig
87
+
88
+ # Create custom configuration
89
+ config = RishAIConfig(
90
+ vocab_size=100352,
91
+ hidden_size=4096,
92
+ num_hidden_layers=32,
93
+ num_attention_heads=32,
94
+ num_experts=7, # Number of experts
95
+ num_experts_per_tok=5, # Experts activated per token
96
+ max_position_embeddings=4096,
97
+ rope_scaling={"rope_type": "dynamic", "factor": 1.0}
98
+ )
99
+
100
+ # Initialize model with config
101
+ from transformers import RishAIModel
102
+ model = RishAIModel(config)
103
+ ```
104
+
105
+ ## Model Architecture
106
+
107
+ ### Sparse Mixture of Experts (MoE)
108
+ - **Experts**: 7 specialized sub-networks
109
+ - **Routing**: Top-5 expert selection per token
110
+ - **Load Balancing**: Automatic expert utilization optimization
111
+
112
+ ### Attention Mechanism
113
+ - **Grouped Query Attention**: Efficient key/value head reduction
114
+ - **Rotary Embeddings**: Position-aware attention with dynamic scaling
115
+ - **RMSNorm**: Stable layer normalization
116
+
117
+ ### Training Features
118
+ - **Gradient Checkpointing**: Memory-efficient training
119
+ - **Flash Attention**: Optimized attention computation
120
+ - **Expert Parallelism**: Distributed expert training
121
+
122
+ ## Performance
123
+
124
+ ### Speed
125
+ - **Inference**: Optimized for fast generation
126
+ - **Training**: Efficient MoE routing and load balancing
127
+ - **Memory**: Sparse activation reduces memory footprint
128
+
129
+ ### Quality
130
+ - **Perplexity**: Competitive with state-of-the-art models
131
+ - **Long Context**: Effective handling of 4K+ token sequences
132
+ - **Multitask**: Strong performance across diverse tasks
133
+
134
+ ## Limitations
135
+
136
+ - Requires significant computational resources for training
137
+ - Memory usage scales with number of active experts
138
+ - Best performance on modern GPUs with ample VRAM
139
+
140
+ ## Citation
141
+
142
+ ```bibtex
143
+ @misc{rishailabs_2026,
144
+ author = { RishAILabs },
145
+ title = { RLLM-Base (Revision 552ee30) },
146
+ year = 2026,
147
+ url = { https://huggingface.co/RishAILabs/RLLM-Base },
148
+ doi = { 10.57967/hf/7560 },
149
+ publisher = { Hugging Face }
150
+ }
151
+ ```
152
+
153
+ ## License
154
+
155
+ This model is released under the Apache 2.0 license.
__init__.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from typing import TYPE_CHECKING
16
+
17
+ from transformers.utils import (
18
+ OptionalDependencyNotAvailable,
19
+ _LazyModule,
20
+ is_tokenizers_available,
21
+ is_torch_available,
22
+ )
23
+
24
+
25
+ _import_structure = {
26
+ "configuration_rish_ai": ["RishAIConfig"],
27
+ }
28
+
29
+ try:
30
+ if not is_torch_available():
31
+ raise OptionalDependencyNotAvailable()
32
+ except OptionalDependencyNotAvailable:
33
+ pass
34
+ else:
35
+ _import_structure["modeling_rish_ai"] = [
36
+ "RishAICausalLM",
37
+ "RishAIModel",
38
+ "RishAIPreTrainedModel",
39
+ ]
40
+
41
+ try:
42
+ if not is_tokenizers_available():
43
+ raise OptionalDependencyNotAvailable()
44
+ except OptionalDependencyNotAvailable:
45
+ pass
46
+ else:
47
+ _import_structure["tokenization_rish_ai"] = ["RishAITokenizer"]
48
+
49
+ if TYPE_CHECKING:
50
+ from .configuration_rish_ai import RishAIConfig
51
+
52
+ try:
53
+ if not is_torch_available():
54
+ raise OptionalDependencyNotAvailable()
55
+ except OptionalDependencyNotAvailable:
56
+ pass
57
+ else:
58
+ from .modeling_rish_ai import (
59
+ RishAICausalLM,
60
+ RishAIModel,
61
+ RishAIPreTrainedModel,
62
+ )
63
+
64
+ try:
65
+ if not is_tokenizers_available():
66
+ raise OptionalDependencyNotAvailable()
67
+ except OptionalDependencyNotAvailable:
68
+ pass
69
+ else:
70
+ from .tokenization_rish_ai import RishAITokenizer
71
+
72
+ else:
73
+ import sys
74
+
75
+ sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = 'You are Rish AI, a powerful large language model built by Rish AI Labs. You are helpful, creative, accurate, and always aim to provide the best possible assistance.' %}{% endif %}{{ '<|im_start|>system\n' + system_message + '<|im_end|>\n' }}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{{ '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "attention_bias": false,
3
+ "attention_dropout": 0.0,
4
+ "eos_token_id": 151645,
5
+ "hidden_act": "silu",
6
+ "hidden_size": 2048,
7
+ "initializer_range": 0.02,
8
+ "intermediate_size": 4864,
9
+ "max_position_embeddings": 4096,
10
+ "model_type": "rish_ai",
11
+ "norm_topk_prob": false,
12
+ "num_attention_heads": 16,
13
+ "num_experts": 7,
14
+ "num_experts_per_tok": 5,
15
+ "num_hidden_layers": 24,
16
+ "num_key_value_heads": 16,
17
+ "output_router_logits": false,
18
+ "pad_token_id": 151643,
19
+ "rms_norm_eps": 1e-06,
20
+ "rope_parameters": {
21
+ "factor": 1.0,
22
+ "rope_theta": 500000.0,
23
+ "rope_type": "dynamic"
24
+ },
25
+ "rope_theta": 500000.0,
26
+ "router_aux_loss_coef": 0.01,
27
+ "tie_word_embeddings": false,
28
+ "transformers_version": "5.0.0rc1",
29
+ "use_cache": true,
30
+ "vocab_size": 151680
31
+ }
configuration_rish_ai.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from transformers.configuration_utils import PretrainedConfig
16
+
17
+
18
+ class RishAIConfig(PretrainedConfig):
19
+ r"""
20
+ Configuration class for RishAI models.
21
+
22
+ Args:
23
+ vocab_size (`int`, *optional*, defaults to 100352):
24
+ Vocabulary size of the RishAI model. Defines the number of different tokens that can be represented by the
25
+ `inputs_ids` passed when calling [`RishAIModel`]
26
+ hidden_size (`int`, *optional*, defaults to 4096):
27
+ Dimension of the hidden representations.
28
+ intermediate_size (`int`, *optional*, defaults to 11008):
29
+ Dimension of the MLP representations.
30
+ num_hidden_layers (`int`, *optional*, defaults to 32):
31
+ Number of hidden layers in the Transformer decoder.
32
+ num_attention_heads (`int`, *optional*, defaults to 32):
33
+ Number of attention heads for each attention layer in the Transformer decoder.
34
+ num_key_value_heads (`int`, *optional*):
35
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
36
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
37
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
38
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
39
+ by meanpooling all the original heads within that group. For more details, check out [this
40
+ paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to
41
+ `num_attention_heads`.
42
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
43
+ The non-linear activation function (function or string) in the decoder.
44
+ max_position_embeddings (`int`, *optional*, defaults to 4096):
45
+ The maximum sequence length that this model might ever be used with.
46
+ initializer_range (`float`, *optional*, defaults to 0.02):
47
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
48
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
49
+ The epsilon used by the rms normalization layers.
50
+ use_cache (`bool`, *optional*, defaults to `True`):
51
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
52
+ relevant if `config.is_decoder=True`.
53
+ pad_token_id (`int`, *optional*, defaults to 100277):
54
+ Padding token id.
55
+ bos_token_id (`int`, *optional*):
56
+ Beginning of stream token id.
57
+ eos_token_id (`int`, *optional*, defaults to 100257):
58
+ End of stream token id.
59
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
60
+ Whether to tie weight embeddings
61
+ rope_theta (`float`, *optional*, defaults to 500000.0):
62
+ The base period of the RoPE embeddings.
63
+ rope_scaling (`Dict`, *optional*):
64
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
65
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
66
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
67
+ `max_position_embeddings` to the expected new maximum. See the following thread for more information on how
68
+ these scaling strategies behave:
69
+ https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an
70
+ experimental feature, subject to breaking API changes in future versions.
71
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
72
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
73
+ attention_dropout (`float`, *optional*, defaults to 0.0):
74
+ The dropout ratio for the attention probabilities.
75
+ num_experts_per_tok (`int`, *optional*, defaults to 5):
76
+ Number of selected experts.
77
+ num_experts (`int`, *optional*, defaults to 7):
78
+ Number of routed experts.
79
+ output_router_logits (`bool`, *optional*, defaults to `False`):
80
+ Whether or not the router logits should be returned by the model. Enabling this will also
81
+ allow the model to output the auxiliary loss, including load balancing loss and router z-loss.
82
+ router_aux_loss_coef (`float`, *optional*, defaults to 0.01):
83
+ The aux loss factor for the total loss.
84
+ norm_topk_prob (`bool`, *optional*, defaults to `False`):
85
+ Whether to normalize the topk probabilities.
86
+
87
+ Example:
88
+ ```python
89
+ >>> from transformers import RishAIConfig, RishAIModel
90
+
91
+ >>> # Initializing a RishAI rish_ai style configuration
92
+ >>> configuration = RishAIConfig()
93
+
94
+ >>> # Initializing a model from the RishAI style configuration
95
+ >>> model = RishAIModel(configuration)
96
+
97
+ >>> # Accessing the model configuration
98
+ >>> configuration = model.config
99
+ ```
100
+ """
101
+
102
+ model_type = "rish_ai"
103
+ keys_to_ignore_at_inference = ["past_key_values"]
104
+
105
+ def __init__(
106
+ self,
107
+ vocab_size=100352,
108
+ hidden_size=4096,
109
+ intermediate_size=11008,
110
+ num_hidden_layers=32,
111
+ num_attention_heads=32,
112
+ num_key_value_heads=None,
113
+ hidden_act="silu",
114
+ max_position_embeddings=4096,
115
+ initializer_range=0.02,
116
+ rms_norm_eps=1e-06,
117
+ use_cache=True,
118
+ pad_token_id=100277,
119
+ bos_token_id=None,
120
+ eos_token_id=100257,
121
+ tie_word_embeddings=False,
122
+ rope_theta=500000.0,
123
+ rope_scaling=None,
124
+ attention_bias=False,
125
+ attention_dropout=0.0,
126
+ num_experts_per_tok=5,
127
+ num_experts=7,
128
+ output_router_logits=False,
129
+ router_aux_loss_coef=0.01,
130
+ norm_topk_prob=False,
131
+ **kwargs,
132
+ ):
133
+ super().__init__(
134
+ pad_token_id=pad_token_id,
135
+ bos_token_id=bos_token_id,
136
+ eos_token_id=eos_token_id,
137
+ tie_word_embeddings=tie_word_embeddings,
138
+ **kwargs,
139
+ )
140
+ self.vocab_size = vocab_size
141
+ self.max_position_embeddings = max_position_embeddings
142
+ self.hidden_size = hidden_size
143
+ self.intermediate_size = intermediate_size
144
+ self.num_hidden_layers = num_hidden_layers
145
+ self.num_attention_heads = num_attention_heads
146
+
147
+ # for backward compatibility
148
+ if num_key_value_heads is None:
149
+ num_key_value_heads = num_attention_heads
150
+
151
+ self.num_key_value_heads = num_key_value_heads
152
+ self.hidden_act = hidden_act
153
+ self.initializer_range = initializer_range
154
+ self.rms_norm_eps = rms_norm_eps
155
+ self.use_cache = use_cache
156
+ self.rope_theta = rope_theta
157
+ self.rope_scaling = rope_scaling
158
+ self.attention_bias = attention_bias
159
+ self.attention_dropout = attention_dropout
160
+ self.num_experts_per_tok = num_experts_per_tok
161
+ self.num_experts = num_experts
162
+ self.output_router_logits = output_router_logits
163
+ self.router_aux_loss_coef = router_aux_loss_coef
164
+ self.norm_topk_prob = norm_topk_prob
165
+
166
+ # Validate the correctness of rotary position embeddings parameters
167
+ # BC: if there is a 'type' field, move it to 'rope_type'.
168
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
169
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
model-00001.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9ba92edcff97c583f1da7fe39c8ef9dc9381679656dee666a46a6706289e1bf
3
+ size 621281392
model-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7d2d5308f18e6671d0e8c87e0687a1309b826b96e3508a9d5997aaaf7ba04ba
3
+ size 525423088
model-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc99cc43bde7302e8c862a7f4916b02a9eff0c67a51d7106ced4ab4d98cbae0f
3
+ size 531677136
model-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c41b0e282276daea39ae7dd1e11132e1d3db312d526337eaa0bd0493088473fa
3
+ size 531677136
model-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4d500f016daed15dad2c23f86953aeaa01b793fbab02432a6714e7205e76eef
3
+ size 531677136
model-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06daf2251a330c5372bb3f87c5ff2397fe6d2f552d003e6c1f17d75272433dea
3
+ size 531677136
model-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae2e038ccbff87f34ced7804dce0756f498eab312097910210c4d317fab03aac
3
+ size 528539944
model-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8de96d7caf628c3934ef67386df5b98053e7b85b7cda9711d5264afa9ccaf1d6
3
+ size 528568704
model-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33d46b20f7c58d1abcf76380a9776c767a8f657752853b56f44d7e200e394435
3
+ size 531677136
model-00010.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17db33c1fac31ec6a78cf425a232ad161faf85913a1a7e13707ff12fad6c55a3
3
+ size 531677152
model-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3d30690e7efdb0016fbcbdabee55bc00dc3231c750f8f666f6f3b87b0d84d85
3
+ size 531677176
model-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1834965f8b4c7f4a9505365a249913bee32e26bae13cc1e902d3a286d07d6b70
3
+ size 531677176
model-00013.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00edd9344392b98b05b6eab4835c94ee6f29642562129c12a0c8fa4184280841
3
+ size 525394360
model-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:431c617283f1c8fc4df7d46e2c63327e99ae30e578dd466953fa8b51784ac300
3
+ size 531714360
model-00015.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c826518e360880929fbd9b20c4ee4045ee9bf61547d9966300959f19c155c9c2
3
+ size 531677168
model-00016.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:122ca68bc7e4f9356b678a6ff94837d9baf2bf0d58f6c7d614c2d1e26a452a86
3
+ size 531677176
model-00017.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9876e539c205689ff88130b059b99d17a2806353efdc8137b0359f75d934ea48
3
+ size 531677176
model-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30ceb3c58dfbc129abc8417d38121d7993fac49e69fe2f1597847550d207b15e
3
+ size 531677168
model-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd7ecc05d88571d9ea75e831afd01c25c14dabaf2e8c1f5680392ab8e296c81e
3
+ size 525431552
model-00020.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2358eda3ae73419db9b423a61204ab01f203ca5494b1cf82ff27577749a058f
3
+ size 531677168
model-00021.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e23ffe56d4277b4b582a6b70a9dfc5e0b45ed1eddebab0f24b27858d0d1b150e
3
+ size 531677176
model-00022.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caea46c2ef9a0755fc98d1ade8dfd5d55b709cb8dd7ce5d4182fe2413196ff77
3
+ size 860370792
model.safetensors.index.json ADDED
@@ -0,0 +1,730 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 12090118144
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001.safetensors",
7
+ "model.layers.0.self_attn.q_proj.weight": "model-00002.safetensors",
8
+ "model.layers.0.self_attn.k_proj.weight": "model-00002.safetensors",
9
+ "model.layers.0.self_attn.v_proj.weight": "model-00002.safetensors",
10
+ "model.layers.0.self_attn.o_proj.weight": "model-00002.safetensors",
11
+ "model.layers.0.self_attn.q_norm.weight": "model-00002.safetensors",
12
+ "model.layers.0.self_attn.k_norm.weight": "model-00002.safetensors",
13
+ "model.layers.0.mlp.gate.weight": "model-00002.safetensors",
14
+ "model.layers.0.mlp.experts.0.gate_proj.weight": "model-00002.safetensors",
15
+ "model.layers.0.mlp.experts.0.up_proj.weight": "model-00002.safetensors",
16
+ "model.layers.0.mlp.experts.0.down_proj.weight": "model-00002.safetensors",
17
+ "model.layers.0.mlp.experts.1.gate_proj.weight": "model-00002.safetensors",
18
+ "model.layers.0.mlp.experts.1.up_proj.weight": "model-00002.safetensors",
19
+ "model.layers.0.mlp.experts.1.down_proj.weight": "model-00002.safetensors",
20
+ "model.layers.0.mlp.experts.2.gate_proj.weight": "model-00002.safetensors",
21
+ "model.layers.0.mlp.experts.2.up_proj.weight": "model-00002.safetensors",
22
+ "model.layers.0.mlp.experts.2.down_proj.weight": "model-00002.safetensors",
23
+ "model.layers.0.mlp.experts.3.gate_proj.weight": "model-00002.safetensors",
24
+ "model.layers.0.mlp.experts.3.up_proj.weight": "model-00002.safetensors",
25
+ "model.layers.0.mlp.experts.3.down_proj.weight": "model-00002.safetensors",
26
+ "model.layers.0.mlp.experts.4.gate_proj.weight": "model-00002.safetensors",
27
+ "model.layers.0.mlp.experts.4.up_proj.weight": "model-00002.safetensors",
28
+ "model.layers.0.mlp.experts.4.down_proj.weight": "model-00002.safetensors",
29
+ "model.layers.0.mlp.experts.5.gate_proj.weight": "model-00002.safetensors",
30
+ "model.layers.0.mlp.experts.5.up_proj.weight": "model-00002.safetensors",
31
+ "model.layers.0.mlp.experts.5.down_proj.weight": "model-00002.safetensors",
32
+ "model.layers.0.mlp.experts.6.gate_proj.weight": "model-00002.safetensors",
33
+ "model.layers.0.mlp.experts.6.up_proj.weight": "model-00002.safetensors",
34
+ "model.layers.0.mlp.experts.6.down_proj.weight": "model-00002.safetensors",
35
+ "model.layers.0.post_attention_layernorm.weight": "model-00002.safetensors",
36
+ "model.layers.0.post_feedforward_layernorm.weight": "model-00002.safetensors",
37
+ "model.layers.1.self_attn.q_proj.weight": "model-00002.safetensors",
38
+ "model.layers.1.self_attn.k_proj.weight": "model-00002.safetensors",
39
+ "model.layers.1.self_attn.v_proj.weight": "model-00002.safetensors",
40
+ "model.layers.1.self_attn.o_proj.weight": "model-00002.safetensors",
41
+ "model.layers.1.self_attn.q_norm.weight": "model-00002.safetensors",
42
+ "model.layers.1.self_attn.k_norm.weight": "model-00002.safetensors",
43
+ "model.layers.1.mlp.gate.weight": "model-00002.safetensors",
44
+ "model.layers.1.mlp.experts.0.gate_proj.weight": "model-00002.safetensors",
45
+ "model.layers.1.mlp.experts.0.up_proj.weight": "model-00002.safetensors",
46
+ "model.layers.1.mlp.experts.0.down_proj.weight": "model-00003.safetensors",
47
+ "model.layers.1.mlp.experts.1.gate_proj.weight": "model-00003.safetensors",
48
+ "model.layers.1.mlp.experts.1.up_proj.weight": "model-00003.safetensors",
49
+ "model.layers.1.mlp.experts.1.down_proj.weight": "model-00003.safetensors",
50
+ "model.layers.1.mlp.experts.2.gate_proj.weight": "model-00003.safetensors",
51
+ "model.layers.1.mlp.experts.2.up_proj.weight": "model-00003.safetensors",
52
+ "model.layers.1.mlp.experts.2.down_proj.weight": "model-00003.safetensors",
53
+ "model.layers.1.mlp.experts.3.gate_proj.weight": "model-00003.safetensors",
54
+ "model.layers.1.mlp.experts.3.up_proj.weight": "model-00003.safetensors",
55
+ "model.layers.1.mlp.experts.3.down_proj.weight": "model-00003.safetensors",
56
+ "model.layers.1.mlp.experts.4.gate_proj.weight": "model-00003.safetensors",
57
+ "model.layers.1.mlp.experts.4.up_proj.weight": "model-00003.safetensors",
58
+ "model.layers.1.mlp.experts.4.down_proj.weight": "model-00003.safetensors",
59
+ "model.layers.1.mlp.experts.5.gate_proj.weight": "model-00003.safetensors",
60
+ "model.layers.1.mlp.experts.5.up_proj.weight": "model-00003.safetensors",
61
+ "model.layers.1.mlp.experts.5.down_proj.weight": "model-00003.safetensors",
62
+ "model.layers.1.mlp.experts.6.gate_proj.weight": "model-00003.safetensors",
63
+ "model.layers.1.mlp.experts.6.up_proj.weight": "model-00003.safetensors",
64
+ "model.layers.1.mlp.experts.6.down_proj.weight": "model-00003.safetensors",
65
+ "model.layers.1.post_attention_layernorm.weight": "model-00003.safetensors",
66
+ "model.layers.1.post_feedforward_layernorm.weight": "model-00003.safetensors",
67
+ "model.layers.2.self_attn.q_proj.weight": "model-00003.safetensors",
68
+ "model.layers.2.self_attn.k_proj.weight": "model-00003.safetensors",
69
+ "model.layers.2.self_attn.v_proj.weight": "model-00003.safetensors",
70
+ "model.layers.2.self_attn.o_proj.weight": "model-00003.safetensors",
71
+ "model.layers.2.self_attn.q_norm.weight": "model-00003.safetensors",
72
+ "model.layers.2.self_attn.k_norm.weight": "model-00003.safetensors",
73
+ "model.layers.2.mlp.gate.weight": "model-00003.safetensors",
74
+ "model.layers.2.mlp.experts.0.gate_proj.weight": "model-00003.safetensors",
75
+ "model.layers.2.mlp.experts.0.up_proj.weight": "model-00003.safetensors",
76
+ "model.layers.2.mlp.experts.0.down_proj.weight": "model-00003.safetensors",
77
+ "model.layers.2.mlp.experts.1.gate_proj.weight": "model-00003.safetensors",
78
+ "model.layers.2.mlp.experts.1.up_proj.weight": "model-00003.safetensors",
79
+ "model.layers.2.mlp.experts.1.down_proj.weight": "model-00003.safetensors",
80
+ "model.layers.2.mlp.experts.2.gate_proj.weight": "model-00004.safetensors",
81
+ "model.layers.2.mlp.experts.2.up_proj.weight": "model-00004.safetensors",
82
+ "model.layers.2.mlp.experts.2.down_proj.weight": "model-00004.safetensors",
83
+ "model.layers.2.mlp.experts.3.gate_proj.weight": "model-00004.safetensors",
84
+ "model.layers.2.mlp.experts.3.up_proj.weight": "model-00004.safetensors",
85
+ "model.layers.2.mlp.experts.3.down_proj.weight": "model-00004.safetensors",
86
+ "model.layers.2.mlp.experts.4.gate_proj.weight": "model-00004.safetensors",
87
+ "model.layers.2.mlp.experts.4.up_proj.weight": "model-00004.safetensors",
88
+ "model.layers.2.mlp.experts.4.down_proj.weight": "model-00004.safetensors",
89
+ "model.layers.2.mlp.experts.5.gate_proj.weight": "model-00004.safetensors",
90
+ "model.layers.2.mlp.experts.5.up_proj.weight": "model-00004.safetensors",
91
+ "model.layers.2.mlp.experts.5.down_proj.weight": "model-00004.safetensors",
92
+ "model.layers.2.mlp.experts.6.gate_proj.weight": "model-00004.safetensors",
93
+ "model.layers.2.mlp.experts.6.up_proj.weight": "model-00004.safetensors",
94
+ "model.layers.2.mlp.experts.6.down_proj.weight": "model-00004.safetensors",
95
+ "model.layers.2.post_attention_layernorm.weight": "model-00004.safetensors",
96
+ "model.layers.2.post_feedforward_layernorm.weight": "model-00004.safetensors",
97
+ "model.layers.3.self_attn.q_proj.weight": "model-00004.safetensors",
98
+ "model.layers.3.self_attn.k_proj.weight": "model-00004.safetensors",
99
+ "model.layers.3.self_attn.v_proj.weight": "model-00004.safetensors",
100
+ "model.layers.3.self_attn.o_proj.weight": "model-00004.safetensors",
101
+ "model.layers.3.self_attn.q_norm.weight": "model-00004.safetensors",
102
+ "model.layers.3.self_attn.k_norm.weight": "model-00004.safetensors",
103
+ "model.layers.3.mlp.gate.weight": "model-00004.safetensors",
104
+ "model.layers.3.mlp.experts.0.gate_proj.weight": "model-00004.safetensors",
105
+ "model.layers.3.mlp.experts.0.up_proj.weight": "model-00004.safetensors",
106
+ "model.layers.3.mlp.experts.0.down_proj.weight": "model-00004.safetensors",
107
+ "model.layers.3.mlp.experts.1.gate_proj.weight": "model-00004.safetensors",
108
+ "model.layers.3.mlp.experts.1.up_proj.weight": "model-00004.safetensors",
109
+ "model.layers.3.mlp.experts.1.down_proj.weight": "model-00004.safetensors",
110
+ "model.layers.3.mlp.experts.2.gate_proj.weight": "model-00004.safetensors",
111
+ "model.layers.3.mlp.experts.2.up_proj.weight": "model-00004.safetensors",
112
+ "model.layers.3.mlp.experts.2.down_proj.weight": "model-00004.safetensors",
113
+ "model.layers.3.mlp.experts.3.gate_proj.weight": "model-00004.safetensors",
114
+ "model.layers.3.mlp.experts.3.up_proj.weight": "model-00005.safetensors",
115
+ "model.layers.3.mlp.experts.3.down_proj.weight": "model-00005.safetensors",
116
+ "model.layers.3.mlp.experts.4.gate_proj.weight": "model-00005.safetensors",
117
+ "model.layers.3.mlp.experts.4.up_proj.weight": "model-00005.safetensors",
118
+ "model.layers.3.mlp.experts.4.down_proj.weight": "model-00005.safetensors",
119
+ "model.layers.3.mlp.experts.5.gate_proj.weight": "model-00005.safetensors",
120
+ "model.layers.3.mlp.experts.5.up_proj.weight": "model-00005.safetensors",
121
+ "model.layers.3.mlp.experts.5.down_proj.weight": "model-00005.safetensors",
122
+ "model.layers.3.mlp.experts.6.gate_proj.weight": "model-00005.safetensors",
123
+ "model.layers.3.mlp.experts.6.up_proj.weight": "model-00005.safetensors",
124
+ "model.layers.3.mlp.experts.6.down_proj.weight": "model-00005.safetensors",
125
+ "model.layers.3.post_attention_layernorm.weight": "model-00005.safetensors",
126
+ "model.layers.3.post_feedforward_layernorm.weight": "model-00005.safetensors",
127
+ "model.layers.4.self_attn.q_proj.weight": "model-00005.safetensors",
128
+ "model.layers.4.self_attn.k_proj.weight": "model-00005.safetensors",
129
+ "model.layers.4.self_attn.v_proj.weight": "model-00005.safetensors",
130
+ "model.layers.4.self_attn.o_proj.weight": "model-00005.safetensors",
131
+ "model.layers.4.self_attn.q_norm.weight": "model-00005.safetensors",
132
+ "model.layers.4.self_attn.k_norm.weight": "model-00005.safetensors",
133
+ "model.layers.4.mlp.gate.weight": "model-00005.safetensors",
134
+ "model.layers.4.mlp.experts.0.gate_proj.weight": "model-00005.safetensors",
135
+ "model.layers.4.mlp.experts.0.up_proj.weight": "model-00005.safetensors",
136
+ "model.layers.4.mlp.experts.0.down_proj.weight": "model-00005.safetensors",
137
+ "model.layers.4.mlp.experts.1.gate_proj.weight": "model-00005.safetensors",
138
+ "model.layers.4.mlp.experts.1.up_proj.weight": "model-00005.safetensors",
139
+ "model.layers.4.mlp.experts.1.down_proj.weight": "model-00005.safetensors",
140
+ "model.layers.4.mlp.experts.2.gate_proj.weight": "model-00005.safetensors",
141
+ "model.layers.4.mlp.experts.2.up_proj.weight": "model-00005.safetensors",
142
+ "model.layers.4.mlp.experts.2.down_proj.weight": "model-00005.safetensors",
143
+ "model.layers.4.mlp.experts.3.gate_proj.weight": "model-00005.safetensors",
144
+ "model.layers.4.mlp.experts.3.up_proj.weight": "model-00005.safetensors",
145
+ "model.layers.4.mlp.experts.3.down_proj.weight": "model-00005.safetensors",
146
+ "model.layers.4.mlp.experts.4.gate_proj.weight": "model-00005.safetensors",
147
+ "model.layers.4.mlp.experts.4.up_proj.weight": "model-00005.safetensors",
148
+ "model.layers.4.mlp.experts.4.down_proj.weight": "model-00006.safetensors",
149
+ "model.layers.4.mlp.experts.5.gate_proj.weight": "model-00006.safetensors",
150
+ "model.layers.4.mlp.experts.5.up_proj.weight": "model-00006.safetensors",
151
+ "model.layers.4.mlp.experts.5.down_proj.weight": "model-00006.safetensors",
152
+ "model.layers.4.mlp.experts.6.gate_proj.weight": "model-00006.safetensors",
153
+ "model.layers.4.mlp.experts.6.up_proj.weight": "model-00006.safetensors",
154
+ "model.layers.4.mlp.experts.6.down_proj.weight": "model-00006.safetensors",
155
+ "model.layers.4.post_attention_layernorm.weight": "model-00006.safetensors",
156
+ "model.layers.4.post_feedforward_layernorm.weight": "model-00006.safetensors",
157
+ "model.layers.5.self_attn.q_proj.weight": "model-00006.safetensors",
158
+ "model.layers.5.self_attn.k_proj.weight": "model-00006.safetensors",
159
+ "model.layers.5.self_attn.v_proj.weight": "model-00006.safetensors",
160
+ "model.layers.5.self_attn.o_proj.weight": "model-00006.safetensors",
161
+ "model.layers.5.self_attn.q_norm.weight": "model-00006.safetensors",
162
+ "model.layers.5.self_attn.k_norm.weight": "model-00006.safetensors",
163
+ "model.layers.5.mlp.gate.weight": "model-00006.safetensors",
164
+ "model.layers.5.mlp.experts.0.gate_proj.weight": "model-00006.safetensors",
165
+ "model.layers.5.mlp.experts.0.up_proj.weight": "model-00006.safetensors",
166
+ "model.layers.5.mlp.experts.0.down_proj.weight": "model-00006.safetensors",
167
+ "model.layers.5.mlp.experts.1.gate_proj.weight": "model-00006.safetensors",
168
+ "model.layers.5.mlp.experts.1.up_proj.weight": "model-00006.safetensors",
169
+ "model.layers.5.mlp.experts.1.down_proj.weight": "model-00006.safetensors",
170
+ "model.layers.5.mlp.experts.2.gate_proj.weight": "model-00006.safetensors",
171
+ "model.layers.5.mlp.experts.2.up_proj.weight": "model-00006.safetensors",
172
+ "model.layers.5.mlp.experts.2.down_proj.weight": "model-00006.safetensors",
173
+ "model.layers.5.mlp.experts.3.gate_proj.weight": "model-00006.safetensors",
174
+ "model.layers.5.mlp.experts.3.up_proj.weight": "model-00006.safetensors",
175
+ "model.layers.5.mlp.experts.3.down_proj.weight": "model-00006.safetensors",
176
+ "model.layers.5.mlp.experts.4.gate_proj.weight": "model-00006.safetensors",
177
+ "model.layers.5.mlp.experts.4.up_proj.weight": "model-00006.safetensors",
178
+ "model.layers.5.mlp.experts.4.down_proj.weight": "model-00006.safetensors",
179
+ "model.layers.5.mlp.experts.5.gate_proj.weight": "model-00006.safetensors",
180
+ "model.layers.5.mlp.experts.5.up_proj.weight": "model-00006.safetensors",
181
+ "model.layers.5.mlp.experts.5.down_proj.weight": "model-00006.safetensors",
182
+ "model.layers.5.mlp.experts.6.gate_proj.weight": "model-00007.safetensors",
183
+ "model.layers.5.mlp.experts.6.up_proj.weight": "model-00007.safetensors",
184
+ "model.layers.5.mlp.experts.6.down_proj.weight": "model-00007.safetensors",
185
+ "model.layers.5.post_attention_layernorm.weight": "model-00007.safetensors",
186
+ "model.layers.5.post_feedforward_layernorm.weight": "model-00007.safetensors",
187
+ "model.layers.6.self_attn.q_proj.weight": "model-00007.safetensors",
188
+ "model.layers.6.self_attn.k_proj.weight": "model-00007.safetensors",
189
+ "model.layers.6.self_attn.v_proj.weight": "model-00007.safetensors",
190
+ "model.layers.6.self_attn.o_proj.weight": "model-00007.safetensors",
191
+ "model.layers.6.self_attn.q_norm.weight": "model-00007.safetensors",
192
+ "model.layers.6.self_attn.k_norm.weight": "model-00007.safetensors",
193
+ "model.layers.6.mlp.gate.weight": "model-00007.safetensors",
194
+ "model.layers.6.mlp.experts.0.gate_proj.weight": "model-00007.safetensors",
195
+ "model.layers.6.mlp.experts.0.up_proj.weight": "model-00007.safetensors",
196
+ "model.layers.6.mlp.experts.0.down_proj.weight": "model-00007.safetensors",
197
+ "model.layers.6.mlp.experts.1.gate_proj.weight": "model-00007.safetensors",
198
+ "model.layers.6.mlp.experts.1.up_proj.weight": "model-00007.safetensors",
199
+ "model.layers.6.mlp.experts.1.down_proj.weight": "model-00007.safetensors",
200
+ "model.layers.6.mlp.experts.2.gate_proj.weight": "model-00007.safetensors",
201
+ "model.layers.6.mlp.experts.2.up_proj.weight": "model-00007.safetensors",
202
+ "model.layers.6.mlp.experts.2.down_proj.weight": "model-00007.safetensors",
203
+ "model.layers.6.mlp.experts.3.gate_proj.weight": "model-00007.safetensors",
204
+ "model.layers.6.mlp.experts.3.up_proj.weight": "model-00007.safetensors",
205
+ "model.layers.6.mlp.experts.3.down_proj.weight": "model-00007.safetensors",
206
+ "model.layers.6.mlp.experts.4.gate_proj.weight": "model-00007.safetensors",
207
+ "model.layers.6.mlp.experts.4.up_proj.weight": "model-00007.safetensors",
208
+ "model.layers.6.mlp.experts.4.down_proj.weight": "model-00007.safetensors",
209
+ "model.layers.6.mlp.experts.5.gate_proj.weight": "model-00007.safetensors",
210
+ "model.layers.6.mlp.experts.5.up_proj.weight": "model-00007.safetensors",
211
+ "model.layers.6.mlp.experts.5.down_proj.weight": "model-00007.safetensors",
212
+ "model.layers.6.mlp.experts.6.gate_proj.weight": "model-00007.safetensors",
213
+ "model.layers.6.mlp.experts.6.up_proj.weight": "model-00007.safetensors",
214
+ "model.layers.6.mlp.experts.6.down_proj.weight": "model-00007.safetensors",
215
+ "model.layers.6.post_attention_layernorm.weight": "model-00007.safetensors",
216
+ "model.layers.6.post_feedforward_layernorm.weight": "model-00007.safetensors",
217
+ "model.layers.7.self_attn.q_proj.weight": "model-00007.safetensors",
218
+ "model.layers.7.self_attn.k_proj.weight": "model-00007.safetensors",
219
+ "model.layers.7.self_attn.v_proj.weight": "model-00008.safetensors",
220
+ "model.layers.7.self_attn.o_proj.weight": "model-00008.safetensors",
221
+ "model.layers.7.self_attn.q_norm.weight": "model-00008.safetensors",
222
+ "model.layers.7.self_attn.k_norm.weight": "model-00008.safetensors",
223
+ "model.layers.7.mlp.gate.weight": "model-00008.safetensors",
224
+ "model.layers.7.mlp.experts.0.gate_proj.weight": "model-00008.safetensors",
225
+ "model.layers.7.mlp.experts.0.up_proj.weight": "model-00008.safetensors",
226
+ "model.layers.7.mlp.experts.0.down_proj.weight": "model-00008.safetensors",
227
+ "model.layers.7.mlp.experts.1.gate_proj.weight": "model-00008.safetensors",
228
+ "model.layers.7.mlp.experts.1.up_proj.weight": "model-00008.safetensors",
229
+ "model.layers.7.mlp.experts.1.down_proj.weight": "model-00008.safetensors",
230
+ "model.layers.7.mlp.experts.2.gate_proj.weight": "model-00008.safetensors",
231
+ "model.layers.7.mlp.experts.2.up_proj.weight": "model-00008.safetensors",
232
+ "model.layers.7.mlp.experts.2.down_proj.weight": "model-00008.safetensors",
233
+ "model.layers.7.mlp.experts.3.gate_proj.weight": "model-00008.safetensors",
234
+ "model.layers.7.mlp.experts.3.up_proj.weight": "model-00008.safetensors",
235
+ "model.layers.7.mlp.experts.3.down_proj.weight": "model-00008.safetensors",
236
+ "model.layers.7.mlp.experts.4.gate_proj.weight": "model-00008.safetensors",
237
+ "model.layers.7.mlp.experts.4.up_proj.weight": "model-00008.safetensors",
238
+ "model.layers.7.mlp.experts.4.down_proj.weight": "model-00008.safetensors",
239
+ "model.layers.7.mlp.experts.5.gate_proj.weight": "model-00008.safetensors",
240
+ "model.layers.7.mlp.experts.5.up_proj.weight": "model-00008.safetensors",
241
+ "model.layers.7.mlp.experts.5.down_proj.weight": "model-00008.safetensors",
242
+ "model.layers.7.mlp.experts.6.gate_proj.weight": "model-00008.safetensors",
243
+ "model.layers.7.mlp.experts.6.up_proj.weight": "model-00008.safetensors",
244
+ "model.layers.7.mlp.experts.6.down_proj.weight": "model-00008.safetensors",
245
+ "model.layers.7.post_attention_layernorm.weight": "model-00008.safetensors",
246
+ "model.layers.7.post_feedforward_layernorm.weight": "model-00008.safetensors",
247
+ "model.layers.8.self_attn.q_proj.weight": "model-00008.safetensors",
248
+ "model.layers.8.self_attn.k_proj.weight": "model-00008.safetensors",
249
+ "model.layers.8.self_attn.v_proj.weight": "model-00008.safetensors",
250
+ "model.layers.8.self_attn.o_proj.weight": "model-00008.safetensors",
251
+ "model.layers.8.self_attn.q_norm.weight": "model-00008.safetensors",
252
+ "model.layers.8.self_attn.k_norm.weight": "model-00008.safetensors",
253
+ "model.layers.8.mlp.gate.weight": "model-00008.safetensors",
254
+ "model.layers.8.mlp.experts.0.gate_proj.weight": "model-00008.safetensors",
255
+ "model.layers.8.mlp.experts.0.up_proj.weight": "model-00008.safetensors",
256
+ "model.layers.8.mlp.experts.0.down_proj.weight": "model-00008.safetensors",
257
+ "model.layers.8.mlp.experts.1.gate_proj.weight": "model-00009.safetensors",
258
+ "model.layers.8.mlp.experts.1.up_proj.weight": "model-00009.safetensors",
259
+ "model.layers.8.mlp.experts.1.down_proj.weight": "model-00009.safetensors",
260
+ "model.layers.8.mlp.experts.2.gate_proj.weight": "model-00009.safetensors",
261
+ "model.layers.8.mlp.experts.2.up_proj.weight": "model-00009.safetensors",
262
+ "model.layers.8.mlp.experts.2.down_proj.weight": "model-00009.safetensors",
263
+ "model.layers.8.mlp.experts.3.gate_proj.weight": "model-00009.safetensors",
264
+ "model.layers.8.mlp.experts.3.up_proj.weight": "model-00009.safetensors",
265
+ "model.layers.8.mlp.experts.3.down_proj.weight": "model-00009.safetensors",
266
+ "model.layers.8.mlp.experts.4.gate_proj.weight": "model-00009.safetensors",
267
+ "model.layers.8.mlp.experts.4.up_proj.weight": "model-00009.safetensors",
268
+ "model.layers.8.mlp.experts.4.down_proj.weight": "model-00009.safetensors",
269
+ "model.layers.8.mlp.experts.5.gate_proj.weight": "model-00009.safetensors",
270
+ "model.layers.8.mlp.experts.5.up_proj.weight": "model-00009.safetensors",
271
+ "model.layers.8.mlp.experts.5.down_proj.weight": "model-00009.safetensors",
272
+ "model.layers.8.mlp.experts.6.gate_proj.weight": "model-00009.safetensors",
273
+ "model.layers.8.mlp.experts.6.up_proj.weight": "model-00009.safetensors",
274
+ "model.layers.8.mlp.experts.6.down_proj.weight": "model-00009.safetensors",
275
+ "model.layers.8.post_attention_layernorm.weight": "model-00009.safetensors",
276
+ "model.layers.8.post_feedforward_layernorm.weight": "model-00009.safetensors",
277
+ "model.layers.9.self_attn.q_proj.weight": "model-00009.safetensors",
278
+ "model.layers.9.self_attn.k_proj.weight": "model-00009.safetensors",
279
+ "model.layers.9.self_attn.v_proj.weight": "model-00009.safetensors",
280
+ "model.layers.9.self_attn.o_proj.weight": "model-00009.safetensors",
281
+ "model.layers.9.self_attn.q_norm.weight": "model-00009.safetensors",
282
+ "model.layers.9.self_attn.k_norm.weight": "model-00009.safetensors",
283
+ "model.layers.9.mlp.gate.weight": "model-00009.safetensors",
284
+ "model.layers.9.mlp.experts.0.gate_proj.weight": "model-00009.safetensors",
285
+ "model.layers.9.mlp.experts.0.up_proj.weight": "model-00009.safetensors",
286
+ "model.layers.9.mlp.experts.0.down_proj.weight": "model-00009.safetensors",
287
+ "model.layers.9.mlp.experts.1.gate_proj.weight": "model-00009.safetensors",
288
+ "model.layers.9.mlp.experts.1.up_proj.weight": "model-00009.safetensors",
289
+ "model.layers.9.mlp.experts.1.down_proj.weight": "model-00009.safetensors",
290
+ "model.layers.9.mlp.experts.2.gate_proj.weight": "model-00009.safetensors",
291
+ "model.layers.9.mlp.experts.2.up_proj.weight": "model-00010.safetensors",
292
+ "model.layers.9.mlp.experts.2.down_proj.weight": "model-00010.safetensors",
293
+ "model.layers.9.mlp.experts.3.gate_proj.weight": "model-00010.safetensors",
294
+ "model.layers.9.mlp.experts.3.up_proj.weight": "model-00010.safetensors",
295
+ "model.layers.9.mlp.experts.3.down_proj.weight": "model-00010.safetensors",
296
+ "model.layers.9.mlp.experts.4.gate_proj.weight": "model-00010.safetensors",
297
+ "model.layers.9.mlp.experts.4.up_proj.weight": "model-00010.safetensors",
298
+ "model.layers.9.mlp.experts.4.down_proj.weight": "model-00010.safetensors",
299
+ "model.layers.9.mlp.experts.5.gate_proj.weight": "model-00010.safetensors",
300
+ "model.layers.9.mlp.experts.5.up_proj.weight": "model-00010.safetensors",
301
+ "model.layers.9.mlp.experts.5.down_proj.weight": "model-00010.safetensors",
302
+ "model.layers.9.mlp.experts.6.gate_proj.weight": "model-00010.safetensors",
303
+ "model.layers.9.mlp.experts.6.up_proj.weight": "model-00010.safetensors",
304
+ "model.layers.9.mlp.experts.6.down_proj.weight": "model-00010.safetensors",
305
+ "model.layers.9.post_attention_layernorm.weight": "model-00010.safetensors",
306
+ "model.layers.9.post_feedforward_layernorm.weight": "model-00010.safetensors",
307
+ "model.layers.10.self_attn.q_proj.weight": "model-00010.safetensors",
308
+ "model.layers.10.self_attn.k_proj.weight": "model-00010.safetensors",
309
+ "model.layers.10.self_attn.v_proj.weight": "model-00010.safetensors",
310
+ "model.layers.10.self_attn.o_proj.weight": "model-00010.safetensors",
311
+ "model.layers.10.self_attn.q_norm.weight": "model-00010.safetensors",
312
+ "model.layers.10.self_attn.k_norm.weight": "model-00010.safetensors",
313
+ "model.layers.10.mlp.gate.weight": "model-00010.safetensors",
314
+ "model.layers.10.mlp.experts.0.gate_proj.weight": "model-00010.safetensors",
315
+ "model.layers.10.mlp.experts.0.up_proj.weight": "model-00010.safetensors",
316
+ "model.layers.10.mlp.experts.0.down_proj.weight": "model-00010.safetensors",
317
+ "model.layers.10.mlp.experts.1.gate_proj.weight": "model-00010.safetensors",
318
+ "model.layers.10.mlp.experts.1.up_proj.weight": "model-00010.safetensors",
319
+ "model.layers.10.mlp.experts.1.down_proj.weight": "model-00010.safetensors",
320
+ "model.layers.10.mlp.experts.2.gate_proj.weight": "model-00010.safetensors",
321
+ "model.layers.10.mlp.experts.2.up_proj.weight": "model-00010.safetensors",
322
+ "model.layers.10.mlp.experts.2.down_proj.weight": "model-00010.safetensors",
323
+ "model.layers.10.mlp.experts.3.gate_proj.weight": "model-00010.safetensors",
324
+ "model.layers.10.mlp.experts.3.up_proj.weight": "model-00010.safetensors",
325
+ "model.layers.10.mlp.experts.3.down_proj.weight": "model-00011.safetensors",
326
+ "model.layers.10.mlp.experts.4.gate_proj.weight": "model-00011.safetensors",
327
+ "model.layers.10.mlp.experts.4.up_proj.weight": "model-00011.safetensors",
328
+ "model.layers.10.mlp.experts.4.down_proj.weight": "model-00011.safetensors",
329
+ "model.layers.10.mlp.experts.5.gate_proj.weight": "model-00011.safetensors",
330
+ "model.layers.10.mlp.experts.5.up_proj.weight": "model-00011.safetensors",
331
+ "model.layers.10.mlp.experts.5.down_proj.weight": "model-00011.safetensors",
332
+ "model.layers.10.mlp.experts.6.gate_proj.weight": "model-00011.safetensors",
333
+ "model.layers.10.mlp.experts.6.up_proj.weight": "model-00011.safetensors",
334
+ "model.layers.10.mlp.experts.6.down_proj.weight": "model-00011.safetensors",
335
+ "model.layers.10.post_attention_layernorm.weight": "model-00011.safetensors",
336
+ "model.layers.10.post_feedforward_layernorm.weight": "model-00011.safetensors",
337
+ "model.layers.11.self_attn.q_proj.weight": "model-00011.safetensors",
338
+ "model.layers.11.self_attn.k_proj.weight": "model-00011.safetensors",
339
+ "model.layers.11.self_attn.v_proj.weight": "model-00011.safetensors",
340
+ "model.layers.11.self_attn.o_proj.weight": "model-00011.safetensors",
341
+ "model.layers.11.self_attn.q_norm.weight": "model-00011.safetensors",
342
+ "model.layers.11.self_attn.k_norm.weight": "model-00011.safetensors",
343
+ "model.layers.11.mlp.gate.weight": "model-00011.safetensors",
344
+ "model.layers.11.mlp.experts.0.gate_proj.weight": "model-00011.safetensors",
345
+ "model.layers.11.mlp.experts.0.up_proj.weight": "model-00011.safetensors",
346
+ "model.layers.11.mlp.experts.0.down_proj.weight": "model-00011.safetensors",
347
+ "model.layers.11.mlp.experts.1.gate_proj.weight": "model-00011.safetensors",
348
+ "model.layers.11.mlp.experts.1.up_proj.weight": "model-00011.safetensors",
349
+ "model.layers.11.mlp.experts.1.down_proj.weight": "model-00011.safetensors",
350
+ "model.layers.11.mlp.experts.2.gate_proj.weight": "model-00011.safetensors",
351
+ "model.layers.11.mlp.experts.2.up_proj.weight": "model-00011.safetensors",
352
+ "model.layers.11.mlp.experts.2.down_proj.weight": "model-00011.safetensors",
353
+ "model.layers.11.mlp.experts.3.gate_proj.weight": "model-00011.safetensors",
354
+ "model.layers.11.mlp.experts.3.up_proj.weight": "model-00011.safetensors",
355
+ "model.layers.11.mlp.experts.3.down_proj.weight": "model-00011.safetensors",
356
+ "model.layers.11.mlp.experts.4.gate_proj.weight": "model-00011.safetensors",
357
+ "model.layers.11.mlp.experts.4.up_proj.weight": "model-00011.safetensors",
358
+ "model.layers.11.mlp.experts.4.down_proj.weight": "model-00011.safetensors",
359
+ "model.layers.11.mlp.experts.5.gate_proj.weight": "model-00012.safetensors",
360
+ "model.layers.11.mlp.experts.5.up_proj.weight": "model-00012.safetensors",
361
+ "model.layers.11.mlp.experts.5.down_proj.weight": "model-00012.safetensors",
362
+ "model.layers.11.mlp.experts.6.gate_proj.weight": "model-00012.safetensors",
363
+ "model.layers.11.mlp.experts.6.up_proj.weight": "model-00012.safetensors",
364
+ "model.layers.11.mlp.experts.6.down_proj.weight": "model-00012.safetensors",
365
+ "model.layers.11.post_attention_layernorm.weight": "model-00012.safetensors",
366
+ "model.layers.11.post_feedforward_layernorm.weight": "model-00012.safetensors",
367
+ "model.layers.12.self_attn.q_proj.weight": "model-00012.safetensors",
368
+ "model.layers.12.self_attn.k_proj.weight": "model-00012.safetensors",
369
+ "model.layers.12.self_attn.v_proj.weight": "model-00012.safetensors",
370
+ "model.layers.12.self_attn.o_proj.weight": "model-00012.safetensors",
371
+ "model.layers.12.self_attn.q_norm.weight": "model-00012.safetensors",
372
+ "model.layers.12.self_attn.k_norm.weight": "model-00012.safetensors",
373
+ "model.layers.12.mlp.gate.weight": "model-00012.safetensors",
374
+ "model.layers.12.mlp.experts.0.gate_proj.weight": "model-00012.safetensors",
375
+ "model.layers.12.mlp.experts.0.up_proj.weight": "model-00012.safetensors",
376
+ "model.layers.12.mlp.experts.0.down_proj.weight": "model-00012.safetensors",
377
+ "model.layers.12.mlp.experts.1.gate_proj.weight": "model-00012.safetensors",
378
+ "model.layers.12.mlp.experts.1.up_proj.weight": "model-00012.safetensors",
379
+ "model.layers.12.mlp.experts.1.down_proj.weight": "model-00012.safetensors",
380
+ "model.layers.12.mlp.experts.2.gate_proj.weight": "model-00012.safetensors",
381
+ "model.layers.12.mlp.experts.2.up_proj.weight": "model-00012.safetensors",
382
+ "model.layers.12.mlp.experts.2.down_proj.weight": "model-00012.safetensors",
383
+ "model.layers.12.mlp.experts.3.gate_proj.weight": "model-00012.safetensors",
384
+ "model.layers.12.mlp.experts.3.up_proj.weight": "model-00012.safetensors",
385
+ "model.layers.12.mlp.experts.3.down_proj.weight": "model-00012.safetensors",
386
+ "model.layers.12.mlp.experts.4.gate_proj.weight": "model-00012.safetensors",
387
+ "model.layers.12.mlp.experts.4.up_proj.weight": "model-00012.safetensors",
388
+ "model.layers.12.mlp.experts.4.down_proj.weight": "model-00012.safetensors",
389
+ "model.layers.12.mlp.experts.5.gate_proj.weight": "model-00012.safetensors",
390
+ "model.layers.12.mlp.experts.5.up_proj.weight": "model-00012.safetensors",
391
+ "model.layers.12.mlp.experts.5.down_proj.weight": "model-00012.safetensors",
392
+ "model.layers.12.mlp.experts.6.gate_proj.weight": "model-00012.safetensors",
393
+ "model.layers.12.mlp.experts.6.up_proj.weight": "model-00013.safetensors",
394
+ "model.layers.12.mlp.experts.6.down_proj.weight": "model-00013.safetensors",
395
+ "model.layers.12.post_attention_layernorm.weight": "model-00013.safetensors",
396
+ "model.layers.12.post_feedforward_layernorm.weight": "model-00013.safetensors",
397
+ "model.layers.13.self_attn.q_proj.weight": "model-00013.safetensors",
398
+ "model.layers.13.self_attn.k_proj.weight": "model-00013.safetensors",
399
+ "model.layers.13.self_attn.v_proj.weight": "model-00013.safetensors",
400
+ "model.layers.13.self_attn.o_proj.weight": "model-00013.safetensors",
401
+ "model.layers.13.self_attn.q_norm.weight": "model-00013.safetensors",
402
+ "model.layers.13.self_attn.k_norm.weight": "model-00013.safetensors",
403
+ "model.layers.13.mlp.gate.weight": "model-00013.safetensors",
404
+ "model.layers.13.mlp.experts.0.gate_proj.weight": "model-00013.safetensors",
405
+ "model.layers.13.mlp.experts.0.up_proj.weight": "model-00013.safetensors",
406
+ "model.layers.13.mlp.experts.0.down_proj.weight": "model-00013.safetensors",
407
+ "model.layers.13.mlp.experts.1.gate_proj.weight": "model-00013.safetensors",
408
+ "model.layers.13.mlp.experts.1.up_proj.weight": "model-00013.safetensors",
409
+ "model.layers.13.mlp.experts.1.down_proj.weight": "model-00013.safetensors",
410
+ "model.layers.13.mlp.experts.2.gate_proj.weight": "model-00013.safetensors",
411
+ "model.layers.13.mlp.experts.2.up_proj.weight": "model-00013.safetensors",
412
+ "model.layers.13.mlp.experts.2.down_proj.weight": "model-00013.safetensors",
413
+ "model.layers.13.mlp.experts.3.gate_proj.weight": "model-00013.safetensors",
414
+ "model.layers.13.mlp.experts.3.up_proj.weight": "model-00013.safetensors",
415
+ "model.layers.13.mlp.experts.3.down_proj.weight": "model-00013.safetensors",
416
+ "model.layers.13.mlp.experts.4.gate_proj.weight": "model-00013.safetensors",
417
+ "model.layers.13.mlp.experts.4.up_proj.weight": "model-00013.safetensors",
418
+ "model.layers.13.mlp.experts.4.down_proj.weight": "model-00013.safetensors",
419
+ "model.layers.13.mlp.experts.5.gate_proj.weight": "model-00013.safetensors",
420
+ "model.layers.13.mlp.experts.5.up_proj.weight": "model-00013.safetensors",
421
+ "model.layers.13.mlp.experts.5.down_proj.weight": "model-00013.safetensors",
422
+ "model.layers.13.mlp.experts.6.gate_proj.weight": "model-00013.safetensors",
423
+ "model.layers.13.mlp.experts.6.up_proj.weight": "model-00013.safetensors",
424
+ "model.layers.13.mlp.experts.6.down_proj.weight": "model-00013.safetensors",
425
+ "model.layers.13.post_attention_layernorm.weight": "model-00013.safetensors",
426
+ "model.layers.13.post_feedforward_layernorm.weight": "model-00013.safetensors",
427
+ "model.layers.14.self_attn.q_proj.weight": "model-00013.safetensors",
428
+ "model.layers.14.self_attn.k_proj.weight": "model-00013.safetensors",
429
+ "model.layers.14.self_attn.v_proj.weight": "model-00013.safetensors",
430
+ "model.layers.14.self_attn.o_proj.weight": "model-00013.safetensors",
431
+ "model.layers.14.self_attn.q_norm.weight": "model-00014.safetensors",
432
+ "model.layers.14.self_attn.k_norm.weight": "model-00014.safetensors",
433
+ "model.layers.14.mlp.gate.weight": "model-00014.safetensors",
434
+ "model.layers.14.mlp.experts.0.gate_proj.weight": "model-00014.safetensors",
435
+ "model.layers.14.mlp.experts.0.up_proj.weight": "model-00014.safetensors",
436
+ "model.layers.14.mlp.experts.0.down_proj.weight": "model-00014.safetensors",
437
+ "model.layers.14.mlp.experts.1.gate_proj.weight": "model-00014.safetensors",
438
+ "model.layers.14.mlp.experts.1.up_proj.weight": "model-00014.safetensors",
439
+ "model.layers.14.mlp.experts.1.down_proj.weight": "model-00014.safetensors",
440
+ "model.layers.14.mlp.experts.2.gate_proj.weight": "model-00014.safetensors",
441
+ "model.layers.14.mlp.experts.2.up_proj.weight": "model-00014.safetensors",
442
+ "model.layers.14.mlp.experts.2.down_proj.weight": "model-00014.safetensors",
443
+ "model.layers.14.mlp.experts.3.gate_proj.weight": "model-00014.safetensors",
444
+ "model.layers.14.mlp.experts.3.up_proj.weight": "model-00014.safetensors",
445
+ "model.layers.14.mlp.experts.3.down_proj.weight": "model-00014.safetensors",
446
+ "model.layers.14.mlp.experts.4.gate_proj.weight": "model-00014.safetensors",
447
+ "model.layers.14.mlp.experts.4.up_proj.weight": "model-00014.safetensors",
448
+ "model.layers.14.mlp.experts.4.down_proj.weight": "model-00014.safetensors",
449
+ "model.layers.14.mlp.experts.5.gate_proj.weight": "model-00014.safetensors",
450
+ "model.layers.14.mlp.experts.5.up_proj.weight": "model-00014.safetensors",
451
+ "model.layers.14.mlp.experts.5.down_proj.weight": "model-00014.safetensors",
452
+ "model.layers.14.mlp.experts.6.gate_proj.weight": "model-00014.safetensors",
453
+ "model.layers.14.mlp.experts.6.up_proj.weight": "model-00014.safetensors",
454
+ "model.layers.14.mlp.experts.6.down_proj.weight": "model-00014.safetensors",
455
+ "model.layers.14.post_attention_layernorm.weight": "model-00014.safetensors",
456
+ "model.layers.14.post_feedforward_layernorm.weight": "model-00014.safetensors",
457
+ "model.layers.15.self_attn.q_proj.weight": "model-00014.safetensors",
458
+ "model.layers.15.self_attn.k_proj.weight": "model-00014.safetensors",
459
+ "model.layers.15.self_attn.v_proj.weight": "model-00014.safetensors",
460
+ "model.layers.15.self_attn.o_proj.weight": "model-00014.safetensors",
461
+ "model.layers.15.self_attn.q_norm.weight": "model-00014.safetensors",
462
+ "model.layers.15.self_attn.k_norm.weight": "model-00014.safetensors",
463
+ "model.layers.15.mlp.gate.weight": "model-00014.safetensors",
464
+ "model.layers.15.mlp.experts.0.gate_proj.weight": "model-00014.safetensors",
465
+ "model.layers.15.mlp.experts.0.up_proj.weight": "model-00014.safetensors",
466
+ "model.layers.15.mlp.experts.0.down_proj.weight": "model-00014.safetensors",
467
+ "model.layers.15.mlp.experts.1.gate_proj.weight": "model-00014.safetensors",
468
+ "model.layers.15.mlp.experts.1.up_proj.weight": "model-00015.safetensors",
469
+ "model.layers.15.mlp.experts.1.down_proj.weight": "model-00015.safetensors",
470
+ "model.layers.15.mlp.experts.2.gate_proj.weight": "model-00015.safetensors",
471
+ "model.layers.15.mlp.experts.2.up_proj.weight": "model-00015.safetensors",
472
+ "model.layers.15.mlp.experts.2.down_proj.weight": "model-00015.safetensors",
473
+ "model.layers.15.mlp.experts.3.gate_proj.weight": "model-00015.safetensors",
474
+ "model.layers.15.mlp.experts.3.up_proj.weight": "model-00015.safetensors",
475
+ "model.layers.15.mlp.experts.3.down_proj.weight": "model-00015.safetensors",
476
+ "model.layers.15.mlp.experts.4.gate_proj.weight": "model-00015.safetensors",
477
+ "model.layers.15.mlp.experts.4.up_proj.weight": "model-00015.safetensors",
478
+ "model.layers.15.mlp.experts.4.down_proj.weight": "model-00015.safetensors",
479
+ "model.layers.15.mlp.experts.5.gate_proj.weight": "model-00015.safetensors",
480
+ "model.layers.15.mlp.experts.5.up_proj.weight": "model-00015.safetensors",
481
+ "model.layers.15.mlp.experts.5.down_proj.weight": "model-00015.safetensors",
482
+ "model.layers.15.mlp.experts.6.gate_proj.weight": "model-00015.safetensors",
483
+ "model.layers.15.mlp.experts.6.up_proj.weight": "model-00015.safetensors",
484
+ "model.layers.15.mlp.experts.6.down_proj.weight": "model-00015.safetensors",
485
+ "model.layers.15.post_attention_layernorm.weight": "model-00015.safetensors",
486
+ "model.layers.15.post_feedforward_layernorm.weight": "model-00015.safetensors",
487
+ "model.layers.16.self_attn.q_proj.weight": "model-00015.safetensors",
488
+ "model.layers.16.self_attn.k_proj.weight": "model-00015.safetensors",
489
+ "model.layers.16.self_attn.v_proj.weight": "model-00015.safetensors",
490
+ "model.layers.16.self_attn.o_proj.weight": "model-00015.safetensors",
491
+ "model.layers.16.self_attn.q_norm.weight": "model-00015.safetensors",
492
+ "model.layers.16.self_attn.k_norm.weight": "model-00015.safetensors",
493
+ "model.layers.16.mlp.gate.weight": "model-00015.safetensors",
494
+ "model.layers.16.mlp.experts.0.gate_proj.weight": "model-00015.safetensors",
495
+ "model.layers.16.mlp.experts.0.up_proj.weight": "model-00015.safetensors",
496
+ "model.layers.16.mlp.experts.0.down_proj.weight": "model-00015.safetensors",
497
+ "model.layers.16.mlp.experts.1.gate_proj.weight": "model-00015.safetensors",
498
+ "model.layers.16.mlp.experts.1.up_proj.weight": "model-00015.safetensors",
499
+ "model.layers.16.mlp.experts.1.down_proj.weight": "model-00015.safetensors",
500
+ "model.layers.16.mlp.experts.2.gate_proj.weight": "model-00015.safetensors",
501
+ "model.layers.16.mlp.experts.2.up_proj.weight": "model-00015.safetensors",
502
+ "model.layers.16.mlp.experts.2.down_proj.weight": "model-00016.safetensors",
503
+ "model.layers.16.mlp.experts.3.gate_proj.weight": "model-00016.safetensors",
504
+ "model.layers.16.mlp.experts.3.up_proj.weight": "model-00016.safetensors",
505
+ "model.layers.16.mlp.experts.3.down_proj.weight": "model-00016.safetensors",
506
+ "model.layers.16.mlp.experts.4.gate_proj.weight": "model-00016.safetensors",
507
+ "model.layers.16.mlp.experts.4.up_proj.weight": "model-00016.safetensors",
508
+ "model.layers.16.mlp.experts.4.down_proj.weight": "model-00016.safetensors",
509
+ "model.layers.16.mlp.experts.5.gate_proj.weight": "model-00016.safetensors",
510
+ "model.layers.16.mlp.experts.5.up_proj.weight": "model-00016.safetensors",
511
+ "model.layers.16.mlp.experts.5.down_proj.weight": "model-00016.safetensors",
512
+ "model.layers.16.mlp.experts.6.gate_proj.weight": "model-00016.safetensors",
513
+ "model.layers.16.mlp.experts.6.up_proj.weight": "model-00016.safetensors",
514
+ "model.layers.16.mlp.experts.6.down_proj.weight": "model-00016.safetensors",
515
+ "model.layers.16.post_attention_layernorm.weight": "model-00016.safetensors",
516
+ "model.layers.16.post_feedforward_layernorm.weight": "model-00016.safetensors",
517
+ "model.layers.17.self_attn.q_proj.weight": "model-00016.safetensors",
518
+ "model.layers.17.self_attn.k_proj.weight": "model-00016.safetensors",
519
+ "model.layers.17.self_attn.v_proj.weight": "model-00016.safetensors",
520
+ "model.layers.17.self_attn.o_proj.weight": "model-00016.safetensors",
521
+ "model.layers.17.self_attn.q_norm.weight": "model-00016.safetensors",
522
+ "model.layers.17.self_attn.k_norm.weight": "model-00016.safetensors",
523
+ "model.layers.17.mlp.gate.weight": "model-00016.safetensors",
524
+ "model.layers.17.mlp.experts.0.gate_proj.weight": "model-00016.safetensors",
525
+ "model.layers.17.mlp.experts.0.up_proj.weight": "model-00016.safetensors",
526
+ "model.layers.17.mlp.experts.0.down_proj.weight": "model-00016.safetensors",
527
+ "model.layers.17.mlp.experts.1.gate_proj.weight": "model-00016.safetensors",
528
+ "model.layers.17.mlp.experts.1.up_proj.weight": "model-00016.safetensors",
529
+ "model.layers.17.mlp.experts.1.down_proj.weight": "model-00016.safetensors",
530
+ "model.layers.17.mlp.experts.2.gate_proj.weight": "model-00016.safetensors",
531
+ "model.layers.17.mlp.experts.2.up_proj.weight": "model-00016.safetensors",
532
+ "model.layers.17.mlp.experts.2.down_proj.weight": "model-00016.safetensors",
533
+ "model.layers.17.mlp.experts.3.gate_proj.weight": "model-00016.safetensors",
534
+ "model.layers.17.mlp.experts.3.up_proj.weight": "model-00016.safetensors",
535
+ "model.layers.17.mlp.experts.3.down_proj.weight": "model-00016.safetensors",
536
+ "model.layers.17.mlp.experts.4.gate_proj.weight": "model-00017.safetensors",
537
+ "model.layers.17.mlp.experts.4.up_proj.weight": "model-00017.safetensors",
538
+ "model.layers.17.mlp.experts.4.down_proj.weight": "model-00017.safetensors",
539
+ "model.layers.17.mlp.experts.5.gate_proj.weight": "model-00017.safetensors",
540
+ "model.layers.17.mlp.experts.5.up_proj.weight": "model-00017.safetensors",
541
+ "model.layers.17.mlp.experts.5.down_proj.weight": "model-00017.safetensors",
542
+ "model.layers.17.mlp.experts.6.gate_proj.weight": "model-00017.safetensors",
543
+ "model.layers.17.mlp.experts.6.up_proj.weight": "model-00017.safetensors",
544
+ "model.layers.17.mlp.experts.6.down_proj.weight": "model-00017.safetensors",
545
+ "model.layers.17.post_attention_layernorm.weight": "model-00017.safetensors",
546
+ "model.layers.17.post_feedforward_layernorm.weight": "model-00017.safetensors",
547
+ "model.layers.18.self_attn.q_proj.weight": "model-00017.safetensors",
548
+ "model.layers.18.self_attn.k_proj.weight": "model-00017.safetensors",
549
+ "model.layers.18.self_attn.v_proj.weight": "model-00017.safetensors",
550
+ "model.layers.18.self_attn.o_proj.weight": "model-00017.safetensors",
551
+ "model.layers.18.self_attn.q_norm.weight": "model-00017.safetensors",
552
+ "model.layers.18.self_attn.k_norm.weight": "model-00017.safetensors",
553
+ "model.layers.18.mlp.gate.weight": "model-00017.safetensors",
554
+ "model.layers.18.mlp.experts.0.gate_proj.weight": "model-00017.safetensors",
555
+ "model.layers.18.mlp.experts.0.up_proj.weight": "model-00017.safetensors",
556
+ "model.layers.18.mlp.experts.0.down_proj.weight": "model-00017.safetensors",
557
+ "model.layers.18.mlp.experts.1.gate_proj.weight": "model-00017.safetensors",
558
+ "model.layers.18.mlp.experts.1.up_proj.weight": "model-00017.safetensors",
559
+ "model.layers.18.mlp.experts.1.down_proj.weight": "model-00017.safetensors",
560
+ "model.layers.18.mlp.experts.2.gate_proj.weight": "model-00017.safetensors",
561
+ "model.layers.18.mlp.experts.2.up_proj.weight": "model-00017.safetensors",
562
+ "model.layers.18.mlp.experts.2.down_proj.weight": "model-00017.safetensors",
563
+ "model.layers.18.mlp.experts.3.gate_proj.weight": "model-00017.safetensors",
564
+ "model.layers.18.mlp.experts.3.up_proj.weight": "model-00017.safetensors",
565
+ "model.layers.18.mlp.experts.3.down_proj.weight": "model-00017.safetensors",
566
+ "model.layers.18.mlp.experts.4.gate_proj.weight": "model-00017.safetensors",
567
+ "model.layers.18.mlp.experts.4.up_proj.weight": "model-00017.safetensors",
568
+ "model.layers.18.mlp.experts.4.down_proj.weight": "model-00017.safetensors",
569
+ "model.layers.18.mlp.experts.5.gate_proj.weight": "model-00017.safetensors",
570
+ "model.layers.18.mlp.experts.5.up_proj.weight": "model-00018.safetensors",
571
+ "model.layers.18.mlp.experts.5.down_proj.weight": "model-00018.safetensors",
572
+ "model.layers.18.mlp.experts.6.gate_proj.weight": "model-00018.safetensors",
573
+ "model.layers.18.mlp.experts.6.up_proj.weight": "model-00018.safetensors",
574
+ "model.layers.18.mlp.experts.6.down_proj.weight": "model-00018.safetensors",
575
+ "model.layers.18.post_attention_layernorm.weight": "model-00018.safetensors",
576
+ "model.layers.18.post_feedforward_layernorm.weight": "model-00018.safetensors",
577
+ "model.layers.19.self_attn.q_proj.weight": "model-00018.safetensors",
578
+ "model.layers.19.self_attn.k_proj.weight": "model-00018.safetensors",
579
+ "model.layers.19.self_attn.v_proj.weight": "model-00018.safetensors",
580
+ "model.layers.19.self_attn.o_proj.weight": "model-00018.safetensors",
581
+ "model.layers.19.self_attn.q_norm.weight": "model-00018.safetensors",
582
+ "model.layers.19.self_attn.k_norm.weight": "model-00018.safetensors",
583
+ "model.layers.19.mlp.gate.weight": "model-00018.safetensors",
584
+ "model.layers.19.mlp.experts.0.gate_proj.weight": "model-00018.safetensors",
585
+ "model.layers.19.mlp.experts.0.up_proj.weight": "model-00018.safetensors",
586
+ "model.layers.19.mlp.experts.0.down_proj.weight": "model-00018.safetensors",
587
+ "model.layers.19.mlp.experts.1.gate_proj.weight": "model-00018.safetensors",
588
+ "model.layers.19.mlp.experts.1.up_proj.weight": "model-00018.safetensors",
589
+ "model.layers.19.mlp.experts.1.down_proj.weight": "model-00018.safetensors",
590
+ "model.layers.19.mlp.experts.2.gate_proj.weight": "model-00018.safetensors",
591
+ "model.layers.19.mlp.experts.2.up_proj.weight": "model-00018.safetensors",
592
+ "model.layers.19.mlp.experts.2.down_proj.weight": "model-00018.safetensors",
593
+ "model.layers.19.mlp.experts.3.gate_proj.weight": "model-00018.safetensors",
594
+ "model.layers.19.mlp.experts.3.up_proj.weight": "model-00018.safetensors",
595
+ "model.layers.19.mlp.experts.3.down_proj.weight": "model-00018.safetensors",
596
+ "model.layers.19.mlp.experts.4.gate_proj.weight": "model-00018.safetensors",
597
+ "model.layers.19.mlp.experts.4.up_proj.weight": "model-00018.safetensors",
598
+ "model.layers.19.mlp.experts.4.down_proj.weight": "model-00018.safetensors",
599
+ "model.layers.19.mlp.experts.5.gate_proj.weight": "model-00018.safetensors",
600
+ "model.layers.19.mlp.experts.5.up_proj.weight": "model-00018.safetensors",
601
+ "model.layers.19.mlp.experts.5.down_proj.weight": "model-00018.safetensors",
602
+ "model.layers.19.mlp.experts.6.gate_proj.weight": "model-00018.safetensors",
603
+ "model.layers.19.mlp.experts.6.up_proj.weight": "model-00018.safetensors",
604
+ "model.layers.19.mlp.experts.6.down_proj.weight": "model-00019.safetensors",
605
+ "model.layers.19.post_attention_layernorm.weight": "model-00019.safetensors",
606
+ "model.layers.19.post_feedforward_layernorm.weight": "model-00019.safetensors",
607
+ "model.layers.20.self_attn.q_proj.weight": "model-00019.safetensors",
608
+ "model.layers.20.self_attn.k_proj.weight": "model-00019.safetensors",
609
+ "model.layers.20.self_attn.v_proj.weight": "model-00019.safetensors",
610
+ "model.layers.20.self_attn.o_proj.weight": "model-00019.safetensors",
611
+ "model.layers.20.self_attn.q_norm.weight": "model-00019.safetensors",
612
+ "model.layers.20.self_attn.k_norm.weight": "model-00019.safetensors",
613
+ "model.layers.20.mlp.gate.weight": "model-00019.safetensors",
614
+ "model.layers.20.mlp.experts.0.gate_proj.weight": "model-00019.safetensors",
615
+ "model.layers.20.mlp.experts.0.up_proj.weight": "model-00019.safetensors",
616
+ "model.layers.20.mlp.experts.0.down_proj.weight": "model-00019.safetensors",
617
+ "model.layers.20.mlp.experts.1.gate_proj.weight": "model-00019.safetensors",
618
+ "model.layers.20.mlp.experts.1.up_proj.weight": "model-00019.safetensors",
619
+ "model.layers.20.mlp.experts.1.down_proj.weight": "model-00019.safetensors",
620
+ "model.layers.20.mlp.experts.2.gate_proj.weight": "model-00019.safetensors",
621
+ "model.layers.20.mlp.experts.2.up_proj.weight": "model-00019.safetensors",
622
+ "model.layers.20.mlp.experts.2.down_proj.weight": "model-00019.safetensors",
623
+ "model.layers.20.mlp.experts.3.gate_proj.weight": "model-00019.safetensors",
624
+ "model.layers.20.mlp.experts.3.up_proj.weight": "model-00019.safetensors",
625
+ "model.layers.20.mlp.experts.3.down_proj.weight": "model-00019.safetensors",
626
+ "model.layers.20.mlp.experts.4.gate_proj.weight": "model-00019.safetensors",
627
+ "model.layers.20.mlp.experts.4.up_proj.weight": "model-00019.safetensors",
628
+ "model.layers.20.mlp.experts.4.down_proj.weight": "model-00019.safetensors",
629
+ "model.layers.20.mlp.experts.5.gate_proj.weight": "model-00019.safetensors",
630
+ "model.layers.20.mlp.experts.5.up_proj.weight": "model-00019.safetensors",
631
+ "model.layers.20.mlp.experts.5.down_proj.weight": "model-00019.safetensors",
632
+ "model.layers.20.mlp.experts.6.gate_proj.weight": "model-00019.safetensors",
633
+ "model.layers.20.mlp.experts.6.up_proj.weight": "model-00019.safetensors",
634
+ "model.layers.20.mlp.experts.6.down_proj.weight": "model-00019.safetensors",
635
+ "model.layers.20.post_attention_layernorm.weight": "model-00019.safetensors",
636
+ "model.layers.20.post_feedforward_layernorm.weight": "model-00019.safetensors",
637
+ "model.layers.21.self_attn.q_proj.weight": "model-00019.safetensors",
638
+ "model.layers.21.self_attn.k_proj.weight": "model-00019.safetensors",
639
+ "model.layers.21.self_attn.v_proj.weight": "model-00019.safetensors",
640
+ "model.layers.21.self_attn.o_proj.weight": "model-00019.safetensors",
641
+ "model.layers.21.self_attn.q_norm.weight": "model-00019.safetensors",
642
+ "model.layers.21.self_attn.k_norm.weight": "model-00019.safetensors",
643
+ "model.layers.21.mlp.gate.weight": "model-00019.safetensors",
644
+ "model.layers.21.mlp.experts.0.gate_proj.weight": "model-00019.safetensors",
645
+ "model.layers.21.mlp.experts.0.up_proj.weight": "model-00020.safetensors",
646
+ "model.layers.21.mlp.experts.0.down_proj.weight": "model-00020.safetensors",
647
+ "model.layers.21.mlp.experts.1.gate_proj.weight": "model-00020.safetensors",
648
+ "model.layers.21.mlp.experts.1.up_proj.weight": "model-00020.safetensors",
649
+ "model.layers.21.mlp.experts.1.down_proj.weight": "model-00020.safetensors",
650
+ "model.layers.21.mlp.experts.2.gate_proj.weight": "model-00020.safetensors",
651
+ "model.layers.21.mlp.experts.2.up_proj.weight": "model-00020.safetensors",
652
+ "model.layers.21.mlp.experts.2.down_proj.weight": "model-00020.safetensors",
653
+ "model.layers.21.mlp.experts.3.gate_proj.weight": "model-00020.safetensors",
654
+ "model.layers.21.mlp.experts.3.up_proj.weight": "model-00020.safetensors",
655
+ "model.layers.21.mlp.experts.3.down_proj.weight": "model-00020.safetensors",
656
+ "model.layers.21.mlp.experts.4.gate_proj.weight": "model-00020.safetensors",
657
+ "model.layers.21.mlp.experts.4.up_proj.weight": "model-00020.safetensors",
658
+ "model.layers.21.mlp.experts.4.down_proj.weight": "model-00020.safetensors",
659
+ "model.layers.21.mlp.experts.5.gate_proj.weight": "model-00020.safetensors",
660
+ "model.layers.21.mlp.experts.5.up_proj.weight": "model-00020.safetensors",
661
+ "model.layers.21.mlp.experts.5.down_proj.weight": "model-00020.safetensors",
662
+ "model.layers.21.mlp.experts.6.gate_proj.weight": "model-00020.safetensors",
663
+ "model.layers.21.mlp.experts.6.up_proj.weight": "model-00020.safetensors",
664
+ "model.layers.21.mlp.experts.6.down_proj.weight": "model-00020.safetensors",
665
+ "model.layers.21.post_attention_layernorm.weight": "model-00020.safetensors",
666
+ "model.layers.21.post_feedforward_layernorm.weight": "model-00020.safetensors",
667
+ "model.layers.22.self_attn.q_proj.weight": "model-00020.safetensors",
668
+ "model.layers.22.self_attn.k_proj.weight": "model-00020.safetensors",
669
+ "model.layers.22.self_attn.v_proj.weight": "model-00020.safetensors",
670
+ "model.layers.22.self_attn.o_proj.weight": "model-00020.safetensors",
671
+ "model.layers.22.self_attn.q_norm.weight": "model-00020.safetensors",
672
+ "model.layers.22.self_attn.k_norm.weight": "model-00020.safetensors",
673
+ "model.layers.22.mlp.gate.weight": "model-00020.safetensors",
674
+ "model.layers.22.mlp.experts.0.gate_proj.weight": "model-00020.safetensors",
675
+ "model.layers.22.mlp.experts.0.up_proj.weight": "model-00020.safetensors",
676
+ "model.layers.22.mlp.experts.0.down_proj.weight": "model-00020.safetensors",
677
+ "model.layers.22.mlp.experts.1.gate_proj.weight": "model-00020.safetensors",
678
+ "model.layers.22.mlp.experts.1.up_proj.weight": "model-00020.safetensors",
679
+ "model.layers.22.mlp.experts.1.down_proj.weight": "model-00021.safetensors",
680
+ "model.layers.22.mlp.experts.2.gate_proj.weight": "model-00021.safetensors",
681
+ "model.layers.22.mlp.experts.2.up_proj.weight": "model-00021.safetensors",
682
+ "model.layers.22.mlp.experts.2.down_proj.weight": "model-00021.safetensors",
683
+ "model.layers.22.mlp.experts.3.gate_proj.weight": "model-00021.safetensors",
684
+ "model.layers.22.mlp.experts.3.up_proj.weight": "model-00021.safetensors",
685
+ "model.layers.22.mlp.experts.3.down_proj.weight": "model-00021.safetensors",
686
+ "model.layers.22.mlp.experts.4.gate_proj.weight": "model-00021.safetensors",
687
+ "model.layers.22.mlp.experts.4.up_proj.weight": "model-00021.safetensors",
688
+ "model.layers.22.mlp.experts.4.down_proj.weight": "model-00021.safetensors",
689
+ "model.layers.22.mlp.experts.5.gate_proj.weight": "model-00021.safetensors",
690
+ "model.layers.22.mlp.experts.5.up_proj.weight": "model-00021.safetensors",
691
+ "model.layers.22.mlp.experts.5.down_proj.weight": "model-00021.safetensors",
692
+ "model.layers.22.mlp.experts.6.gate_proj.weight": "model-00021.safetensors",
693
+ "model.layers.22.mlp.experts.6.up_proj.weight": "model-00021.safetensors",
694
+ "model.layers.22.mlp.experts.6.down_proj.weight": "model-00021.safetensors",
695
+ "model.layers.22.post_attention_layernorm.weight": "model-00021.safetensors",
696
+ "model.layers.22.post_feedforward_layernorm.weight": "model-00021.safetensors",
697
+ "model.layers.23.self_attn.q_proj.weight": "model-00021.safetensors",
698
+ "model.layers.23.self_attn.k_proj.weight": "model-00021.safetensors",
699
+ "model.layers.23.self_attn.v_proj.weight": "model-00021.safetensors",
700
+ "model.layers.23.self_attn.o_proj.weight": "model-00021.safetensors",
701
+ "model.layers.23.self_attn.q_norm.weight": "model-00021.safetensors",
702
+ "model.layers.23.self_attn.k_norm.weight": "model-00021.safetensors",
703
+ "model.layers.23.mlp.gate.weight": "model-00021.safetensors",
704
+ "model.layers.23.mlp.experts.0.gate_proj.weight": "model-00021.safetensors",
705
+ "model.layers.23.mlp.experts.0.up_proj.weight": "model-00021.safetensors",
706
+ "model.layers.23.mlp.experts.0.down_proj.weight": "model-00021.safetensors",
707
+ "model.layers.23.mlp.experts.1.gate_proj.weight": "model-00021.safetensors",
708
+ "model.layers.23.mlp.experts.1.up_proj.weight": "model-00021.safetensors",
709
+ "model.layers.23.mlp.experts.1.down_proj.weight": "model-00021.safetensors",
710
+ "model.layers.23.mlp.experts.2.gate_proj.weight": "model-00021.safetensors",
711
+ "model.layers.23.mlp.experts.2.up_proj.weight": "model-00021.safetensors",
712
+ "model.layers.23.mlp.experts.2.down_proj.weight": "model-00021.safetensors",
713
+ "model.layers.23.mlp.experts.3.gate_proj.weight": "model-00022.safetensors",
714
+ "model.layers.23.mlp.experts.3.up_proj.weight": "model-00022.safetensors",
715
+ "model.layers.23.mlp.experts.3.down_proj.weight": "model-00022.safetensors",
716
+ "model.layers.23.mlp.experts.4.gate_proj.weight": "model-00022.safetensors",
717
+ "model.layers.23.mlp.experts.4.up_proj.weight": "model-00022.safetensors",
718
+ "model.layers.23.mlp.experts.4.down_proj.weight": "model-00022.safetensors",
719
+ "model.layers.23.mlp.experts.5.gate_proj.weight": "model-00022.safetensors",
720
+ "model.layers.23.mlp.experts.5.up_proj.weight": "model-00022.safetensors",
721
+ "model.layers.23.mlp.experts.5.down_proj.weight": "model-00022.safetensors",
722
+ "model.layers.23.mlp.experts.6.gate_proj.weight": "model-00022.safetensors",
723
+ "model.layers.23.mlp.experts.6.up_proj.weight": "model-00022.safetensors",
724
+ "model.layers.23.mlp.experts.6.down_proj.weight": "model-00022.safetensors",
725
+ "model.layers.23.post_attention_layernorm.weight": "model-00022.safetensors",
726
+ "model.layers.23.post_feedforward_layernorm.weight": "model-00022.safetensors",
727
+ "model.norm.weight": "model-00022.safetensors",
728
+ "lm_head.weight": "model-00022.safetensors"
729
+ }
730
+ }
modeling_rish_ai.py ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from collections.abc import Callable
16
+
17
+ import torch
18
+ import torch.nn.functional as F
19
+ from torch import nn
20
+
21
+ from transformers.activations import ACT2FN
22
+ from transformers.cache_utils import Cache, DynamicCache
23
+ from transformers.generation import GenerationMixin
24
+ from transformers.integrations import use_kernel_forward_from_hub
25
+ from transformers.masking_utils import create_causal_mask
26
+ from transformers.modeling_layers import GradientCheckpointingLayer
27
+ from transformers.modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
28
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
29
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
30
+ from transformers.processing_utils import Unpack
31
+ from transformers.utils import TransformersKwargs, auto_docstring, logging
32
+ from transformers.utils.deprecation import deprecate_kwarg
33
+ from transformers.utils.generic import OutputRecorder, check_model_inputs
34
+
35
+ from .configuration_rish_ai import RishAIConfig
36
+
37
+
38
+ logger = logging.get_logger(__name__)
39
+
40
+
41
+ @use_kernel_forward_from_hub("RMSNorm")
42
+ class RishAIRMSNorm(nn.Module):
43
+ def __init__(self, hidden_size, eps=1e-6):
44
+ """
45
+ RishAIRMSNorm is equivalent to T5LayerNorm
46
+ """
47
+ super().__init__()
48
+ self.weight = nn.Parameter(torch.ones(hidden_size))
49
+ self.variance_epsilon = eps
50
+
51
+ def forward(self, hidden_states):
52
+ input_dtype = hidden_states.dtype
53
+ hidden_states = hidden_states.to(torch.float32)
54
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
55
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
56
+ return (self.weight * hidden_states).to(input_dtype)
57
+
58
+ def extra_repr(self):
59
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
60
+
61
+
62
+ class RishAIRotaryEmbedding(nn.Module):
63
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
64
+
65
+ def __init__(self, config: RishAIConfig, device=None):
66
+ super().__init__()
67
+ # BC: "rope_type" was originally "type"
68
+ if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
69
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
70
+ else:
71
+ # Use the rope_type from config if available, otherwise default to 'dynamic'
72
+ self.rope_type = getattr(config, "rope_type", "dynamic")
73
+
74
+ # Ensure we have a valid rope_type
75
+ if self.rope_type not in ROPE_INIT_FUNCTIONS:
76
+ self.rope_type = "dynamic" # fallback to dynamic if not found
77
+
78
+ self.max_seq_len_cached = config.max_position_embeddings
79
+ self.original_max_seq_len = config.max_position_embeddings
80
+
81
+ self.config = config
82
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
83
+
84
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
85
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
86
+ self.original_inv_freq = self.inv_freq
87
+
88
+ @torch.no_grad()
89
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
90
+ def forward(self, x, position_ids):
91
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
92
+ position_ids_expanded = position_ids[:, None, :].float()
93
+
94
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
95
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
96
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
97
+ emb = torch.cat((freqs, freqs), dim=-1)
98
+ cos = emb.cos() * self.attention_scaling
99
+ sin = emb.sin() * self.attention_scaling
100
+ return cos, sin
101
+
102
+
103
+ class RishAIMLP(nn.Module):
104
+ def __init__(self, config):
105
+ super().__init__()
106
+ self.config = config
107
+ self.hidden_size = config.hidden_size
108
+ self.intermediate_size = config.intermediate_size
109
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
110
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
111
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
112
+ self.act_fn = ACT2FN[config.hidden_act]
113
+
114
+ def forward(self, x):
115
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
116
+ return down_proj
117
+
118
+
119
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
120
+ """
121
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
122
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
123
+ """
124
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
125
+ if n_rep == 1:
126
+ return hidden_states
127
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
128
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
129
+
130
+
131
+ def eager_attention_forward(
132
+ module: nn.Module,
133
+ query: torch.Tensor,
134
+ key: torch.Tensor,
135
+ value: torch.Tensor,
136
+ attention_mask: torch.Tensor | None,
137
+ scaling: float,
138
+ dropout: float = 0.0,
139
+ **kwargs: Unpack[TransformersKwargs],
140
+ ):
141
+ key_states = repeat_kv(key, module.num_key_value_groups)
142
+ value_states = repeat_kv(value, module.num_key_value_groups)
143
+
144
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
145
+ if attention_mask is not None:
146
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
147
+ attn_weights = attn_weights + causal_mask
148
+
149
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
150
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
151
+ attn_output = torch.matmul(attn_weights, value_states)
152
+ attn_output = attn_output.transpose(1, 2).contiguous()
153
+
154
+ return attn_output, attn_weights
155
+
156
+
157
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
158
+ """Applies Rotary Position Embedding to the query and key tensors."""
159
+ q_type, k_type = q.dtype, k.dtype
160
+ cos = cos.unsqueeze(unsqueeze_dim)
161
+ sin = sin.unsqueeze(unsqueeze_dim)
162
+ q_embed = (q * cos) + (rotate_half(q) * sin)
163
+ k_embed = (k * cos) + (rotate_half(k) * sin)
164
+ return q_embed.to(q_type), k_embed.to(k_type)
165
+
166
+
167
+ def rotate_half(x):
168
+ """Rotates half the hidden dims of the input."""
169
+ x1 = x[..., : x.shape[-1] // 2]
170
+ x2 = x[..., x.shape[-1] // 2 :]
171
+ return torch.cat((-x2, x1), dim=-1)
172
+
173
+
174
+ class RishAIAttention(nn.Module):
175
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
176
+
177
+ def __init__(self, config: RishAIConfig, layer_idx: int | None = None):
178
+ super().__init__()
179
+ self.config = config
180
+ self.layer_idx = layer_idx
181
+ self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
182
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
183
+ self.scaling = self.head_dim**-0.5
184
+ self.attention_dropout = config.attention_dropout
185
+ self.is_causal = True
186
+
187
+ self.q_proj = nn.Linear(
188
+ config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
189
+ )
190
+ self.k_proj = nn.Linear(
191
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
192
+ )
193
+ self.v_proj = nn.Linear(
194
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
195
+ )
196
+ self.o_proj = nn.Linear(
197
+ config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
198
+ )
199
+ self.q_norm = RishAIRMSNorm(config.num_attention_heads * self.head_dim, config.rms_norm_eps)
200
+ self.k_norm = RishAIRMSNorm(config.num_key_value_heads * self.head_dim, config.rms_norm_eps)
201
+
202
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
203
+ def forward(
204
+ self,
205
+ hidden_states: torch.Tensor,
206
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
207
+ attention_mask: torch.Tensor | None,
208
+ past_key_values: Cache | None = None,
209
+ cache_position: torch.LongTensor | None = None,
210
+ **kwargs: Unpack[TransformersKwargs],
211
+ ) -> tuple[torch.Tensor, torch.Tensor | None]:
212
+ input_shape = hidden_states.shape[:-1]
213
+ hidden_shape = (*input_shape, -1, self.head_dim)
214
+
215
+ query_states = self.q_norm(self.q_proj(hidden_states))
216
+ key_states = self.k_norm(self.k_proj(hidden_states))
217
+ value_states = self.v_proj(hidden_states)
218
+
219
+ query_states = query_states.view(hidden_shape).transpose(1, 2)
220
+ key_states = key_states.view(hidden_shape).transpose(1, 2)
221
+ value_states = value_states.view(hidden_shape).transpose(1, 2)
222
+
223
+ cos, sin = position_embeddings
224
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
225
+
226
+ if past_key_values is not None:
227
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
228
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
229
+ key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx, cache_kwargs)
230
+
231
+ attention_interface: Callable = eager_attention_forward
232
+ if self.config._attn_implementation != "eager":
233
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
234
+
235
+ attn_output, attn_weights = attention_interface(
236
+ self,
237
+ query_states,
238
+ key_states,
239
+ value_states,
240
+ attention_mask,
241
+ dropout=0.0 if not self.training else self.attention_dropout,
242
+ scaling=self.scaling,
243
+ **kwargs,
244
+ )
245
+
246
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
247
+ attn_output = self.o_proj(attn_output)
248
+ return attn_output, attn_weights
249
+
250
+
251
+ class RishAISparseMoeBlock(nn.Module):
252
+ def __init__(self, config):
253
+ super().__init__()
254
+ self.num_experts = config.num_experts
255
+ self.top_k = config.num_experts_per_tok
256
+ self.norm_topk_prob = config.norm_topk_prob
257
+ self.gate = nn.Linear(config.hidden_size, self.num_experts, bias=False)
258
+ self.experts = nn.ModuleList([RishAIMLP(config) for _ in range(self.num_experts)])
259
+
260
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
261
+ batch_size, sequence_length, hidden_dim = hidden_states.shape
262
+ hidden_states = hidden_states.view(-1, hidden_dim)
263
+ # router_logits: (batch * sequence_length, n_experts)
264
+ router_logits = self.gate(hidden_states)
265
+
266
+ routing_weights = F.softmax(router_logits, dim=1, dtype=torch.float)
267
+ routing_weights, selected_experts = torch.topk(routing_weights, self.top_k, dim=-1)
268
+ if self.norm_topk_prob:
269
+ routing_weights /= routing_weights.sum(dim=-1, keepdim=True)
270
+ # we cast back to the input dtype
271
+ routing_weights = routing_weights.to(hidden_states.dtype)
272
+
273
+ final_hidden_states = torch.zeros(
274
+ (batch_size * sequence_length, hidden_dim), dtype=hidden_states.dtype, device=hidden_states.device
275
+ )
276
+
277
+ # One hot encode the selected experts to create an expert mask
278
+ # this will be used to easily index which expert is going to be selected
279
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
280
+
281
+ # Loop over all available experts in the model and perform the computation on each expert
282
+ for expert_idx in range(self.num_experts):
283
+ expert_layer = self.experts[expert_idx]
284
+ idx, top_x = torch.where(expert_mask[expert_idx])
285
+
286
+ # Index the correct hidden states and compute the expert hidden state for
287
+ # the current expert. We need to make sure to multiply the output hidden
288
+ # states by `routing_weights` on the corresponding tokens (top-1 and top-2)
289
+ current_state = hidden_states[None, top_x].reshape(-1, hidden_dim)
290
+ current_hidden_states = expert_layer(current_state) * routing_weights[top_x, idx, None]
291
+
292
+ # However `index_add_` only support torch tensors for indexing so we'll use
293
+ # the `top_x` tensor here.
294
+ final_hidden_states.index_add_(0, top_x, current_hidden_states.to(hidden_states.dtype))
295
+ final_hidden_states = final_hidden_states.reshape(batch_size, sequence_length, hidden_dim)
296
+ return final_hidden_states, router_logits
297
+
298
+
299
+ class RishAIDecoderLayer(GradientCheckpointingLayer):
300
+ def __init__(self, config: RishAIConfig, layer_idx: int):
301
+ super().__init__()
302
+ self.hidden_size = config.hidden_size
303
+ self.self_attn = RishAIAttention(config=config, layer_idx=layer_idx)
304
+
305
+ self.mlp = RishAISparseMoeBlock(config)
306
+ self.post_attention_layernorm = RishAIRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
307
+ self.post_feedforward_layernorm = RishAIRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
308
+
309
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
310
+ def forward(
311
+ self,
312
+ hidden_states: torch.Tensor,
313
+ attention_mask: torch.Tensor | None = None,
314
+ position_ids: torch.LongTensor | None = None,
315
+ past_key_values: Cache | None = None,
316
+ cache_position: torch.LongTensor | None = None,
317
+ position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
318
+ **kwargs,
319
+ ) -> torch.FloatTensor:
320
+ residual = hidden_states
321
+
322
+ # Self Attention
323
+ hidden_states, _ = self.self_attn(
324
+ hidden_states=hidden_states,
325
+ attention_mask=attention_mask,
326
+ position_ids=position_ids,
327
+ past_key_values=past_key_values,
328
+ cache_position=cache_position,
329
+ position_embeddings=position_embeddings,
330
+ **kwargs,
331
+ )
332
+ hidden_states = self.post_attention_layernorm(hidden_states)
333
+ hidden_states = residual + hidden_states
334
+
335
+ # Fully Connected
336
+ residual = hidden_states
337
+ hidden_states, _ = self.mlp(hidden_states)
338
+ hidden_states = self.post_feedforward_layernorm(hidden_states)
339
+ hidden_states = residual + hidden_states
340
+ return hidden_states
341
+
342
+
343
+ @auto_docstring
344
+ class RishAIPreTrainedModel(PreTrainedModel):
345
+ config: RishAIConfig
346
+ base_model_prefix = "model"
347
+ supports_gradient_checkpointing = True
348
+ _no_split_modules = ["RishAIDecoderLayer"]
349
+ _skip_keys_device_placement = ["past_key_values"]
350
+ _supports_flash_attn = True
351
+ _supports_sdpa = True
352
+ _supports_flex_attn = True
353
+ _can_compile_fullgraph = False # MoE models don't work with torch.compile (`torch.where(condition)` not supported)
354
+ _supports_attention_backend = True
355
+ _can_record_outputs = {
356
+ "router_logits": OutputRecorder(RishAISparseMoeBlock, index=1),
357
+ "hidden_states": RishAIDecoderLayer,
358
+ "attentions": RishAIAttention,
359
+ }
360
+
361
+
362
+ @auto_docstring
363
+ class RishAIModel(RishAIPreTrainedModel):
364
+ def __init__(self, config: RishAIConfig):
365
+ super().__init__(config)
366
+ self.padding_idx = config.pad_token_id
367
+ self.vocab_size = config.vocab_size
368
+
369
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
370
+ self.layers = nn.ModuleList(
371
+ [RishAIDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
372
+ )
373
+ self.norm = RishAIRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
374
+ self.rotary_emb = RishAIRotaryEmbedding(config=config)
375
+ self.gradient_checkpointing = False
376
+
377
+ # Initialize weights and apply final processing
378
+ self.post_init()
379
+
380
+ @check_model_inputs()
381
+ @auto_docstring
382
+ def forward(
383
+ self,
384
+ input_ids: torch.LongTensor | None = None,
385
+ attention_mask: torch.Tensor | None = None,
386
+ position_ids: torch.LongTensor | None = None,
387
+ past_key_values: Cache | None = None,
388
+ inputs_embeds: torch.FloatTensor | None = None,
389
+ use_cache: bool | None = None,
390
+ cache_position: torch.LongTensor | None = None,
391
+ **kwargs: Unpack[TransformersKwargs],
392
+ ) -> MoeModelOutputWithPast:
393
+ if (input_ids is None) ^ (inputs_embeds is not None):
394
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
395
+
396
+ if use_cache and past_key_values is None:
397
+ past_key_values = DynamicCache(config=self.config)
398
+
399
+ if inputs_embeds is None:
400
+ inputs_embeds = self.embed_tokens(input_ids)
401
+
402
+ if cache_position is None:
403
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
404
+ cache_position = torch.arange(
405
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
406
+ )
407
+ if position_ids is None:
408
+ position_ids = cache_position.unsqueeze(0)
409
+
410
+ causal_mask = create_causal_mask(
411
+ config=self.config,
412
+ input_embeds=inputs_embeds,
413
+ attention_mask=attention_mask,
414
+ cache_position=cache_position,
415
+ past_key_values=past_key_values,
416
+ position_ids=position_ids,
417
+ )
418
+
419
+ hidden_states = inputs_embeds
420
+
421
+ # create position embeddings to be shared across the decoder layers
422
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
423
+
424
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
425
+ hidden_states = decoder_layer(
426
+ hidden_states,
427
+ position_embeddings=position_embeddings,
428
+ attention_mask=causal_mask,
429
+ position_ids=position_ids,
430
+ past_key_values=past_key_values,
431
+ use_cache=use_cache,
432
+ cache_position=cache_position,
433
+ **kwargs,
434
+ )
435
+
436
+ hidden_states = self.norm(hidden_states)
437
+
438
+ return MoeModelOutputWithPast(
439
+ last_hidden_state=hidden_states,
440
+ past_key_values=past_key_values,
441
+ )
442
+
443
+
444
+ def load_balancing_loss_func(
445
+ gate_logits: torch.Tensor | tuple[torch.Tensor] | None,
446
+ num_experts: int | None = None,
447
+ top_k=2,
448
+ attention_mask: torch.Tensor | None = None,
449
+ ) -> torch.Tensor | int:
450
+ r"""
451
+ Computes the load balancing loss for the MoE router.
452
+
453
+ Args:
454
+ gate_logits:
455
+ Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
456
+ shape [batch_size X sequence_length, num_experts].
457
+ num_experts:
458
+ Number of experts
459
+ top_k:
460
+ The number of experts to route per-token, can be also interpreted as the `top-k` routing
461
+ parameter.
462
+ attention_mask (`torch.Tensor`, *optional*):
463
+ The attention_mask used in forward function
464
+ shape [batch_size X sequence_length] if not None.
465
+
466
+ Returns:
467
+ The auxiliary loss.
468
+ """
469
+ if gate_logits is None or not isinstance(gate_logits, tuple):
470
+ return 0
471
+
472
+ if isinstance(gate_logits, tuple):
473
+ compute_device = gate_logits[0].device
474
+ concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
475
+
476
+ routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
477
+
478
+ _, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
479
+
480
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
481
+
482
+ if attention_mask is None:
483
+ # Compute the percentage of tokens routed to each experts
484
+ tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
485
+
486
+ # Compute the average probability of routing to these experts
487
+ router_prob_per_expert = torch.mean(routing_weights, dim=0)
488
+ else:
489
+ batch_size, sequence_length = attention_mask.shape
490
+ num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
491
+
492
+ # Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
493
+ expert_attention_mask = (
494
+ attention_mask[None, :, :, None, None]
495
+ .expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
496
+ .reshape(-1, top_k, num_experts)
497
+ .to(compute_device)
498
+ )
499
+
500
+ # Compute the percentage of tokens routed to each experts
501
+ tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
502
+ expert_attention_mask, dim=0
503
+ )
504
+
505
+ # Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
506
+ router_per_expert_attention_mask = (
507
+ attention_mask[None, :, :, None]
508
+ .expand((num_hidden_layers, batch_size, sequence_length, routing_weights.shape[1]))
509
+ .reshape(-1, routing_weights.shape[1])
510
+ .to(compute_device)
511
+ )
512
+
513
+ # Compute the average probability of routing to these experts
514
+ router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
515
+ router_per_expert_attention_mask, dim=0
516
+ )
517
+
518
+ device_index = routing_weights.device.index if routing_weights.device.index is not None else 0
519
+ rank = routing_weights.shape[1] * int(device_index)
520
+ overall_loss = torch.sum(
521
+ tokens_per_expert[:, rank : rank + routing_weights.shape[1]] * router_prob_per_expert.unsqueeze(0)
522
+ )
523
+ return overall_loss * num_experts
524
+
525
+
526
+ class RishAICausalLM(RishAIPreTrainedModel, GenerationMixin):
527
+ _tied_weights_keys = ["lm_head.weight"]
528
+
529
+ def __init__(self, config):
530
+ super().__init__(config)
531
+ self.model = RishAIModel(config)
532
+ self.vocab_size = config.vocab_size
533
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
534
+
535
+ self.router_aux_loss_coef = config.router_aux_loss_coef
536
+ self.num_experts = config.num_experts
537
+ self.num_experts_per_tok = config.num_experts_per_tok
538
+ # Initialize weights and apply final processing
539
+ self.post_init()
540
+
541
+ @auto_docstring
542
+ def forward(
543
+ self,
544
+ input_ids: torch.LongTensor | None = None,
545
+ attention_mask: torch.Tensor | None = None,
546
+ position_ids: torch.LongTensor | None = None,
547
+ past_key_values: Cache | None = None,
548
+ inputs_embeds: torch.FloatTensor | None = None,
549
+ labels: torch.LongTensor | None = None,
550
+ use_cache: bool | None = None,
551
+ output_attentions: bool | None = None,
552
+ output_hidden_states: bool | None = None,
553
+ output_router_logits: bool | None = None,
554
+ return_dict: bool | None = None,
555
+ cache_position: torch.LongTensor | None = None,
556
+ logits_to_keep: int | torch.Tensor = 0,
557
+ **kwargs,
558
+ ) -> tuple | MoeCausalLMOutputWithPast:
559
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
560
+ output_router_logits = (
561
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
562
+ )
563
+ output_hidden_states = (
564
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
565
+ )
566
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
567
+
568
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
569
+ outputs = self.model(
570
+ input_ids=input_ids,
571
+ attention_mask=attention_mask,
572
+ position_ids=position_ids,
573
+ past_key_values=past_key_values,
574
+ inputs_embeds=inputs_embeds,
575
+ use_cache=use_cache,
576
+ output_attentions=output_attentions,
577
+ output_hidden_states=output_hidden_states,
578
+ output_router_logits=output_router_logits,
579
+ return_dict=return_dict,
580
+ cache_position=cache_position,
581
+ )
582
+
583
+ hidden_states = outputs[0]
584
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
585
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
586
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
587
+
588
+ loss = None
589
+ if labels is not None:
590
+ loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
591
+
592
+ aux_loss = None
593
+ if output_router_logits:
594
+ aux_loss = load_balancing_loss_func(
595
+ outputs.router_logits if return_dict else outputs[-1],
596
+ self.num_experts,
597
+ self.num_experts_per_tok,
598
+ attention_mask,
599
+ )
600
+ if labels is not None:
601
+ loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
602
+
603
+ if not return_dict:
604
+ output = (logits,) + outputs[1:]
605
+ if output_router_logits:
606
+ output = (aux_loss,) + output
607
+ return (loss,) + output if loss is not None else output
608
+
609
+ return MoeCausalLMOutputWithPast(
610
+ loss=loss,
611
+ aux_loss=aux_loss,
612
+ logits=logits,
613
+ past_key_values=outputs.past_key_values,
614
+ hidden_states=outputs.hidden_states,
615
+ attentions=outputs.attentions,
616
+ router_logits=outputs.router_logits,
617
+ )
tokenization_rish_ai.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Tokenization class for RishAI."""
16
+
17
+ import json
18
+
19
+ from transformers.tokenization_utils_base import PreTrainedTokenizerBase
20
+ from transformers.utils import add_end_docstrings, logging
21
+
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+
26
+ @add_end_docstrings
27
+ class RishAITokenizer(PreTrainedTokenizerBase):
28
+ """
29
+ Construct a RishAI tokenizer. Based on byte-level Byte-Pair-Encoding.
30
+
31
+ This tokenizer inherits from [`PreTrainedTokenizerBase`] which contains most of the main methods.
32
+ Users should refer to this superclass for more information regarding those methods.
33
+
34
+ Args:
35
+ vocab_file (`str`):
36
+ Path to the vocabulary file.
37
+ merges_file (`str`):
38
+ Path to the merges file.
39
+ errors (`str`, *optional*, defaults to `"replace"`):
40
+ Paradigm to follow when decoding bytes to UTF-8. See
41
+ [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
42
+ unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
43
+ The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
44
+ token instead.
45
+ bos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
46
+ The beginning of sequence token.
47
+ eos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
48
+ The end of sequence token.
49
+ pad_token (`str`, *optional*):
50
+ The token used for padding, for example when batching sequences of different lengths.
51
+ clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`):
52
+ Whether or not to cleanup spaces after decoding, cleanup consists in removing potential artifacts like
53
+ extra spaces.
54
+ split_special_tokens (`bool`, *optional*, defaults to `False`):
55
+ Whether or not the special tokens should be split during the encoding.
56
+ """
57
+
58
+ vocab_files_names = {
59
+ "vocab_file": "vocab.json",
60
+ "merges_file": "merges.txt",
61
+ }
62
+ pretrained_vocab_files_map = {
63
+ "vocab_file": {},
64
+ "merges_file": {},
65
+ }
66
+ max_model_input_sizes = {"default": 4096}
67
+ model_input_names = ["input_ids", "attention_mask"]
68
+
69
+ def __init__(
70
+ self,
71
+ vocab_file=None,
72
+ merges_file=None,
73
+ errors="replace",
74
+ unk_token="<|endoftext|>",
75
+ bos_token="<|endoftext|>",
76
+ eos_token="<|endoftext|>",
77
+ pad_token=None,
78
+ clean_up_tokenization_spaces=False,
79
+ split_special_tokens=False,
80
+ **kwargs,
81
+ ):
82
+ # Set default special tokens if not provided
83
+ if pad_token is None:
84
+ pad_token = "<|endoftext|>"
85
+
86
+ super().__init__(
87
+ errors=errors,
88
+ unk_token=unk_token,
89
+ bos_token=bos_token,
90
+ eos_token=eos_token,
91
+ pad_token=pad_token,
92
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
93
+ split_special_tokens=split_special_tokens,
94
+ **kwargs,
95
+ )
96
+
97
+ self.vocab_file = vocab_file
98
+ self.merges_file = merges_file
99
+
100
+ # Initialize vocabulary
101
+ self._vocab = {}
102
+ self._merges = []
103
+ self._bpe_ranks = {}
104
+
105
+ if vocab_file is not None and merges_file is not None:
106
+ self._load_vocab_and_merges(vocab_file, merges_file)
107
+
108
+ def _load_vocab_and_merges(self, vocab_file, merges_file):
109
+ """Load vocabulary and merges from files."""
110
+ # Load vocabulary
111
+ with open(vocab_file, "r", encoding="utf-8") as f:
112
+ self._vocab = json.load(f)
113
+
114
+ # Load merges
115
+ with open(merges_file, "r", encoding="utf-8") as f:
116
+ self._merges = f.read().split("\n")
117
+ self._merges = [merge for merge in self._merges if merge.strip()]
118
+
119
+ # Build BPE ranks
120
+ self._bpe_ranks = {merge: i for i, merge in enumerate(self._merges)}
121
+
122
+ @property
123
+ def vocab_size(self) -> int:
124
+ """Returns vocab size."""
125
+ return len(self._vocab)
126
+
127
+ def get_vocab(self) -> dict[str, int]:
128
+ """Returns vocab as a dict."""
129
+ return dict(self._vocab)
130
+
131
+ def _tokenize(self, text: str, **kwargs) -> list[str]:
132
+ """Tokenize a string."""
133
+ # Simple whitespace tokenization for now
134
+ # In a real implementation, this would use BPE
135
+ return text.split()
136
+
137
+ def _convert_token_to_id(self, token: str) -> int:
138
+ """Converts a token (str) to an id using the vocab."""
139
+ return self._vocab.get(token, self._vocab.get(self.unk_token, 0))
140
+
141
+ def _convert_id_to_token(self, index: int) -> str:
142
+ """Converts an index (integer) to a token (str) using the vocab."""
143
+ for token, idx in self._vocab.items():
144
+ if idx == index:
145
+ return token
146
+ return self.unk_token
147
+
148
+ def convert_tokens_to_string(self, tokens: list[str]) -> str:
149
+ """Converts a sequence of tokens (string) in a single string."""
150
+ # Simple detokenization - join with spaces
151
+ return " ".join(tokens)
152
+
153
+ def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str, str]:
154
+ """Save the vocabulary and merges files to a directory."""
155
+ if not self.can_save_slow_tokenizer:
156
+ raise ValueError(
157
+ "Your tokenizer does not have the necessary information to save the vocabulary. "
158
+ "Please use a tokenizer that has been trained with the correct parameters."
159
+ )
160
+
161
+ vocab_file = (filename_prefix + "-" if filename_prefix else "") + "vocab.json"
162
+ merges_file = (filename_prefix + "-" if filename_prefix else "") + "merges.txt"
163
+
164
+ vocab_file_path = f"{save_directory}/{vocab_file}"
165
+ merges_file_path = f"{save_directory}/{merges_file}"
166
+
167
+ with open(vocab_file_path, "w", encoding="utf-8") as f:
168
+ json.dump(self._vocab, f, ensure_ascii=False, indent=2)
169
+
170
+ with open(merges_file_path, "w", encoding="utf-8") as f:
171
+ f.write("\n".join(self._merges))
172
+
173
+ return vocab_file_path, merges_file_path
174
+
175
+ @property
176
+ def can_save_slow_tokenizer(self) -> bool:
177
+ """Check if the tokenizer can be saved."""
178
+ return self._vocab is not None and self._merges is not None
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d3b8cace3c6283818f885ef7ee8ca7b7ae7431c9b29245b0c33a0cc73113ab8
3
+ size 11421884
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "additional_special_tokens": null,
4
+ "backend": "tokenizers",
5
+ "bos_token": null,
6
+ "clean_up_tokenization_spaces": false,
7
+ "eos_token": "<|im_end|>",
8
+ "errors": "replace",
9
+ "extra_special_tokens": [
10
+ "<|im_start|>",
11
+ "<|im_end|>",
12
+ "<|object_ref_start|>",
13
+ "<|object_ref_end|>",
14
+ "<|box_start|>",
15
+ "<|box_end|>",
16
+ "<|quad_start|>",
17
+ "<|quad_end|>",
18
+ "<|vision_start|>",
19
+ "<|vision_end|>",
20
+ "<|vision_pad|>",
21
+ "<|image_pad|>",
22
+ "<|video_pad|>"
23
+ ],
24
+ "is_local": false,
25
+ "model_max_length": 32768,
26
+ "pad_token": "<|endoftext|>",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "Qwen2Tokenizer",
29
+ "unk_token": null
30
+ }