renillhuang commited on
Commit
301ba04
·
1 Parent(s): f82faaa

init: Add model files

Browse files

Signed-off-by: eric <[email protected]>

config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Orion-MoE 8x7b",
3
+ "architectures": [
4
+ "OrionCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_orion.OrionConfig",
10
+ "AutoModelForCausalLM": "modeling_orion.OrionForCausalLM"
11
+ },
12
+ "bos_token_id": 1,
13
+ "eos_token_id": 2,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 4096,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 14592,
18
+ "max_position_embeddings": 8192,
19
+ "max_sequence_length": 8192,
20
+ "model_type": "orion_moe",
21
+ "num_attention_heads": 32,
22
+ "num_experts_per_tok": 2,
23
+ "num_hidden_layers": 32,
24
+ "num_key_value_heads": 8,
25
+ "num_local_experts": 8,
26
+ "output_router_logits": false,
27
+ "pad_token_id": 0,
28
+ "pretraining_tp": 1,
29
+ "rms_norm_eps": 1e-05,
30
+ "rope_scaling": null,
31
+ "rope_theta": 1000000.0,
32
+ "router_aux_loss_coef": 0.01,
33
+ "router_jitter_noise": 0,
34
+ "sliding_window": null,
35
+ "tie_word_embeddings": false,
36
+ "torch_dtype": "bfloat16",
37
+ "transformers_version": "4.37.1",
38
+ "use_cache": false,
39
+ "vocab_size": 113664,
40
+ "_flash_attn_2_enabled": true,
41
+ "_attn_implementation": "flash_attention_2"
42
+ }
configuration_orion.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2024, OrionStar Inc. All rights reserved.
2
+ # Copied and adapted from https://github.com/huggingface/transformers/blob/main/src/transformers/models/mixtral/configuration_mixtral.py
3
+
4
+ from transformers.configuration_utils import PretrainedConfig
5
+ from transformers.utils import logging
6
+
7
+
8
+ logger = logging.get_logger(__name__)
9
+
10
+
11
+ class OrionConfig(PretrainedConfig):
12
+ """
13
+ Args:
14
+ vocab_size (`int`, *optional*, defaults to 113664):
15
+ Vocabulary size of the Orion model. Defines the number of different tokens that can be represented by the
16
+ `inputs_ids` passed when calling [`OrionModel`]
17
+ hidden_size (`int`, *optional*, defaults to 4096):
18
+ Dimension of the hidden representations.
19
+ intermediate_size (`int`, *optional*, defaults to 14592):
20
+ Dimension of the MLP representations.
21
+ num_hidden_layers (`int`, *optional*, defaults to 32):
22
+ Number of hidden layers in the Transformer encoder.
23
+ num_attention_heads (`int`, *optional*, defaults to 32):
24
+ Number of attention heads for each attention layer in the Transformer encoder.
25
+ num_key_value_heads (`int`, *optional*, defaults to 8):
26
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
27
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
28
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
29
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
30
+ by meanpooling all the original heads within that group. For more details checkout [this
31
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `8`.
32
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
33
+ The non-linear activation function (function or string) in the decoder.
34
+ max_position_embeddings (`int`, *optional*, defaults to `8192`):
35
+ The maximum sequence length that this model might ever be used with. Orion's sliding window attention
36
+ allows sequence of up to 4096*32 tokens.
37
+ initializer_range (`float`, *optional*, defaults to 0.02):
38
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
39
+ rms_norm_eps (`float`, *optional*, defaults to 1e-05):
40
+ The epsilon used by the rms normalization layers.
41
+ use_cache (`bool`, *optional*, defaults to `True`):
42
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
43
+ relevant if `config.is_decoder=True`.
44
+ pad_token_id (`int`, *optional*):
45
+ The id of the padding token.
46
+ bos_token_id (`int`, *optional*, defaults to 1):
47
+ The id of the "beginning-of-sequence" token.
48
+ eos_token_id (`int`, *optional*, defaults to 2):
49
+ The id of the "end-of-sequence" token.
50
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
51
+ Whether the model's input and output word embeddings should be tied.
52
+ rope_theta (`float`, *optional*, defaults to 1000000.0):
53
+ The base period of the RoPE embeddings.
54
+ sliding_window (`int`, *optional*):
55
+ Sliding window attention window size. If not specified, will default to `4096`.
56
+ attention_dropout (`float`, *optional*, defaults to 0.0):
57
+ The dropout ratio for the attention probabilities.
58
+ num_experts_per_tok (`int`, *optional*, defaults to 2):
59
+ The number of experts to root per-token, can be also interpreted as the `top-p` routing
60
+ parameter
61
+ num_local_experts (`int`, *optional*, defaults to 8):
62
+ Number of experts per Sparse MLP layer.
63
+ output_router_logits (`bool`, *optional*, defaults to `False`):
64
+ Whether or not the router logits should be returned by the model. Enabeling this will also
65
+ allow the model to output the auxiliary loss. See [here]() for more details
66
+ router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
67
+ The aux loss factor for the total loss.
68
+
69
+ """
70
+
71
+ model_type = "orion_moe"
72
+ keys_to_ignore_at_inference = ["past_key_values"]
73
+
74
+ def __init__(
75
+ self,
76
+ vocab_size=113664,
77
+ hidden_size=4096,
78
+ intermediate_size=14592,
79
+ num_hidden_layers=32,
80
+ num_attention_heads=32,
81
+ num_key_value_heads=8,
82
+ hidden_act="silu",
83
+ max_position_embeddings=8192,
84
+ initializer_range=0.02,
85
+ rms_norm_eps=1e-5,
86
+ use_cache=True,
87
+ pad_token_id=None,
88
+ bos_token_id=1,
89
+ eos_token_id=2,
90
+ tie_word_embeddings=False,
91
+ rope_theta=1e6,
92
+ sliding_window=None,
93
+ attention_dropout=0.0,
94
+ num_experts_per_tok=2,
95
+ num_local_experts=8,
96
+ output_router_logits=False,
97
+ router_aux_loss_coef=0.01,
98
+ router_jitter_noise=0.0,
99
+ **kwargs,
100
+ ):
101
+ self.vocab_size = vocab_size
102
+ self.max_position_embeddings = max_position_embeddings
103
+ self.hidden_size = hidden_size
104
+ self.intermediate_size = intermediate_size
105
+ self.num_hidden_layers = num_hidden_layers
106
+ self.num_attention_heads = num_attention_heads
107
+ self.sliding_window = sliding_window
108
+
109
+ # for backward compatibility
110
+ if num_key_value_heads is None:
111
+ num_key_value_heads = num_attention_heads
112
+
113
+ self.num_key_value_heads = num_key_value_heads
114
+ self.hidden_act = hidden_act
115
+ self.initializer_range = initializer_range
116
+ self.rms_norm_eps = rms_norm_eps
117
+ self.use_cache = use_cache
118
+ self.rope_theta = rope_theta
119
+ self.attention_dropout = attention_dropout
120
+
121
+ self.num_experts_per_tok = num_experts_per_tok
122
+ self.num_local_experts = num_local_experts
123
+ self.output_router_logits = output_router_logits
124
+ self.router_aux_loss_coef = router_aux_loss_coef
125
+ self.router_jitter_noise = router_jitter_noise
126
+ super().__init__(
127
+ pad_token_id=pad_token_id,
128
+ bos_token_id=bos_token_id,
129
+ eos_token_id=eos_token_id,
130
+ tie_word_embeddings=tie_word_embeddings,
131
+ **kwargs,
132
+ )
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.37.2"
7
+ }
modeling_orion.py ADDED
@@ -0,0 +1,1559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2024, OrionStar Inc. All rights reserved.
2
+ # Copied and adapted from https://github.com/huggingface/transformers/blob/main/src/transformers/models/mixtral/modeling_mixtral.py
3
+
4
+ import inspect
5
+ import math
6
+ import warnings
7
+ from typing import List, Optional, Tuple, Union
8
+
9
+ import torch
10
+ import torch.nn.functional as F
11
+ import torch.utils.checkpoint
12
+ from torch import nn
13
+ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
14
+
15
+ from transformers.activations import ACT2FN
16
+ from transformers.cache_utils import Cache, DynamicCache
17
+ from transformers.modeling_attn_mask_utils import (
18
+ _prepare_4d_causal_attention_mask,
19
+ _prepare_4d_causal_attention_mask_for_sdpa,
20
+ )
21
+ from transformers.modeling_outputs import (
22
+ MoeCausalLMOutputWithPast,
23
+ MoeModelOutputWithPast,
24
+ SequenceClassifierOutputWithPast,
25
+ )
26
+ from transformers.modeling_utils import PreTrainedModel
27
+ from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_13
28
+ from transformers.utils import (
29
+ add_start_docstrings,
30
+ add_start_docstrings_to_model_forward,
31
+ is_flash_attn_2_available,
32
+ is_flash_attn_greater_or_equal_2_10,
33
+ logging,
34
+ replace_return_docstrings,
35
+ )
36
+ from transformers.utils.import_utils import is_torch_fx_available
37
+ from .configuration_orion import OrionConfig
38
+
39
+
40
+ if is_flash_attn_2_available():
41
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
42
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
43
+
44
+ _flash_supports_window_size = "window_size" in list(inspect.signature(flash_attn_func).parameters)
45
+
46
+ # This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
47
+ # It means that the function will not be traced through and simply appear as a node in the graph.
48
+ if is_torch_fx_available():
49
+ if not is_torch_greater_or_equal_than_1_13:
50
+ import torch.fx
51
+
52
+ _prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)
53
+
54
+
55
+ logger = logging.get_logger(__name__)
56
+
57
+ _CONFIG_FOR_DOC = "OrionConfig"
58
+
59
+ def load_balancing_loss_func(
60
+ gate_logits: torch.Tensor, num_experts: torch.Tensor = None, top_k=2, attention_mask: Optional[torch.Tensor] = None
61
+ ) -> float:
62
+ r"""
63
+ Computes auxiliary load balancing loss as in Switch Transformer - implemented in Pytorch.
64
+
65
+ See Switch Transformer (https://arxiv.org/abs/2101.03961) for more details. This function implements the loss
66
+ function presented in equations (4) - (6) of the paper. It aims at penalizing cases where the routing between
67
+ experts is too unbalanced.
68
+
69
+ Args:
70
+ gate_logits (Union[`torch.Tensor`, Tuple[torch.Tensor]):
71
+ Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
72
+ shape [batch_size X sequence_length, num_experts].
73
+ attention_mask (`torch.Tensor`, None):
74
+ The attention_mask used in forward function
75
+ shape [batch_size X sequence_length] if not None.
76
+ num_experts (`int`, *optional*):
77
+ Number of experts
78
+
79
+ Returns:
80
+ The auxiliary loss.
81
+ """
82
+ if gate_logits is None or not isinstance(gate_logits, tuple):
83
+ return 0
84
+
85
+ if isinstance(gate_logits, tuple):
86
+ compute_device = gate_logits[0].device
87
+ concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
88
+
89
+ routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
90
+
91
+ _, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
92
+
93
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
94
+
95
+ if attention_mask is None:
96
+ # Compute the percentage of tokens routed to each experts
97
+ tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
98
+
99
+ # Compute the average probability of routing to these experts
100
+ router_prob_per_expert = torch.mean(routing_weights, dim=0)
101
+ else:
102
+ batch_size, sequence_length = attention_mask.shape
103
+ num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
104
+
105
+ # Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
106
+ expert_attention_mask = (
107
+ attention_mask[None, :, :, None, None]
108
+ .expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
109
+ .reshape(-1, top_k, num_experts)
110
+ .to(compute_device)
111
+ )
112
+
113
+ # Compute the percentage of tokens routed to each experts
114
+ tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
115
+ expert_attention_mask, dim=0
116
+ )
117
+
118
+ # Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
119
+ router_per_expert_attention_mask = (
120
+ attention_mask[None, :, :, None]
121
+ .expand((num_hidden_layers, batch_size, sequence_length, num_experts))
122
+ .reshape(-1, num_experts)
123
+ .to(compute_device)
124
+ )
125
+
126
+ # Compute the average probability of routing to these experts
127
+ router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
128
+ router_per_expert_attention_mask, dim=0
129
+ )
130
+
131
+ overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
132
+ return overall_loss * num_experts
133
+
134
+
135
+ # Copied from transformers.models.llama.modeling_llama._get_unpad_data
136
+ def _get_unpad_data(attention_mask):
137
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
138
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
139
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
140
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0))
141
+ return (
142
+ indices,
143
+ cu_seqlens,
144
+ max_seqlen_in_batch,
145
+ )
146
+
147
+
148
+ class OrionRMSNorm(nn.Module):
149
+ def __init__(self, hidden_size, eps=1e-6):
150
+ """
151
+ OrionRMSNorm is equivalent to T5LayerNorm
152
+ """
153
+ super().__init__()
154
+ self.weight = nn.Parameter(torch.ones(hidden_size))
155
+ self.variance_epsilon = eps
156
+
157
+ def forward(self, hidden_states):
158
+ input_dtype = hidden_states.dtype
159
+ hidden_states = hidden_states.to(torch.float32)
160
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
161
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
162
+ return self.weight * hidden_states.to(input_dtype)
163
+
164
+
165
+ class OrionRotaryEmbedding(nn.Module):
166
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
167
+ super().__init__()
168
+
169
+ self.dim = dim
170
+ self.max_position_embeddings = max_position_embeddings
171
+ self.base = base
172
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64).float().to(device) / self.dim))
173
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
174
+
175
+ # Build here to make `torch.jit.trace` work.
176
+ self._set_cos_sin_cache(
177
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
178
+ )
179
+
180
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
181
+ self.max_seq_len_cached = seq_len
182
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.int64).type_as(self.inv_freq)
183
+
184
+ freqs = torch.outer(t, self.inv_freq)
185
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
186
+ emb = torch.cat((freqs, freqs), dim=-1)
187
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
188
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
189
+
190
+ def forward(self, x, seq_len=None):
191
+ # x: [bs, num_attention_heads, seq_len, head_size]
192
+ if seq_len > self.max_seq_len_cached:
193
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
194
+
195
+ return (
196
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
197
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
198
+ )
199
+
200
+
201
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
202
+ def rotate_half(x):
203
+ """Rotates half the hidden dims of the input."""
204
+ x1 = x[..., : x.shape[-1] // 2]
205
+ x2 = x[..., x.shape[-1] // 2 :]
206
+ return torch.cat((-x2, x1), dim=-1)
207
+
208
+
209
+ # Copied from transformers.models.mistral.modeling_mistral.apply_rotary_pos_emb
210
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
211
+ """Applies Rotary Position Embedding to the query and key tensors.
212
+
213
+ Args:
214
+ q (`torch.Tensor`): The query tensor.
215
+ k (`torch.Tensor`): The key tensor.
216
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
217
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
218
+ position_ids (`torch.Tensor`):
219
+ The position indices of the tokens corresponding to the query and key tensors. For example, this can be
220
+ used to pass offsetted position ids when working with a KV-cache.
221
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
222
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
223
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
224
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
225
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
226
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
227
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
228
+ Returns:
229
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
230
+ """
231
+ cos = cos[position_ids].unsqueeze(unsqueeze_dim)
232
+ sin = sin[position_ids].unsqueeze(unsqueeze_dim)
233
+ q_embed = (q * cos) + (rotate_half(q) * sin)
234
+ k_embed = (k * cos) + (rotate_half(k) * sin)
235
+ return q_embed, k_embed
236
+
237
+
238
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv
239
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
240
+ """
241
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
242
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
243
+ """
244
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
245
+ if n_rep == 1:
246
+ return hidden_states
247
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
248
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
249
+
250
+
251
+ class OrionAttention(nn.Module):
252
+ """
253
+ Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
254
+ and "Generating Long Sequences with Sparse Transformers".
255
+ """
256
+
257
+ def __init__(self, config: OrionConfig, layer_idx: Optional[int] = None):
258
+ super().__init__()
259
+ self.config = config
260
+ self.layer_idx = layer_idx
261
+ if layer_idx is None:
262
+ logger.warning_once(
263
+ f"Instantiating {self.__class__.__name__} without passing a `layer_idx` is not recommended and will "
264
+ "lead to errors during the forward call if caching is used. Please make sure to provide a `layer_idx` "
265
+ "when creating this class."
266
+ )
267
+
268
+ self.hidden_size = config.hidden_size
269
+ self.num_heads = config.num_attention_heads
270
+ self.head_dim = self.hidden_size // self.num_heads
271
+ self.num_key_value_heads = config.num_key_value_heads
272
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
273
+ self.max_position_embeddings = config.max_position_embeddings
274
+ self.rope_theta = config.rope_theta
275
+ self.is_causal = True
276
+ self.attention_dropout = config.attention_dropout
277
+
278
+ if (self.head_dim * self.num_heads) != self.hidden_size:
279
+ raise ValueError(
280
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
281
+ f" and `num_heads`: {self.num_heads})."
282
+ )
283
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=False)
284
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
285
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
286
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
287
+
288
+ self.rotary_emb = OrionRotaryEmbedding(
289
+ self.head_dim,
290
+ max_position_embeddings=self.max_position_embeddings,
291
+ base=self.rope_theta,
292
+ )
293
+
294
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
295
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
296
+
297
+ def forward(
298
+ self,
299
+ hidden_states: torch.Tensor,
300
+ attention_mask: Optional[torch.Tensor] = None,
301
+ position_ids: Optional[torch.LongTensor] = None,
302
+ past_key_value: Optional[Cache] = None,
303
+ output_attentions: bool = False,
304
+ use_cache: bool = False,
305
+ **kwargs,
306
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
307
+ if "padding_mask" in kwargs:
308
+ warnings.warn(
309
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
310
+ )
311
+ bsz, q_len, _ = hidden_states.size()
312
+
313
+ query_states = self.q_proj(hidden_states)
314
+ key_states = self.k_proj(hidden_states)
315
+ value_states = self.v_proj(hidden_states)
316
+
317
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
318
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
319
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
320
+
321
+ kv_seq_len = key_states.shape[-2]
322
+ if past_key_value is not None:
323
+ if self.layer_idx is None:
324
+ raise ValueError(
325
+ f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
326
+ "for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
327
+ "with a layer index."
328
+ )
329
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
330
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
331
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
332
+
333
+ if past_key_value is not None:
334
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
335
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
336
+
337
+ # repeat k/v heads if n_kv_heads < n_heads
338
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
339
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
340
+
341
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
342
+
343
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
344
+ raise ValueError(
345
+ f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
346
+ f" {attn_weights.size()}"
347
+ )
348
+
349
+ if attention_mask is not None:
350
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
351
+ raise ValueError(
352
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
353
+ )
354
+
355
+ attn_weights = attn_weights + attention_mask
356
+
357
+ # upcast attention to fp32
358
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
359
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
360
+ attn_output = torch.matmul(attn_weights, value_states)
361
+
362
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
363
+ raise ValueError(
364
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
365
+ f" {attn_output.size()}"
366
+ )
367
+
368
+ attn_output = attn_output.transpose(1, 2).contiguous()
369
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
370
+
371
+ attn_output = self.o_proj(attn_output)
372
+
373
+ if not output_attentions:
374
+ attn_weights = None
375
+
376
+ return attn_output, attn_weights, past_key_value
377
+
378
+
379
+ class OrionFlashAttention2(OrionAttention):
380
+ """
381
+ Orion flash attention module. This module inherits from `OrionAttention` as the weights of the module stays
382
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
383
+ flash attention and deal with padding tokens in case the input contains any of them.
384
+ """
385
+
386
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2.__init__
387
+ def __init__(self, *args, **kwargs):
388
+ super().__init__(*args, **kwargs)
389
+
390
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
391
+ # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
392
+ # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
393
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
394
+
395
+ def forward(
396
+ self,
397
+ hidden_states: torch.Tensor,
398
+ attention_mask: Optional[torch.Tensor] = None,
399
+ position_ids: Optional[torch.LongTensor] = None,
400
+ past_key_value: Optional[Cache] = None,
401
+ output_attentions: bool = False,
402
+ use_cache: bool = False,
403
+ **kwargs,
404
+ ):
405
+ if "padding_mask" in kwargs:
406
+ warnings.warn(
407
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
408
+ )
409
+
410
+ # overwrite attention_mask with padding_mask
411
+ attention_mask = kwargs.pop("padding_mask")
412
+ bsz, q_len, _ = hidden_states.size()
413
+
414
+ query_states = self.q_proj(hidden_states)
415
+ key_states = self.k_proj(hidden_states)
416
+ value_states = self.v_proj(hidden_states)
417
+
418
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
419
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
420
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
421
+
422
+ kv_seq_len = key_states.shape[-2]
423
+ if past_key_value is not None:
424
+ if self.layer_idx is None:
425
+ raise ValueError(
426
+ f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
427
+ "for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
428
+ "with a layer index."
429
+ )
430
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
431
+
432
+ # Because the input can be padded, the absolute sequence length depends on the max position id.
433
+ rotary_seq_len = max(kv_seq_len, position_ids[:, -1].max().item()) + 1
434
+ cos, sin = self.rotary_emb(value_states, seq_len=rotary_seq_len)
435
+
436
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
437
+
438
+ use_sliding_windows = (
439
+ _flash_supports_window_size
440
+ and getattr(self.config, "sliding_window", None) is not None
441
+ and kv_seq_len > self.config.sliding_window
442
+ )
443
+
444
+ if not _flash_supports_window_size:
445
+ logger.warning_once(
446
+ "The current flash attention version does not support sliding window attention, for a more memory efficient implementation"
447
+ " make sure to upgrade flash-attn library."
448
+ )
449
+
450
+ if past_key_value is not None:
451
+ # Activate slicing cache only if the config has a value `sliding_windows` attribute
452
+ cache_has_contents = past_key_value.get_seq_length(self.layer_idx) > 0
453
+ if (
454
+ getattr(self.config, "sliding_window", None) is not None
455
+ and kv_seq_len > self.config.sliding_window
456
+ and cache_has_contents
457
+ ):
458
+ slicing_tokens = 1 - self.config.sliding_window
459
+
460
+ past_key = past_key_value[self.layer_idx][0]
461
+ past_value = past_key_value[self.layer_idx][1]
462
+
463
+ past_key = past_key[:, :, slicing_tokens:, :].contiguous()
464
+ past_value = past_value[:, :, slicing_tokens:, :].contiguous()
465
+
466
+ if past_key.shape[-2] != self.config.sliding_window - 1:
467
+ raise ValueError(
468
+ f"past key must have a shape of (`batch_size, num_heads, self.config.sliding_window-1, head_dim`), got"
469
+ f" {past_key.shape}"
470
+ )
471
+
472
+ if attention_mask is not None:
473
+ attention_mask = attention_mask[:, slicing_tokens:]
474
+ attention_mask = torch.cat([attention_mask, torch.ones_like(attention_mask[:, -1:])], dim=-1)
475
+
476
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
477
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
478
+
479
+ # repeat k/v heads if n_kv_heads < n_heads
480
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
481
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
482
+ dropout_rate = 0.0 if not self.training else self.attention_dropout
483
+
484
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
485
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
486
+ # cast them back in float16 just to be sure everything works as expected.
487
+ input_dtype = query_states.dtype
488
+ if input_dtype == torch.float32:
489
+ if torch.is_autocast_enabled():
490
+ target_dtype = torch.get_autocast_gpu_dtype()
491
+ # Handle the case where the model is quantized
492
+ elif hasattr(self.config, "_pre_quantization_dtype"):
493
+ target_dtype = self.config._pre_quantization_dtype
494
+ else:
495
+ target_dtype = self.q_proj.weight.dtype
496
+
497
+ logger.warning_once(
498
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
499
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
500
+ f" {target_dtype}."
501
+ )
502
+
503
+ query_states = query_states.to(target_dtype)
504
+ key_states = key_states.to(target_dtype)
505
+ value_states = value_states.to(target_dtype)
506
+
507
+ # Reashape to the expected shape for Flash Attention
508
+ query_states = query_states.transpose(1, 2)
509
+ key_states = key_states.transpose(1, 2)
510
+ value_states = value_states.transpose(1, 2)
511
+
512
+ attn_output = self._flash_attention_forward(
513
+ query_states,
514
+ key_states,
515
+ value_states,
516
+ attention_mask,
517
+ q_len,
518
+ dropout=dropout_rate,
519
+ use_sliding_windows=use_sliding_windows,
520
+ )
521
+
522
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
523
+ attn_output = self.o_proj(attn_output)
524
+
525
+ if not output_attentions:
526
+ attn_weights = None
527
+
528
+ return attn_output, attn_weights, past_key_value
529
+
530
+ def _flash_attention_forward(
531
+ self,
532
+ query_states,
533
+ key_states,
534
+ value_states,
535
+ attention_mask,
536
+ query_length,
537
+ dropout=0.0,
538
+ softmax_scale=None,
539
+ use_sliding_windows=False,
540
+ ):
541
+ """
542
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
543
+ first unpad the input, then computes the attention scores and pad the final attention scores.
544
+
545
+ Args:
546
+ query_states (`torch.Tensor`):
547
+ Input query states to be passed to Flash Attention API
548
+ key_states (`torch.Tensor`):
549
+ Input key states to be passed to Flash Attention API
550
+ value_states (`torch.Tensor`):
551
+ Input value states to be passed to Flash Attention API
552
+ attention_mask (`torch.Tensor`):
553
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
554
+ position of padding tokens and 1 for the position of non-padding tokens.
555
+ dropout (`float`):
556
+ Attention dropout
557
+ softmax_scale (`float`, *optional*):
558
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
559
+ use_sliding_windows (`bool`, *optional*):
560
+ Whether to activate sliding window attention.
561
+ """
562
+ if not self._flash_attn_uses_top_left_mask:
563
+ causal = self.is_causal
564
+ else:
565
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
566
+ causal = self.is_causal and query_length != 1
567
+
568
+ # Contains at least one padding token in the sequence
569
+ if attention_mask is not None:
570
+ batch_size = query_states.shape[0]
571
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
572
+ query_states, key_states, value_states, attention_mask, query_length
573
+ )
574
+
575
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
576
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
577
+
578
+ if not use_sliding_windows:
579
+ attn_output_unpad = flash_attn_varlen_func(
580
+ query_states,
581
+ key_states,
582
+ value_states,
583
+ cu_seqlens_q=cu_seqlens_q,
584
+ cu_seqlens_k=cu_seqlens_k,
585
+ max_seqlen_q=max_seqlen_in_batch_q,
586
+ max_seqlen_k=max_seqlen_in_batch_k,
587
+ dropout_p=dropout,
588
+ softmax_scale=softmax_scale,
589
+ causal=causal,
590
+ )
591
+ else:
592
+ attn_output_unpad = flash_attn_varlen_func(
593
+ query_states,
594
+ key_states,
595
+ value_states,
596
+ cu_seqlens_q=cu_seqlens_q,
597
+ cu_seqlens_k=cu_seqlens_k,
598
+ max_seqlen_q=max_seqlen_in_batch_q,
599
+ max_seqlen_k=max_seqlen_in_batch_k,
600
+ dropout_p=dropout,
601
+ softmax_scale=softmax_scale,
602
+ causal=causal,
603
+ window_size=(self.config.sliding_window, self.config.sliding_window),
604
+ )
605
+
606
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
607
+ else:
608
+ if not use_sliding_windows:
609
+ attn_output = flash_attn_func(
610
+ query_states,
611
+ key_states,
612
+ value_states,
613
+ dropout,
614
+ softmax_scale=softmax_scale,
615
+ causal=causal,
616
+ )
617
+ else:
618
+ attn_output = flash_attn_func(
619
+ query_states,
620
+ key_states,
621
+ value_states,
622
+ dropout,
623
+ softmax_scale=softmax_scale,
624
+ causal=causal,
625
+ window_size=(self.config.sliding_window, self.config.sliding_window),
626
+ )
627
+
628
+ return attn_output
629
+
630
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
631
+ batch_size, kv_seq_len, num_heads, head_dim = key_layer.shape
632
+
633
+ # On the first iteration we need to properly re-create the padding mask
634
+ # by slicing it on the proper place
635
+ if kv_seq_len != attention_mask.shape[-1]:
636
+ attention_mask_num_tokens = attention_mask.shape[-1]
637
+ attention_mask = attention_mask[:, attention_mask_num_tokens - kv_seq_len :]
638
+
639
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
640
+
641
+ key_layer = index_first_axis(key_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
642
+ value_layer = index_first_axis(value_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
643
+
644
+ if query_length == kv_seq_len:
645
+ query_layer = index_first_axis(
646
+ query_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k
647
+ )
648
+ cu_seqlens_q = cu_seqlens_k
649
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
650
+ indices_q = indices_k
651
+ elif query_length == 1:
652
+ max_seqlen_in_batch_q = 1
653
+ cu_seqlens_q = torch.arange(
654
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
655
+ ) # There is a memcpy here, that is very bad.
656
+ indices_q = cu_seqlens_q[:-1]
657
+ query_layer = query_layer.squeeze(1)
658
+ else:
659
+ # The -q_len: slice assumes left padding.
660
+ attention_mask = attention_mask[:, -query_length:]
661
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
662
+
663
+ return (
664
+ query_layer,
665
+ key_layer,
666
+ value_layer,
667
+ indices_q,
668
+ (cu_seqlens_q, cu_seqlens_k),
669
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
670
+ )
671
+
672
+
673
+ class OrionSdpaAttention(OrionAttention):
674
+ """
675
+ Orion attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
676
+ `OrionAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
677
+ SDPA API.
678
+ """
679
+
680
+ # Adapted from OrionAttention.forward
681
+ def forward(
682
+ self,
683
+ hidden_states: torch.Tensor,
684
+ attention_mask: Optional[torch.Tensor] = None,
685
+ position_ids: Optional[torch.LongTensor] = None,
686
+ past_key_value: Optional[Cache] = None,
687
+ output_attentions: bool = False,
688
+ use_cache: bool = False,
689
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
690
+ if output_attentions:
691
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
692
+ logger.warning_once(
693
+ "OrionModel is using OrionSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
694
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
695
+ )
696
+ return super().forward(
697
+ hidden_states=hidden_states,
698
+ attention_mask=attention_mask,
699
+ position_ids=position_ids,
700
+ past_key_value=past_key_value,
701
+ output_attentions=output_attentions,
702
+ use_cache=use_cache,
703
+ )
704
+
705
+ bsz, q_len, _ = hidden_states.size()
706
+
707
+ query_states = self.q_proj(hidden_states)
708
+ key_states = self.k_proj(hidden_states)
709
+ value_states = self.v_proj(hidden_states)
710
+
711
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
712
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
713
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
714
+
715
+ kv_seq_len = key_states.shape[-2]
716
+ if past_key_value is not None:
717
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
718
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
719
+
720
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
721
+
722
+ if past_key_value is not None:
723
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
724
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
725
+
726
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
727
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
728
+
729
+ if attention_mask is not None:
730
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
731
+ raise ValueError(
732
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
733
+ )
734
+
735
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
736
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
737
+ if query_states.device.type == "cuda" and attention_mask is not None:
738
+ query_states = query_states.contiguous()
739
+ key_states = key_states.contiguous()
740
+ value_states = value_states.contiguous()
741
+
742
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
743
+ query_states,
744
+ key_states,
745
+ value_states,
746
+ attn_mask=attention_mask,
747
+ dropout_p=self.attention_dropout if self.training else 0.0,
748
+ # The q_len > 1 is necessary to match with AttentionMaskConverter.to_causal_4d that does not create a causal mask in case q_len == 1.
749
+ is_causal=self.is_causal and attention_mask is None and q_len > 1,
750
+ )
751
+
752
+ attn_output = attn_output.transpose(1, 2).contiguous()
753
+ attn_output = attn_output.view(bsz, q_len, self.hidden_size)
754
+
755
+ attn_output = self.o_proj(attn_output)
756
+
757
+ return attn_output, None, past_key_value
758
+
759
+
760
+ ORION_ATTENTION_CLASSES = {
761
+ "eager": OrionAttention,
762
+ "flash_attention_2": OrionFlashAttention2,
763
+ "sdpa": OrionSdpaAttention,
764
+ }
765
+
766
+
767
+ class OrionBlockSparseTop2MLP(nn.Module):
768
+ def __init__(self, config: OrionConfig):
769
+ super().__init__()
770
+ self.ffn_dim = config.intermediate_size
771
+ self.hidden_dim = config.hidden_size
772
+
773
+ self.w1 = nn.Linear(self.hidden_dim, self.ffn_dim, bias=False)
774
+ self.w2 = nn.Linear(self.ffn_dim, self.hidden_dim, bias=False)
775
+ self.w3 = nn.Linear(self.hidden_dim, self.ffn_dim, bias=False)
776
+
777
+ self.act_fn = ACT2FN[config.hidden_act]
778
+
779
+ def forward(self, hidden_states):
780
+ current_hidden_states = self.act_fn(self.w1(hidden_states)) * self.w3(hidden_states)
781
+ current_hidden_states = self.w2(current_hidden_states)
782
+ return current_hidden_states
783
+
784
+
785
+ class OrionSparseMoeBlock(nn.Module):
786
+ """
787
+ This implementation is
788
+ strictly equivalent to standard MoE with full capacity (no
789
+ dropped tokens). It's faster since it formulates MoE operations
790
+ in terms of block-sparse operations to accomodate imbalanced
791
+ assignments of tokens to experts, whereas standard MoE either
792
+ (1) drop tokens at the cost of reduced performance or (2) set
793
+ capacity factor to number of experts and thus waste computation
794
+ and memory on padding.
795
+ """
796
+
797
+ def __init__(self, config):
798
+ super().__init__()
799
+ self.hidden_dim = config.hidden_size
800
+ self.ffn_dim = config.intermediate_size
801
+ self.num_experts = config.num_local_experts
802
+ self.top_k = config.num_experts_per_tok
803
+
804
+ # gating
805
+ self.gate = nn.Linear(self.hidden_dim, self.num_experts, bias=False)
806
+
807
+ self.experts = nn.ModuleList([OrionBlockSparseTop2MLP(config) for _ in range(self.num_experts)])
808
+
809
+ # Jitter parameters
810
+ self.jitter_noise = config.router_jitter_noise
811
+
812
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
813
+ """ """
814
+ batch_size, sequence_length, hidden_dim = hidden_states.shape
815
+ if self.training and self.jitter_noise > 0:
816
+ hidden_states *= torch.empty_like(hidden_states).uniform_(1.0 - self.jitter_noise, 1.0 + self.jitter_noise)
817
+ hidden_states = hidden_states.view(-1, hidden_dim)
818
+ # router_logits: (batch * sequence_length, n_experts)
819
+ router_logits = self.gate(hidden_states)
820
+
821
+ topk_logits, selected_experts = torch.topk(router_logits, self.top_k, dim=-1)
822
+ routing_weights = F.softmax(topk_logits, dim=1, dtype=torch.float).type_as(hidden_states)
823
+
824
+ final_hidden_states = torch.zeros(
825
+ (batch_size * sequence_length, hidden_dim), dtype=hidden_states.dtype, device=hidden_states.device
826
+ )
827
+
828
+ # One hot encode the selected experts to create an expert mask
829
+ # this will be used to easily index which expert is going to be sollicitated
830
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
831
+
832
+ # Loop over all available experts in the model and perform the computation on each expert
833
+ for expert_idx in range(self.num_experts):
834
+ expert_layer = self.experts[expert_idx]
835
+ idx, top_x = torch.where(expert_mask[expert_idx])
836
+
837
+ # Index the correct hidden states and compute the expert hidden state for
838
+ # the current expert. We need to make sure to multiply the output hidden
839
+ # states by `routing_weights` on the corresponding tokens (top-1 and top-2)
840
+ current_state = hidden_states[None, top_x].reshape(-1, hidden_dim)
841
+ current_hidden_states = expert_layer(current_state) * routing_weights[top_x, idx, None]
842
+
843
+ # However `index_add_` only support torch tensors for indexing so we'll use
844
+ # the `top_x` tensor here.
845
+ final_hidden_states.index_add_(0, top_x, current_hidden_states.to(hidden_states.dtype))
846
+ final_hidden_states = final_hidden_states.reshape(batch_size, sequence_length, hidden_dim)
847
+ return final_hidden_states, router_logits
848
+
849
+
850
+ class OrionDecoderLayer(nn.Module):
851
+ def __init__(self, config: OrionConfig, layer_idx: int):
852
+ super().__init__()
853
+ self.hidden_size = config.hidden_size
854
+
855
+ self.self_attn = ORION_ATTENTION_CLASSES[config._attn_implementation](config, layer_idx)
856
+
857
+ self.block_sparse_moe = OrionSparseMoeBlock(config)
858
+ self.input_layernorm = OrionRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
859
+ self.post_attention_layernorm = OrionRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
860
+
861
+ def forward(
862
+ self,
863
+ hidden_states: torch.Tensor,
864
+ attention_mask: Optional[torch.Tensor] = None,
865
+ position_ids: Optional[torch.LongTensor] = None,
866
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
867
+ output_attentions: Optional[bool] = False,
868
+ output_router_logits: Optional[bool] = False,
869
+ use_cache: Optional[bool] = False,
870
+ **kwargs,
871
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
872
+ if "padding_mask" in kwargs:
873
+ warnings.warn(
874
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
875
+ )
876
+ """
877
+ Args:
878
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
879
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
880
+ `(batch, sequence_length)` where padding elements are indicated by 0.
881
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
882
+ output_attentions (`bool`, *optional*):
883
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
884
+ returned tensors for more detail.
885
+ output_router_logits (`bool`, *optional*):
886
+ Whether or not to return the logits of all the routers. They are useful for computing the router loss, and
887
+ should not be returned during inference.
888
+ use_cache (`bool`, *optional*):
889
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
890
+ (see `past_key_values`).
891
+ """
892
+
893
+ residual = hidden_states
894
+
895
+ hidden_states = self.input_layernorm(hidden_states)
896
+
897
+ # Self Attention
898
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
899
+ hidden_states=hidden_states,
900
+ attention_mask=attention_mask,
901
+ position_ids=position_ids,
902
+ past_key_value=past_key_value,
903
+ output_attentions=output_attentions,
904
+ use_cache=use_cache,
905
+ )
906
+ hidden_states = residual + hidden_states
907
+
908
+ # Fully Connected
909
+ residual = hidden_states
910
+ hidden_states = self.post_attention_layernorm(hidden_states)
911
+ hidden_states, router_logits = self.block_sparse_moe(hidden_states)
912
+ hidden_states = residual + hidden_states
913
+
914
+ outputs = (hidden_states,)
915
+
916
+ if output_attentions:
917
+ outputs += (self_attn_weights,)
918
+
919
+ if use_cache:
920
+ outputs += (present_key_value,)
921
+
922
+ if output_router_logits:
923
+ outputs += (router_logits,)
924
+
925
+ return outputs
926
+
927
+
928
+ ORION_START_DOCSTRING = r"""
929
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
930
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
931
+ etc.)
932
+
933
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
934
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
935
+ and behavior.
936
+
937
+ Parameters:
938
+ config ([`OrionConfig`]):
939
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
940
+ load the weights associated with the model, only the configuration. Check out the
941
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
942
+ """
943
+
944
+
945
+ @add_start_docstrings(
946
+ "The bare Orion Model outputting raw hidden-states without any specific head on top.",
947
+ ORION_START_DOCSTRING,
948
+ )
949
+
950
+ class OrionPreTrainedModel(PreTrainedModel):
951
+ config_class = OrionConfig
952
+ base_model_prefix = "model"
953
+ supports_gradient_checkpointing = True
954
+ _no_split_modules = ["OrionDecoderLayer"]
955
+ _skip_keys_device_placement = "past_key_values"
956
+ _supports_flash_attn_2 = True
957
+ _supports_sdpa = True
958
+ _supports_cache_class = True
959
+
960
+ def _init_weights(self, module):
961
+ std = self.config.initializer_range
962
+ if isinstance(module, nn.Linear):
963
+ module.weight.data.normal_(mean=0.0, std=std)
964
+ if module.bias is not None:
965
+ module.bias.data.zero_()
966
+ elif isinstance(module, nn.Embedding):
967
+ module.weight.data.normal_(mean=0.0, std=std)
968
+ if module.padding_idx is not None:
969
+ module.weight.data[module.padding_idx].zero_()
970
+
971
+
972
+ ORION_INPUTS_DOCSTRING = r"""
973
+ Args:
974
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
975
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
976
+ it.
977
+
978
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
979
+ [`PreTrainedTokenizer.__call__`] for details.
980
+
981
+ [What are input IDs?](../glossary#input-ids)
982
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
983
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
984
+
985
+ - 1 for tokens that are **not masked**,
986
+ - 0 for tokens that are **masked**.
987
+
988
+ [What are attention masks?](../glossary#attention-mask)
989
+
990
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
991
+ [`PreTrainedTokenizer.__call__`] for details.
992
+
993
+ If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
994
+ `past_key_values`).
995
+
996
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
997
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
998
+ information on the default strategy.
999
+
1000
+ - 1 indicates the head is **not masked**,
1001
+ - 0 indicates the head is **masked**.
1002
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1003
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
1004
+ config.n_positions - 1]`.
1005
+
1006
+ [What are position IDs?](../glossary#position-ids)
1007
+ past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
1008
+ Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
1009
+ `(batch_size, num_heads, sequence_length, embed_size_per_head)`) and 2 additional tensors of shape
1010
+ `(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)`.
1011
+
1012
+ Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
1013
+ blocks) that can be used (see `past_key_values` input) to speed up sequential decoding.
1014
+
1015
+ If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those that
1016
+ don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of all
1017
+ `decoder_input_ids` of shape `(batch_size, sequence_length)`.
1018
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
1019
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
1020
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
1021
+ model's internal embedding lookup matrix.
1022
+ use_cache (`bool`, *optional*):
1023
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
1024
+ `past_key_values`).
1025
+ output_attentions (`bool`, *optional*):
1026
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
1027
+ tensors for more detail.
1028
+ output_hidden_states (`bool`, *optional*):
1029
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
1030
+ more detail.
1031
+ output_router_logits (`bool`, *optional*):
1032
+ Whether or not to return the logits of all the routers. They are useful for computing the router loss, and
1033
+ should not be returned during inference.
1034
+ return_dict (`bool`, *optional*):
1035
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
1036
+ """
1037
+
1038
+
1039
+ @add_start_docstrings(
1040
+ "The bare Orion Model outputting raw hidden-states without any specific head on top.",
1041
+ ORION_START_DOCSTRING,
1042
+ )
1043
+ class OrionModel(OrionPreTrainedModel):
1044
+ """
1045
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`OrionDecoderLayer`]
1046
+
1047
+ Args:
1048
+ config: OrionConfig
1049
+ """
1050
+
1051
+ def __init__(self, config: OrionConfig):
1052
+ super().__init__(config)
1053
+ self.padding_idx = config.pad_token_id
1054
+ self.vocab_size = config.vocab_size
1055
+
1056
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
1057
+ self.layers = nn.ModuleList(
1058
+ [OrionDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
1059
+ )
1060
+ self._attn_implementation = config._attn_implementation
1061
+ self.norm = OrionRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
1062
+
1063
+ self.gradient_checkpointing = False
1064
+ # Initialize weights and apply final processing
1065
+ self.post_init()
1066
+
1067
+ def get_input_embeddings(self):
1068
+ return self.embed_tokens
1069
+
1070
+ def set_input_embeddings(self, value):
1071
+ self.embed_tokens = value
1072
+
1073
+ # Ignore copy
1074
+ @add_start_docstrings_to_model_forward(ORION_INPUTS_DOCSTRING)
1075
+ def forward(
1076
+ self,
1077
+ input_ids: torch.LongTensor = None,
1078
+ attention_mask: Optional[torch.Tensor] = None,
1079
+ position_ids: Optional[torch.LongTensor] = None,
1080
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1081
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1082
+ use_cache: Optional[bool] = None,
1083
+ output_attentions: Optional[bool] = None,
1084
+ output_hidden_states: Optional[bool] = None,
1085
+ output_router_logits: Optional[bool] = None,
1086
+ return_dict: Optional[bool] = None,
1087
+ ) -> Union[Tuple, MoeModelOutputWithPast]:
1088
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1089
+ output_router_logits = (
1090
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
1091
+ )
1092
+ output_hidden_states = (
1093
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1094
+ )
1095
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
1096
+
1097
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1098
+
1099
+ # retrieve input_ids and inputs_embeds
1100
+ if input_ids is not None and inputs_embeds is not None:
1101
+ raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
1102
+ elif input_ids is not None:
1103
+ batch_size, seq_length = input_ids.shape
1104
+ elif inputs_embeds is not None:
1105
+ batch_size, seq_length, _ = inputs_embeds.shape
1106
+ else:
1107
+ raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
1108
+
1109
+ past_key_values_length = 0
1110
+
1111
+ if self.gradient_checkpointing and self.training:
1112
+ if use_cache:
1113
+ logger.warning_once(
1114
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
1115
+ )
1116
+ use_cache = False
1117
+
1118
+ if use_cache:
1119
+ use_legacy_cache = not isinstance(past_key_values, Cache)
1120
+ if use_legacy_cache:
1121
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
1122
+ past_key_values_length = past_key_values.get_usable_length(seq_length)
1123
+
1124
+ if position_ids is None:
1125
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
1126
+ position_ids = torch.arange(
1127
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
1128
+ )
1129
+ position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
1130
+ else:
1131
+ position_ids = position_ids.view(-1, seq_length).long()
1132
+
1133
+ if inputs_embeds is None:
1134
+ inputs_embeds = self.embed_tokens(input_ids)
1135
+
1136
+ if attention_mask is not None and self._attn_implementation == "flash_attention_2" and use_cache:
1137
+ is_padding_right = attention_mask[:, -1].sum().item() != batch_size
1138
+ if is_padding_right:
1139
+ raise ValueError(
1140
+ "You are attempting to perform batched generation with padding_side='right'"
1141
+ " this may lead to unexpected behaviour for Flash Attention version of Orion. Make sure to "
1142
+ " call `tokenizer.padding_side = 'left'` before tokenizing the input. "
1143
+ )
1144
+
1145
+ if self._attn_implementation == "flash_attention_2":
1146
+ # 2d mask is passed through the layers
1147
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
1148
+ elif self._attn_implementation == "sdpa" and not output_attentions:
1149
+ # output_attentions=True can not be supported when using SDPA, and we fall back on
1150
+ # the manual implementation that requires a 4D causal mask in all cases.
1151
+ attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(
1152
+ attention_mask,
1153
+ (batch_size, seq_length),
1154
+ inputs_embeds,
1155
+ past_key_values_length,
1156
+ sliding_window=self.config.sliding_window,
1157
+ )
1158
+ else:
1159
+ # 4d mask is passed through the layers
1160
+ attention_mask = _prepare_4d_causal_attention_mask(
1161
+ attention_mask,
1162
+ (batch_size, seq_length),
1163
+ inputs_embeds,
1164
+ past_key_values_length,
1165
+ sliding_window=self.config.sliding_window,
1166
+ )
1167
+
1168
+ hidden_states = inputs_embeds
1169
+
1170
+ # decoder layers
1171
+ all_hidden_states = () if output_hidden_states else None
1172
+ all_self_attns = () if output_attentions else None
1173
+ all_router_logits = () if output_router_logits else None
1174
+ next_decoder_cache = None
1175
+
1176
+ for decoder_layer in self.layers:
1177
+ if output_hidden_states:
1178
+ all_hidden_states += (hidden_states,)
1179
+
1180
+ if self.gradient_checkpointing and self.training:
1181
+ layer_outputs = self._gradient_checkpointing_func(
1182
+ decoder_layer.__call__,
1183
+ hidden_states,
1184
+ attention_mask,
1185
+ position_ids,
1186
+ past_key_values,
1187
+ output_attentions,
1188
+ output_router_logits,
1189
+ use_cache,
1190
+ )
1191
+ else:
1192
+ layer_outputs = decoder_layer(
1193
+ hidden_states,
1194
+ attention_mask=attention_mask,
1195
+ position_ids=position_ids,
1196
+ past_key_value=past_key_values,
1197
+ output_attentions=output_attentions,
1198
+ output_router_logits=output_router_logits,
1199
+ use_cache=use_cache,
1200
+ )
1201
+
1202
+ hidden_states = layer_outputs[0]
1203
+
1204
+ if use_cache:
1205
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1206
+
1207
+ if output_attentions:
1208
+ all_self_attns += (layer_outputs[1],)
1209
+
1210
+ if output_router_logits:
1211
+ all_router_logits += (layer_outputs[-1],)
1212
+
1213
+ hidden_states = self.norm(hidden_states)
1214
+
1215
+ # add hidden states from the last decoder layer
1216
+ if output_hidden_states:
1217
+ all_hidden_states += (hidden_states,)
1218
+
1219
+ next_cache = None
1220
+ if use_cache:
1221
+ next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
1222
+
1223
+ if not return_dict:
1224
+ return tuple(
1225
+ v
1226
+ for v in [hidden_states, next_cache, all_hidden_states, all_self_attns, all_router_logits]
1227
+ if v is not None
1228
+ )
1229
+ return MoeModelOutputWithPast(
1230
+ last_hidden_state=hidden_states,
1231
+ past_key_values=next_cache,
1232
+ hidden_states=all_hidden_states,
1233
+ attentions=all_self_attns,
1234
+ router_logits=all_router_logits,
1235
+ )
1236
+
1237
+
1238
+ class OrionForCausalLM(OrionPreTrainedModel):
1239
+ _tied_weights_keys = ["lm_head.weight"]
1240
+
1241
+ def __init__(self, config):
1242
+ super().__init__(config)
1243
+ self.model = OrionModel(config)
1244
+ self.vocab_size = config.vocab_size
1245
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1246
+ self.router_aux_loss_coef = config.router_aux_loss_coef
1247
+ self.num_experts = config.num_local_experts
1248
+ self.num_experts_per_tok = config.num_experts_per_tok
1249
+ # Initialize weights and apply final processing
1250
+ self.post_init()
1251
+
1252
+ def get_input_embeddings(self):
1253
+ return self.model.embed_tokens
1254
+
1255
+ def set_input_embeddings(self, value):
1256
+ self.model.embed_tokens = value
1257
+
1258
+ def get_output_embeddings(self):
1259
+ return self.lm_head
1260
+
1261
+ def set_output_embeddings(self, new_embeddings):
1262
+ self.lm_head = new_embeddings
1263
+
1264
+ def set_decoder(self, decoder):
1265
+ self.model = decoder
1266
+
1267
+ def get_decoder(self):
1268
+ return self.model
1269
+
1270
+ @add_start_docstrings_to_model_forward(ORION_INPUTS_DOCSTRING)
1271
+ @replace_return_docstrings(output_type=MoeCausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1272
+ # Ignore copy
1273
+ def forward(
1274
+ self,
1275
+ input_ids: torch.LongTensor = None,
1276
+ attention_mask: Optional[torch.Tensor] = None,
1277
+ position_ids: Optional[torch.LongTensor] = None,
1278
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1279
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1280
+ labels: Optional[torch.LongTensor] = None,
1281
+ use_cache: Optional[bool] = None,
1282
+ output_attentions: Optional[bool] = None,
1283
+ output_hidden_states: Optional[bool] = None,
1284
+ output_router_logits: Optional[bool] = None,
1285
+ return_dict: Optional[bool] = None,
1286
+ ) -> Union[Tuple, MoeCausalLMOutputWithPast]:
1287
+ r"""
1288
+ Args:
1289
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1290
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1291
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1292
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1293
+
1294
+ Returns:
1295
+ """
1296
+
1297
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1298
+ output_router_logits = (
1299
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
1300
+ )
1301
+
1302
+ output_hidden_states = (
1303
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1304
+ )
1305
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1306
+
1307
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1308
+ outputs = self.model(
1309
+ input_ids=input_ids,
1310
+ attention_mask=attention_mask,
1311
+ position_ids=position_ids,
1312
+ past_key_values=past_key_values,
1313
+ inputs_embeds=inputs_embeds,
1314
+ use_cache=use_cache,
1315
+ output_attentions=output_attentions,
1316
+ output_hidden_states=output_hidden_states,
1317
+ output_router_logits=output_router_logits,
1318
+ return_dict=return_dict,
1319
+ )
1320
+
1321
+ hidden_states = outputs[0]
1322
+ logits = self.lm_head(hidden_states)
1323
+ logits = logits.float()
1324
+
1325
+ loss = None
1326
+ if labels is not None:
1327
+ # Shift so that tokens < n predict n
1328
+ shift_logits = logits[..., :-1, :].contiguous()
1329
+ shift_labels = labels[..., 1:].contiguous()
1330
+ # Flatten the tokens
1331
+ loss_fct = CrossEntropyLoss()
1332
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1333
+ shift_labels = shift_labels.view(-1)
1334
+ # Enable model parallelism
1335
+ shift_labels = shift_labels.to(shift_logits.device)
1336
+ loss = loss_fct(shift_logits, shift_labels)
1337
+
1338
+ aux_loss = None
1339
+ if output_router_logits:
1340
+ aux_loss = load_balancing_loss_func(
1341
+ outputs.router_logits if return_dict else outputs[-1],
1342
+ self.num_experts,
1343
+ self.num_experts_per_tok,
1344
+ attention_mask,
1345
+ )
1346
+ if labels is not None:
1347
+ loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
1348
+
1349
+ if not return_dict:
1350
+ output = (logits,) + outputs[1:]
1351
+ if output_router_logits:
1352
+ output = (aux_loss,) + output
1353
+ return (loss,) + output if loss is not None else output
1354
+
1355
+ return MoeCausalLMOutputWithPast(
1356
+ loss=loss,
1357
+ aux_loss=aux_loss,
1358
+ logits=logits,
1359
+ past_key_values=outputs.past_key_values,
1360
+ hidden_states=outputs.hidden_states,
1361
+ attentions=outputs.attentions,
1362
+ router_logits=outputs.router_logits,
1363
+ )
1364
+
1365
+ def prepare_inputs_for_generation(
1366
+ self,
1367
+ input_ids,
1368
+ past_key_values=None,
1369
+ attention_mask=None,
1370
+ inputs_embeds=None,
1371
+ output_router_logits=False,
1372
+ **kwargs,
1373
+ ):
1374
+ # Omit tokens covered by past_key_values
1375
+ if past_key_values is not None:
1376
+ if isinstance(past_key_values, Cache):
1377
+ cache_length = past_key_values.get_seq_length()
1378
+ past_length = past_key_values.seen_tokens
1379
+ max_cache_length = past_key_values.get_max_length()
1380
+ else:
1381
+ cache_length = past_length = past_key_values[0][0].shape[2]
1382
+ max_cache_length = None
1383
+
1384
+ # Keep only the unprocessed tokens:
1385
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
1386
+ # some of the inputs are exclusively passed as part of the cache (e.g. when passing input_embeds as
1387
+ # input)
1388
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
1389
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
1390
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
1391
+ # input_ids based on the past_length.
1392
+ elif past_length < input_ids.shape[1]:
1393
+ input_ids = input_ids[:, past_length:]
1394
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
1395
+
1396
+ # If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
1397
+ if (
1398
+ max_cache_length is not None
1399
+ and attention_mask is not None
1400
+ and cache_length + input_ids.shape[1] > max_cache_length
1401
+ ):
1402
+ attention_mask = attention_mask[:, -max_cache_length:]
1403
+
1404
+ position_ids = kwargs.get("position_ids", None)
1405
+ if attention_mask is not None and position_ids is None:
1406
+ # create position_ids on the fly for batch generation
1407
+ position_ids = attention_mask.long().cumsum(-1) - 1
1408
+ position_ids.masked_fill_(attention_mask == 0, 1)
1409
+ if past_key_values:
1410
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1411
+
1412
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1413
+ if inputs_embeds is not None and past_key_values is None:
1414
+ model_inputs = {"inputs_embeds": inputs_embeds}
1415
+ else:
1416
+ model_inputs = {"input_ids": input_ids}
1417
+
1418
+ model_inputs.update(
1419
+ {
1420
+ "position_ids": position_ids,
1421
+ "past_key_values": past_key_values,
1422
+ "use_cache": kwargs.get("use_cache"),
1423
+ "attention_mask": attention_mask,
1424
+ "output_router_logits": output_router_logits,
1425
+ }
1426
+ )
1427
+ return model_inputs
1428
+
1429
+ @staticmethod
1430
+ def _reorder_cache(past_key_values, beam_idx):
1431
+ reordered_past = ()
1432
+ for layer_past in past_key_values:
1433
+ reordered_past += (
1434
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
1435
+ )
1436
+ return reordered_past
1437
+
1438
+
1439
+ @add_start_docstrings(
1440
+ """
1441
+ The Orion Model transformer with a sequence classification head on top (linear layer).
1442
+
1443
+ [`OrionForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1444
+ (e.g. GPT-2) do.
1445
+
1446
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1447
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1448
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1449
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1450
+ each row of the batch).
1451
+ """,
1452
+ ORION_START_DOCSTRING,
1453
+ )
1454
+ class OrionForSequenceClassification(OrionPreTrainedModel):
1455
+ def __init__(self, config):
1456
+ super().__init__(config)
1457
+ self.num_labels = config.num_labels
1458
+ self.model = OrionModel(config)
1459
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1460
+
1461
+ # Initialize weights and apply final processing
1462
+ self.post_init()
1463
+
1464
+ def get_input_embeddings(self):
1465
+ return self.model.embed_tokens
1466
+
1467
+ def set_input_embeddings(self, value):
1468
+ self.model.embed_tokens = value
1469
+
1470
+ @add_start_docstrings_to_model_forward(ORION_INPUTS_DOCSTRING)
1471
+ def forward(
1472
+ self,
1473
+ input_ids: torch.LongTensor = None,
1474
+ attention_mask: Optional[torch.Tensor] = None,
1475
+ position_ids: Optional[torch.LongTensor] = None,
1476
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1477
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1478
+ labels: Optional[torch.LongTensor] = None,
1479
+ use_cache: Optional[bool] = None,
1480
+ output_attentions: Optional[bool] = None,
1481
+ output_hidden_states: Optional[bool] = None,
1482
+ return_dict: Optional[bool] = None,
1483
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1484
+ r"""
1485
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1486
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1487
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1488
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1489
+ """
1490
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1491
+
1492
+ transformer_outputs = self.model(
1493
+ input_ids,
1494
+ attention_mask=attention_mask,
1495
+ position_ids=position_ids,
1496
+ past_key_values=past_key_values,
1497
+ inputs_embeds=inputs_embeds,
1498
+ use_cache=use_cache,
1499
+ output_attentions=output_attentions,
1500
+ output_hidden_states=output_hidden_states,
1501
+ return_dict=return_dict,
1502
+ )
1503
+ hidden_states = transformer_outputs[0]
1504
+ logits = self.score(hidden_states)
1505
+
1506
+ if input_ids is not None:
1507
+ batch_size = input_ids.shape[0]
1508
+ else:
1509
+ batch_size = inputs_embeds.shape[0]
1510
+
1511
+ if self.config.pad_token_id is None and batch_size != 1:
1512
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1513
+ if self.config.pad_token_id is None:
1514
+ sequence_lengths = -1
1515
+ else:
1516
+ if input_ids is not None:
1517
+ # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
1518
+ sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
1519
+ sequence_lengths = sequence_lengths % input_ids.shape[-1]
1520
+ sequence_lengths = sequence_lengths.to(logits.device)
1521
+ else:
1522
+ sequence_lengths = -1
1523
+
1524
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1525
+
1526
+ loss = None
1527
+ if labels is not None:
1528
+ labels = labels.to(logits.device)
1529
+ if self.config.problem_type is None:
1530
+ if self.num_labels == 1:
1531
+ self.config.problem_type = "regression"
1532
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1533
+ self.config.problem_type = "single_label_classification"
1534
+ else:
1535
+ self.config.problem_type = "multi_label_classification"
1536
+
1537
+ if self.config.problem_type == "regression":
1538
+ loss_fct = MSELoss()
1539
+ if self.num_labels == 1:
1540
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1541
+ else:
1542
+ loss = loss_fct(pooled_logits, labels)
1543
+ elif self.config.problem_type == "single_label_classification":
1544
+ loss_fct = CrossEntropyLoss()
1545
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1546
+ elif self.config.problem_type == "multi_label_classification":
1547
+ loss_fct = BCEWithLogitsLoss()
1548
+ loss = loss_fct(pooled_logits, labels)
1549
+ if not return_dict:
1550
+ output = (pooled_logits,) + transformer_outputs[1:]
1551
+ return ((loss,) + output) if loss is not None else output
1552
+
1553
+ return SequenceClassifierOutputWithPast(
1554
+ loss=loss,
1555
+ logits=pooled_logits,
1556
+ past_key_values=transformer_outputs.past_key_values,
1557
+ hidden_states=transformer_outputs.hidden_states,
1558
+ attentions=transformer_outputs.attentions,
1559
+ )
pytorch_model-00001-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d36d0158c168e32e5607ab5da7f843847c98df5f0889221a38fe2e5444936e86
3
+ size 9993276526
pytorch_model-00002-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d8c1e1438785ec911b45e0c8c8e083d12f172f94ac6ee4330a1f1d75808a48f
3
+ size 9934491452
pytorch_model-00003-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:179c85e5c75d1e189d43539689a542ca3ffbba56137a543a4ae5c31f0fc0970b
3
+ size 9934491428
pytorch_model-00004-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb6abef0b5e9daf5b1b0eb29e498a9b75626ea243ef8d8deb5a4c909a2aecbb2
3
+ size 9898923950
pytorch_model-00005-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:649510c074f27f04badbecd672fc0fe1fedfe96d1c769770fcf1f241c08546eb
3
+ size 9934491580
pytorch_model-00006-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a9b47baff43bac4a84c46a002246f3cdfa6471432dd9915ac1d1e01e28ba61d
3
+ size 9934491508
pytorch_model-00007-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee8e29418b42d0202b78f3739edc6545c3c64e6bde57c6be1f43177a6ff98ccb
3
+ size 9898923974
pytorch_model-00008-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8fd166daa2d43f9072e995d5cf6b25dbc3ad8d8492ab65628d383192c0d0da07
3
+ size 9934491580
pytorch_model-00009-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6a3f590b76321948dd858ef36c2e404904df610690b8942fe9ae7a275c1cee8
3
+ size 9934491508
pytorch_model-00010-of-00010.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a573470cc7afcc4244282435a63d58f7cd46f037cea802b15a27759fda189ebb
3
+ size 6956465520
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,1002 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 96354181120
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00010-of-00010.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00010.bin",
8
+ "model.layers.0.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00001-of-00010.bin",
9
+ "model.layers.0.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00001-of-00010.bin",
10
+ "model.layers.0.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00001-of-00010.bin",
11
+ "model.layers.0.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00001-of-00010.bin",
12
+ "model.layers.0.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00001-of-00010.bin",
13
+ "model.layers.0.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00001-of-00010.bin",
14
+ "model.layers.0.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00001-of-00010.bin",
15
+ "model.layers.0.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00001-of-00010.bin",
16
+ "model.layers.0.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00001-of-00010.bin",
17
+ "model.layers.0.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00001-of-00010.bin",
18
+ "model.layers.0.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00001-of-00010.bin",
19
+ "model.layers.0.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00001-of-00010.bin",
20
+ "model.layers.0.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00001-of-00010.bin",
21
+ "model.layers.0.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00001-of-00010.bin",
22
+ "model.layers.0.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00001-of-00010.bin",
23
+ "model.layers.0.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00001-of-00010.bin",
24
+ "model.layers.0.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00001-of-00010.bin",
25
+ "model.layers.0.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00001-of-00010.bin",
26
+ "model.layers.0.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00001-of-00010.bin",
27
+ "model.layers.0.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00001-of-00010.bin",
28
+ "model.layers.0.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00001-of-00010.bin",
29
+ "model.layers.0.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00001-of-00010.bin",
30
+ "model.layers.0.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00001-of-00010.bin",
31
+ "model.layers.0.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00001-of-00010.bin",
32
+ "model.layers.0.block_sparse_moe.gate.weight": "pytorch_model-00001-of-00010.bin",
33
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00010.bin",
34
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00010.bin",
35
+ "model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00010.bin",
36
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00010.bin",
37
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00010.bin",
38
+ "model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00010.bin",
39
+ "model.layers.1.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00001-of-00010.bin",
40
+ "model.layers.1.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00001-of-00010.bin",
41
+ "model.layers.1.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00001-of-00010.bin",
42
+ "model.layers.1.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00001-of-00010.bin",
43
+ "model.layers.1.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00001-of-00010.bin",
44
+ "model.layers.1.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00001-of-00010.bin",
45
+ "model.layers.1.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00001-of-00010.bin",
46
+ "model.layers.1.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00001-of-00010.bin",
47
+ "model.layers.1.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00001-of-00010.bin",
48
+ "model.layers.1.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00001-of-00010.bin",
49
+ "model.layers.1.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00001-of-00010.bin",
50
+ "model.layers.1.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00001-of-00010.bin",
51
+ "model.layers.1.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00001-of-00010.bin",
52
+ "model.layers.1.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00001-of-00010.bin",
53
+ "model.layers.1.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00001-of-00010.bin",
54
+ "model.layers.1.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00001-of-00010.bin",
55
+ "model.layers.1.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00001-of-00010.bin",
56
+ "model.layers.1.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00001-of-00010.bin",
57
+ "model.layers.1.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00001-of-00010.bin",
58
+ "model.layers.1.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00001-of-00010.bin",
59
+ "model.layers.1.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00001-of-00010.bin",
60
+ "model.layers.1.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00001-of-00010.bin",
61
+ "model.layers.1.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00001-of-00010.bin",
62
+ "model.layers.1.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00001-of-00010.bin",
63
+ "model.layers.1.block_sparse_moe.gate.weight": "pytorch_model-00001-of-00010.bin",
64
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00010.bin",
65
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00010.bin",
66
+ "model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00010.bin",
67
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00010.bin",
68
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00010.bin",
69
+ "model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00010.bin",
70
+ "model.layers.10.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00004-of-00010.bin",
71
+ "model.layers.10.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00004-of-00010.bin",
72
+ "model.layers.10.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00004-of-00010.bin",
73
+ "model.layers.10.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00004-of-00010.bin",
74
+ "model.layers.10.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00004-of-00010.bin",
75
+ "model.layers.10.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00004-of-00010.bin",
76
+ "model.layers.10.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00004-of-00010.bin",
77
+ "model.layers.10.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00004-of-00010.bin",
78
+ "model.layers.10.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00004-of-00010.bin",
79
+ "model.layers.10.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00004-of-00010.bin",
80
+ "model.layers.10.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00004-of-00010.bin",
81
+ "model.layers.10.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00004-of-00010.bin",
82
+ "model.layers.10.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00004-of-00010.bin",
83
+ "model.layers.10.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00004-of-00010.bin",
84
+ "model.layers.10.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00004-of-00010.bin",
85
+ "model.layers.10.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00004-of-00010.bin",
86
+ "model.layers.10.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00004-of-00010.bin",
87
+ "model.layers.10.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00004-of-00010.bin",
88
+ "model.layers.10.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00004-of-00010.bin",
89
+ "model.layers.10.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00004-of-00010.bin",
90
+ "model.layers.10.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00004-of-00010.bin",
91
+ "model.layers.10.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00004-of-00010.bin",
92
+ "model.layers.10.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00004-of-00010.bin",
93
+ "model.layers.10.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00004-of-00010.bin",
94
+ "model.layers.10.block_sparse_moe.gate.weight": "pytorch_model-00004-of-00010.bin",
95
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00004-of-00010.bin",
96
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00004-of-00010.bin",
97
+ "model.layers.10.self_attn.k_proj.weight": "pytorch_model-00004-of-00010.bin",
98
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00004-of-00010.bin",
99
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00004-of-00010.bin",
100
+ "model.layers.10.self_attn.v_proj.weight": "pytorch_model-00004-of-00010.bin",
101
+ "model.layers.11.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00004-of-00010.bin",
102
+ "model.layers.11.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00004-of-00010.bin",
103
+ "model.layers.11.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00004-of-00010.bin",
104
+ "model.layers.11.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00004-of-00010.bin",
105
+ "model.layers.11.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00004-of-00010.bin",
106
+ "model.layers.11.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00004-of-00010.bin",
107
+ "model.layers.11.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00004-of-00010.bin",
108
+ "model.layers.11.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00004-of-00010.bin",
109
+ "model.layers.11.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00004-of-00010.bin",
110
+ "model.layers.11.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00004-of-00010.bin",
111
+ "model.layers.11.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00004-of-00010.bin",
112
+ "model.layers.11.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00004-of-00010.bin",
113
+ "model.layers.11.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00004-of-00010.bin",
114
+ "model.layers.11.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00004-of-00010.bin",
115
+ "model.layers.11.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00004-of-00010.bin",
116
+ "model.layers.11.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00004-of-00010.bin",
117
+ "model.layers.11.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00004-of-00010.bin",
118
+ "model.layers.11.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00004-of-00010.bin",
119
+ "model.layers.11.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00004-of-00010.bin",
120
+ "model.layers.11.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00004-of-00010.bin",
121
+ "model.layers.11.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00004-of-00010.bin",
122
+ "model.layers.11.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00004-of-00010.bin",
123
+ "model.layers.11.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00004-of-00010.bin",
124
+ "model.layers.11.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00004-of-00010.bin",
125
+ "model.layers.11.block_sparse_moe.gate.weight": "pytorch_model-00004-of-00010.bin",
126
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00004-of-00010.bin",
127
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00004-of-00010.bin",
128
+ "model.layers.11.self_attn.k_proj.weight": "pytorch_model-00004-of-00010.bin",
129
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00004-of-00010.bin",
130
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00004-of-00010.bin",
131
+ "model.layers.11.self_attn.v_proj.weight": "pytorch_model-00004-of-00010.bin",
132
+ "model.layers.12.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00004-of-00010.bin",
133
+ "model.layers.12.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00004-of-00010.bin",
134
+ "model.layers.12.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00004-of-00010.bin",
135
+ "model.layers.12.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00004-of-00010.bin",
136
+ "model.layers.12.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00004-of-00010.bin",
137
+ "model.layers.12.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00004-of-00010.bin",
138
+ "model.layers.12.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00004-of-00010.bin",
139
+ "model.layers.12.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00004-of-00010.bin",
140
+ "model.layers.12.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00004-of-00010.bin",
141
+ "model.layers.12.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00004-of-00010.bin",
142
+ "model.layers.12.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00004-of-00010.bin",
143
+ "model.layers.12.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00004-of-00010.bin",
144
+ "model.layers.12.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00004-of-00010.bin",
145
+ "model.layers.12.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00004-of-00010.bin",
146
+ "model.layers.12.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00004-of-00010.bin",
147
+ "model.layers.12.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00004-of-00010.bin",
148
+ "model.layers.12.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00004-of-00010.bin",
149
+ "model.layers.12.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00004-of-00010.bin",
150
+ "model.layers.12.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00004-of-00010.bin",
151
+ "model.layers.12.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00004-of-00010.bin",
152
+ "model.layers.12.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00004-of-00010.bin",
153
+ "model.layers.12.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00004-of-00010.bin",
154
+ "model.layers.12.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00004-of-00010.bin",
155
+ "model.layers.12.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00004-of-00010.bin",
156
+ "model.layers.12.block_sparse_moe.gate.weight": "pytorch_model-00004-of-00010.bin",
157
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00004-of-00010.bin",
158
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00004-of-00010.bin",
159
+ "model.layers.12.self_attn.k_proj.weight": "pytorch_model-00004-of-00010.bin",
160
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00004-of-00010.bin",
161
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00004-of-00010.bin",
162
+ "model.layers.12.self_attn.v_proj.weight": "pytorch_model-00004-of-00010.bin",
163
+ "model.layers.13.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00004-of-00010.bin",
164
+ "model.layers.13.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00004-of-00010.bin",
165
+ "model.layers.13.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00004-of-00010.bin",
166
+ "model.layers.13.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00005-of-00010.bin",
167
+ "model.layers.13.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00005-of-00010.bin",
168
+ "model.layers.13.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00005-of-00010.bin",
169
+ "model.layers.13.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00005-of-00010.bin",
170
+ "model.layers.13.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00005-of-00010.bin",
171
+ "model.layers.13.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00005-of-00010.bin",
172
+ "model.layers.13.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00005-of-00010.bin",
173
+ "model.layers.13.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00005-of-00010.bin",
174
+ "model.layers.13.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00005-of-00010.bin",
175
+ "model.layers.13.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00005-of-00010.bin",
176
+ "model.layers.13.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00005-of-00010.bin",
177
+ "model.layers.13.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00005-of-00010.bin",
178
+ "model.layers.13.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00005-of-00010.bin",
179
+ "model.layers.13.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00005-of-00010.bin",
180
+ "model.layers.13.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00005-of-00010.bin",
181
+ "model.layers.13.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00005-of-00010.bin",
182
+ "model.layers.13.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00005-of-00010.bin",
183
+ "model.layers.13.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00005-of-00010.bin",
184
+ "model.layers.13.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00005-of-00010.bin",
185
+ "model.layers.13.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00005-of-00010.bin",
186
+ "model.layers.13.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00005-of-00010.bin",
187
+ "model.layers.13.block_sparse_moe.gate.weight": "pytorch_model-00004-of-00010.bin",
188
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00005-of-00010.bin",
189
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00005-of-00010.bin",
190
+ "model.layers.13.self_attn.k_proj.weight": "pytorch_model-00004-of-00010.bin",
191
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00004-of-00010.bin",
192
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00004-of-00010.bin",
193
+ "model.layers.13.self_attn.v_proj.weight": "pytorch_model-00004-of-00010.bin",
194
+ "model.layers.14.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00005-of-00010.bin",
195
+ "model.layers.14.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00005-of-00010.bin",
196
+ "model.layers.14.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00005-of-00010.bin",
197
+ "model.layers.14.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00005-of-00010.bin",
198
+ "model.layers.14.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00005-of-00010.bin",
199
+ "model.layers.14.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00005-of-00010.bin",
200
+ "model.layers.14.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00005-of-00010.bin",
201
+ "model.layers.14.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00005-of-00010.bin",
202
+ "model.layers.14.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00005-of-00010.bin",
203
+ "model.layers.14.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00005-of-00010.bin",
204
+ "model.layers.14.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00005-of-00010.bin",
205
+ "model.layers.14.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00005-of-00010.bin",
206
+ "model.layers.14.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00005-of-00010.bin",
207
+ "model.layers.14.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00005-of-00010.bin",
208
+ "model.layers.14.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00005-of-00010.bin",
209
+ "model.layers.14.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00005-of-00010.bin",
210
+ "model.layers.14.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00005-of-00010.bin",
211
+ "model.layers.14.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00005-of-00010.bin",
212
+ "model.layers.14.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00005-of-00010.bin",
213
+ "model.layers.14.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00005-of-00010.bin",
214
+ "model.layers.14.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00005-of-00010.bin",
215
+ "model.layers.14.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00005-of-00010.bin",
216
+ "model.layers.14.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00005-of-00010.bin",
217
+ "model.layers.14.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00005-of-00010.bin",
218
+ "model.layers.14.block_sparse_moe.gate.weight": "pytorch_model-00005-of-00010.bin",
219
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00005-of-00010.bin",
220
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00005-of-00010.bin",
221
+ "model.layers.14.self_attn.k_proj.weight": "pytorch_model-00005-of-00010.bin",
222
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00005-of-00010.bin",
223
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00005-of-00010.bin",
224
+ "model.layers.14.self_attn.v_proj.weight": "pytorch_model-00005-of-00010.bin",
225
+ "model.layers.15.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00005-of-00010.bin",
226
+ "model.layers.15.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00005-of-00010.bin",
227
+ "model.layers.15.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00005-of-00010.bin",
228
+ "model.layers.15.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00005-of-00010.bin",
229
+ "model.layers.15.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00005-of-00010.bin",
230
+ "model.layers.15.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00005-of-00010.bin",
231
+ "model.layers.15.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00005-of-00010.bin",
232
+ "model.layers.15.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00005-of-00010.bin",
233
+ "model.layers.15.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00005-of-00010.bin",
234
+ "model.layers.15.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00005-of-00010.bin",
235
+ "model.layers.15.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00005-of-00010.bin",
236
+ "model.layers.15.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00005-of-00010.bin",
237
+ "model.layers.15.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00005-of-00010.bin",
238
+ "model.layers.15.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00005-of-00010.bin",
239
+ "model.layers.15.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00005-of-00010.bin",
240
+ "model.layers.15.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00005-of-00010.bin",
241
+ "model.layers.15.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00005-of-00010.bin",
242
+ "model.layers.15.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00005-of-00010.bin",
243
+ "model.layers.15.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00005-of-00010.bin",
244
+ "model.layers.15.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00005-of-00010.bin",
245
+ "model.layers.15.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00005-of-00010.bin",
246
+ "model.layers.15.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00005-of-00010.bin",
247
+ "model.layers.15.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00005-of-00010.bin",
248
+ "model.layers.15.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00005-of-00010.bin",
249
+ "model.layers.15.block_sparse_moe.gate.weight": "pytorch_model-00005-of-00010.bin",
250
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00005-of-00010.bin",
251
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00005-of-00010.bin",
252
+ "model.layers.15.self_attn.k_proj.weight": "pytorch_model-00005-of-00010.bin",
253
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00005-of-00010.bin",
254
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00005-of-00010.bin",
255
+ "model.layers.15.self_attn.v_proj.weight": "pytorch_model-00005-of-00010.bin",
256
+ "model.layers.16.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00005-of-00010.bin",
257
+ "model.layers.16.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00005-of-00010.bin",
258
+ "model.layers.16.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00005-of-00010.bin",
259
+ "model.layers.16.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00005-of-00010.bin",
260
+ "model.layers.16.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00005-of-00010.bin",
261
+ "model.layers.16.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00005-of-00010.bin",
262
+ "model.layers.16.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00005-of-00010.bin",
263
+ "model.layers.16.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00005-of-00010.bin",
264
+ "model.layers.16.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00005-of-00010.bin",
265
+ "model.layers.16.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00005-of-00010.bin",
266
+ "model.layers.16.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00005-of-00010.bin",
267
+ "model.layers.16.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00005-of-00010.bin",
268
+ "model.layers.16.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00006-of-00010.bin",
269
+ "model.layers.16.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00006-of-00010.bin",
270
+ "model.layers.16.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00006-of-00010.bin",
271
+ "model.layers.16.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00006-of-00010.bin",
272
+ "model.layers.16.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00006-of-00010.bin",
273
+ "model.layers.16.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00006-of-00010.bin",
274
+ "model.layers.16.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00006-of-00010.bin",
275
+ "model.layers.16.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00006-of-00010.bin",
276
+ "model.layers.16.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00006-of-00010.bin",
277
+ "model.layers.16.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00006-of-00010.bin",
278
+ "model.layers.16.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00006-of-00010.bin",
279
+ "model.layers.16.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00006-of-00010.bin",
280
+ "model.layers.16.block_sparse_moe.gate.weight": "pytorch_model-00005-of-00010.bin",
281
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00006-of-00010.bin",
282
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00006-of-00010.bin",
283
+ "model.layers.16.self_attn.k_proj.weight": "pytorch_model-00005-of-00010.bin",
284
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00005-of-00010.bin",
285
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00005-of-00010.bin",
286
+ "model.layers.16.self_attn.v_proj.weight": "pytorch_model-00005-of-00010.bin",
287
+ "model.layers.17.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00006-of-00010.bin",
288
+ "model.layers.17.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00006-of-00010.bin",
289
+ "model.layers.17.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00006-of-00010.bin",
290
+ "model.layers.17.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00006-of-00010.bin",
291
+ "model.layers.17.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00006-of-00010.bin",
292
+ "model.layers.17.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00006-of-00010.bin",
293
+ "model.layers.17.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00006-of-00010.bin",
294
+ "model.layers.17.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00006-of-00010.bin",
295
+ "model.layers.17.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00006-of-00010.bin",
296
+ "model.layers.17.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00006-of-00010.bin",
297
+ "model.layers.17.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00006-of-00010.bin",
298
+ "model.layers.17.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00006-of-00010.bin",
299
+ "model.layers.17.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00006-of-00010.bin",
300
+ "model.layers.17.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00006-of-00010.bin",
301
+ "model.layers.17.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00006-of-00010.bin",
302
+ "model.layers.17.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00006-of-00010.bin",
303
+ "model.layers.17.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00006-of-00010.bin",
304
+ "model.layers.17.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00006-of-00010.bin",
305
+ "model.layers.17.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00006-of-00010.bin",
306
+ "model.layers.17.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00006-of-00010.bin",
307
+ "model.layers.17.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00006-of-00010.bin",
308
+ "model.layers.17.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00006-of-00010.bin",
309
+ "model.layers.17.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00006-of-00010.bin",
310
+ "model.layers.17.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00006-of-00010.bin",
311
+ "model.layers.17.block_sparse_moe.gate.weight": "pytorch_model-00006-of-00010.bin",
312
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00006-of-00010.bin",
313
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00006-of-00010.bin",
314
+ "model.layers.17.self_attn.k_proj.weight": "pytorch_model-00006-of-00010.bin",
315
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00006-of-00010.bin",
316
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00006-of-00010.bin",
317
+ "model.layers.17.self_attn.v_proj.weight": "pytorch_model-00006-of-00010.bin",
318
+ "model.layers.18.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00006-of-00010.bin",
319
+ "model.layers.18.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00006-of-00010.bin",
320
+ "model.layers.18.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00006-of-00010.bin",
321
+ "model.layers.18.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00006-of-00010.bin",
322
+ "model.layers.18.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00006-of-00010.bin",
323
+ "model.layers.18.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00006-of-00010.bin",
324
+ "model.layers.18.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00006-of-00010.bin",
325
+ "model.layers.18.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00006-of-00010.bin",
326
+ "model.layers.18.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00006-of-00010.bin",
327
+ "model.layers.18.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00006-of-00010.bin",
328
+ "model.layers.18.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00006-of-00010.bin",
329
+ "model.layers.18.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00006-of-00010.bin",
330
+ "model.layers.18.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00006-of-00010.bin",
331
+ "model.layers.18.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00006-of-00010.bin",
332
+ "model.layers.18.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00006-of-00010.bin",
333
+ "model.layers.18.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00006-of-00010.bin",
334
+ "model.layers.18.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00006-of-00010.bin",
335
+ "model.layers.18.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00006-of-00010.bin",
336
+ "model.layers.18.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00006-of-00010.bin",
337
+ "model.layers.18.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00006-of-00010.bin",
338
+ "model.layers.18.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00006-of-00010.bin",
339
+ "model.layers.18.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00006-of-00010.bin",
340
+ "model.layers.18.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00006-of-00010.bin",
341
+ "model.layers.18.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00006-of-00010.bin",
342
+ "model.layers.18.block_sparse_moe.gate.weight": "pytorch_model-00006-of-00010.bin",
343
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00006-of-00010.bin",
344
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00006-of-00010.bin",
345
+ "model.layers.18.self_attn.k_proj.weight": "pytorch_model-00006-of-00010.bin",
346
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00006-of-00010.bin",
347
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00006-of-00010.bin",
348
+ "model.layers.18.self_attn.v_proj.weight": "pytorch_model-00006-of-00010.bin",
349
+ "model.layers.19.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00006-of-00010.bin",
350
+ "model.layers.19.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00006-of-00010.bin",
351
+ "model.layers.19.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00006-of-00010.bin",
352
+ "model.layers.19.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00006-of-00010.bin",
353
+ "model.layers.19.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00006-of-00010.bin",
354
+ "model.layers.19.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00006-of-00010.bin",
355
+ "model.layers.19.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00006-of-00010.bin",
356
+ "model.layers.19.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00006-of-00010.bin",
357
+ "model.layers.19.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00006-of-00010.bin",
358
+ "model.layers.19.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00006-of-00010.bin",
359
+ "model.layers.19.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00006-of-00010.bin",
360
+ "model.layers.19.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00006-of-00010.bin",
361
+ "model.layers.19.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00006-of-00010.bin",
362
+ "model.layers.19.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00006-of-00010.bin",
363
+ "model.layers.19.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00006-of-00010.bin",
364
+ "model.layers.19.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00006-of-00010.bin",
365
+ "model.layers.19.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00006-of-00010.bin",
366
+ "model.layers.19.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00006-of-00010.bin",
367
+ "model.layers.19.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00006-of-00010.bin",
368
+ "model.layers.19.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00006-of-00010.bin",
369
+ "model.layers.19.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00006-of-00010.bin",
370
+ "model.layers.19.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00007-of-00010.bin",
371
+ "model.layers.19.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00007-of-00010.bin",
372
+ "model.layers.19.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00007-of-00010.bin",
373
+ "model.layers.19.block_sparse_moe.gate.weight": "pytorch_model-00006-of-00010.bin",
374
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00007-of-00010.bin",
375
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00007-of-00010.bin",
376
+ "model.layers.19.self_attn.k_proj.weight": "pytorch_model-00006-of-00010.bin",
377
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00006-of-00010.bin",
378
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00006-of-00010.bin",
379
+ "model.layers.19.self_attn.v_proj.weight": "pytorch_model-00006-of-00010.bin",
380
+ "model.layers.2.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00001-of-00010.bin",
381
+ "model.layers.2.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00001-of-00010.bin",
382
+ "model.layers.2.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00001-of-00010.bin",
383
+ "model.layers.2.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00001-of-00010.bin",
384
+ "model.layers.2.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00001-of-00010.bin",
385
+ "model.layers.2.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00001-of-00010.bin",
386
+ "model.layers.2.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00001-of-00010.bin",
387
+ "model.layers.2.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00001-of-00010.bin",
388
+ "model.layers.2.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00001-of-00010.bin",
389
+ "model.layers.2.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00001-of-00010.bin",
390
+ "model.layers.2.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00001-of-00010.bin",
391
+ "model.layers.2.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00001-of-00010.bin",
392
+ "model.layers.2.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00001-of-00010.bin",
393
+ "model.layers.2.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00001-of-00010.bin",
394
+ "model.layers.2.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00001-of-00010.bin",
395
+ "model.layers.2.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00001-of-00010.bin",
396
+ "model.layers.2.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00001-of-00010.bin",
397
+ "model.layers.2.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00001-of-00010.bin",
398
+ "model.layers.2.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00001-of-00010.bin",
399
+ "model.layers.2.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00001-of-00010.bin",
400
+ "model.layers.2.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00001-of-00010.bin",
401
+ "model.layers.2.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00001-of-00010.bin",
402
+ "model.layers.2.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00001-of-00010.bin",
403
+ "model.layers.2.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00001-of-00010.bin",
404
+ "model.layers.2.block_sparse_moe.gate.weight": "pytorch_model-00001-of-00010.bin",
405
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00010.bin",
406
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00010.bin",
407
+ "model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00010.bin",
408
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00010.bin",
409
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00010.bin",
410
+ "model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00010.bin",
411
+ "model.layers.20.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00007-of-00010.bin",
412
+ "model.layers.20.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00007-of-00010.bin",
413
+ "model.layers.20.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00007-of-00010.bin",
414
+ "model.layers.20.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00007-of-00010.bin",
415
+ "model.layers.20.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00007-of-00010.bin",
416
+ "model.layers.20.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00007-of-00010.bin",
417
+ "model.layers.20.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00007-of-00010.bin",
418
+ "model.layers.20.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00007-of-00010.bin",
419
+ "model.layers.20.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00007-of-00010.bin",
420
+ "model.layers.20.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00007-of-00010.bin",
421
+ "model.layers.20.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00007-of-00010.bin",
422
+ "model.layers.20.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00007-of-00010.bin",
423
+ "model.layers.20.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00007-of-00010.bin",
424
+ "model.layers.20.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00007-of-00010.bin",
425
+ "model.layers.20.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00007-of-00010.bin",
426
+ "model.layers.20.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00007-of-00010.bin",
427
+ "model.layers.20.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00007-of-00010.bin",
428
+ "model.layers.20.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00007-of-00010.bin",
429
+ "model.layers.20.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00007-of-00010.bin",
430
+ "model.layers.20.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00007-of-00010.bin",
431
+ "model.layers.20.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00007-of-00010.bin",
432
+ "model.layers.20.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00007-of-00010.bin",
433
+ "model.layers.20.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00007-of-00010.bin",
434
+ "model.layers.20.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00007-of-00010.bin",
435
+ "model.layers.20.block_sparse_moe.gate.weight": "pytorch_model-00007-of-00010.bin",
436
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00007-of-00010.bin",
437
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00007-of-00010.bin",
438
+ "model.layers.20.self_attn.k_proj.weight": "pytorch_model-00007-of-00010.bin",
439
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00007-of-00010.bin",
440
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00007-of-00010.bin",
441
+ "model.layers.20.self_attn.v_proj.weight": "pytorch_model-00007-of-00010.bin",
442
+ "model.layers.21.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00007-of-00010.bin",
443
+ "model.layers.21.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00007-of-00010.bin",
444
+ "model.layers.21.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00007-of-00010.bin",
445
+ "model.layers.21.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00007-of-00010.bin",
446
+ "model.layers.21.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00007-of-00010.bin",
447
+ "model.layers.21.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00007-of-00010.bin",
448
+ "model.layers.21.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00007-of-00010.bin",
449
+ "model.layers.21.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00007-of-00010.bin",
450
+ "model.layers.21.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00007-of-00010.bin",
451
+ "model.layers.21.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00007-of-00010.bin",
452
+ "model.layers.21.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00007-of-00010.bin",
453
+ "model.layers.21.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00007-of-00010.bin",
454
+ "model.layers.21.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00007-of-00010.bin",
455
+ "model.layers.21.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00007-of-00010.bin",
456
+ "model.layers.21.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00007-of-00010.bin",
457
+ "model.layers.21.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00007-of-00010.bin",
458
+ "model.layers.21.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00007-of-00010.bin",
459
+ "model.layers.21.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00007-of-00010.bin",
460
+ "model.layers.21.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00007-of-00010.bin",
461
+ "model.layers.21.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00007-of-00010.bin",
462
+ "model.layers.21.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00007-of-00010.bin",
463
+ "model.layers.21.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00007-of-00010.bin",
464
+ "model.layers.21.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00007-of-00010.bin",
465
+ "model.layers.21.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00007-of-00010.bin",
466
+ "model.layers.21.block_sparse_moe.gate.weight": "pytorch_model-00007-of-00010.bin",
467
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00007-of-00010.bin",
468
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00007-of-00010.bin",
469
+ "model.layers.21.self_attn.k_proj.weight": "pytorch_model-00007-of-00010.bin",
470
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00007-of-00010.bin",
471
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00007-of-00010.bin",
472
+ "model.layers.21.self_attn.v_proj.weight": "pytorch_model-00007-of-00010.bin",
473
+ "model.layers.22.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00007-of-00010.bin",
474
+ "model.layers.22.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00007-of-00010.bin",
475
+ "model.layers.22.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00007-of-00010.bin",
476
+ "model.layers.22.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00007-of-00010.bin",
477
+ "model.layers.22.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00007-of-00010.bin",
478
+ "model.layers.22.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00007-of-00010.bin",
479
+ "model.layers.22.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00007-of-00010.bin",
480
+ "model.layers.22.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00007-of-00010.bin",
481
+ "model.layers.22.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00007-of-00010.bin",
482
+ "model.layers.22.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00007-of-00010.bin",
483
+ "model.layers.22.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00007-of-00010.bin",
484
+ "model.layers.22.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00007-of-00010.bin",
485
+ "model.layers.22.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00007-of-00010.bin",
486
+ "model.layers.22.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00007-of-00010.bin",
487
+ "model.layers.22.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00007-of-00010.bin",
488
+ "model.layers.22.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00007-of-00010.bin",
489
+ "model.layers.22.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00007-of-00010.bin",
490
+ "model.layers.22.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00007-of-00010.bin",
491
+ "model.layers.22.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00007-of-00010.bin",
492
+ "model.layers.22.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00007-of-00010.bin",
493
+ "model.layers.22.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00007-of-00010.bin",
494
+ "model.layers.22.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00007-of-00010.bin",
495
+ "model.layers.22.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00007-of-00010.bin",
496
+ "model.layers.22.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00007-of-00010.bin",
497
+ "model.layers.22.block_sparse_moe.gate.weight": "pytorch_model-00007-of-00010.bin",
498
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00007-of-00010.bin",
499
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00007-of-00010.bin",
500
+ "model.layers.22.self_attn.k_proj.weight": "pytorch_model-00007-of-00010.bin",
501
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00007-of-00010.bin",
502
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00007-of-00010.bin",
503
+ "model.layers.22.self_attn.v_proj.weight": "pytorch_model-00007-of-00010.bin",
504
+ "model.layers.23.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00007-of-00010.bin",
505
+ "model.layers.23.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00007-of-00010.bin",
506
+ "model.layers.23.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00007-of-00010.bin",
507
+ "model.layers.23.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00007-of-00010.bin",
508
+ "model.layers.23.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00007-of-00010.bin",
509
+ "model.layers.23.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00008-of-00010.bin",
510
+ "model.layers.23.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00008-of-00010.bin",
511
+ "model.layers.23.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00008-of-00010.bin",
512
+ "model.layers.23.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00008-of-00010.bin",
513
+ "model.layers.23.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00008-of-00010.bin",
514
+ "model.layers.23.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00008-of-00010.bin",
515
+ "model.layers.23.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00008-of-00010.bin",
516
+ "model.layers.23.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00008-of-00010.bin",
517
+ "model.layers.23.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00008-of-00010.bin",
518
+ "model.layers.23.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00008-of-00010.bin",
519
+ "model.layers.23.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00008-of-00010.bin",
520
+ "model.layers.23.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00008-of-00010.bin",
521
+ "model.layers.23.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00008-of-00010.bin",
522
+ "model.layers.23.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00008-of-00010.bin",
523
+ "model.layers.23.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00008-of-00010.bin",
524
+ "model.layers.23.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00008-of-00010.bin",
525
+ "model.layers.23.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00008-of-00010.bin",
526
+ "model.layers.23.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00008-of-00010.bin",
527
+ "model.layers.23.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00008-of-00010.bin",
528
+ "model.layers.23.block_sparse_moe.gate.weight": "pytorch_model-00007-of-00010.bin",
529
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00008-of-00010.bin",
530
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00008-of-00010.bin",
531
+ "model.layers.23.self_attn.k_proj.weight": "pytorch_model-00007-of-00010.bin",
532
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00007-of-00010.bin",
533
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00007-of-00010.bin",
534
+ "model.layers.23.self_attn.v_proj.weight": "pytorch_model-00007-of-00010.bin",
535
+ "model.layers.24.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00008-of-00010.bin",
536
+ "model.layers.24.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00008-of-00010.bin",
537
+ "model.layers.24.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00008-of-00010.bin",
538
+ "model.layers.24.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00008-of-00010.bin",
539
+ "model.layers.24.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00008-of-00010.bin",
540
+ "model.layers.24.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00008-of-00010.bin",
541
+ "model.layers.24.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00008-of-00010.bin",
542
+ "model.layers.24.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00008-of-00010.bin",
543
+ "model.layers.24.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00008-of-00010.bin",
544
+ "model.layers.24.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00008-of-00010.bin",
545
+ "model.layers.24.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00008-of-00010.bin",
546
+ "model.layers.24.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00008-of-00010.bin",
547
+ "model.layers.24.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00008-of-00010.bin",
548
+ "model.layers.24.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00008-of-00010.bin",
549
+ "model.layers.24.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00008-of-00010.bin",
550
+ "model.layers.24.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00008-of-00010.bin",
551
+ "model.layers.24.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00008-of-00010.bin",
552
+ "model.layers.24.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00008-of-00010.bin",
553
+ "model.layers.24.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00008-of-00010.bin",
554
+ "model.layers.24.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00008-of-00010.bin",
555
+ "model.layers.24.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00008-of-00010.bin",
556
+ "model.layers.24.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00008-of-00010.bin",
557
+ "model.layers.24.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00008-of-00010.bin",
558
+ "model.layers.24.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00008-of-00010.bin",
559
+ "model.layers.24.block_sparse_moe.gate.weight": "pytorch_model-00008-of-00010.bin",
560
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00008-of-00010.bin",
561
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00008-of-00010.bin",
562
+ "model.layers.24.self_attn.k_proj.weight": "pytorch_model-00008-of-00010.bin",
563
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00008-of-00010.bin",
564
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00008-of-00010.bin",
565
+ "model.layers.24.self_attn.v_proj.weight": "pytorch_model-00008-of-00010.bin",
566
+ "model.layers.25.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00008-of-00010.bin",
567
+ "model.layers.25.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00008-of-00010.bin",
568
+ "model.layers.25.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00008-of-00010.bin",
569
+ "model.layers.25.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00008-of-00010.bin",
570
+ "model.layers.25.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00008-of-00010.bin",
571
+ "model.layers.25.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00008-of-00010.bin",
572
+ "model.layers.25.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00008-of-00010.bin",
573
+ "model.layers.25.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00008-of-00010.bin",
574
+ "model.layers.25.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00008-of-00010.bin",
575
+ "model.layers.25.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00008-of-00010.bin",
576
+ "model.layers.25.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00008-of-00010.bin",
577
+ "model.layers.25.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00008-of-00010.bin",
578
+ "model.layers.25.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00008-of-00010.bin",
579
+ "model.layers.25.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00008-of-00010.bin",
580
+ "model.layers.25.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00008-of-00010.bin",
581
+ "model.layers.25.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00008-of-00010.bin",
582
+ "model.layers.25.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00008-of-00010.bin",
583
+ "model.layers.25.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00008-of-00010.bin",
584
+ "model.layers.25.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00008-of-00010.bin",
585
+ "model.layers.25.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00008-of-00010.bin",
586
+ "model.layers.25.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00008-of-00010.bin",
587
+ "model.layers.25.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00008-of-00010.bin",
588
+ "model.layers.25.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00008-of-00010.bin",
589
+ "model.layers.25.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00008-of-00010.bin",
590
+ "model.layers.25.block_sparse_moe.gate.weight": "pytorch_model-00008-of-00010.bin",
591
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00008-of-00010.bin",
592
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00008-of-00010.bin",
593
+ "model.layers.25.self_attn.k_proj.weight": "pytorch_model-00008-of-00010.bin",
594
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00008-of-00010.bin",
595
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00008-of-00010.bin",
596
+ "model.layers.25.self_attn.v_proj.weight": "pytorch_model-00008-of-00010.bin",
597
+ "model.layers.26.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00008-of-00010.bin",
598
+ "model.layers.26.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00008-of-00010.bin",
599
+ "model.layers.26.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00008-of-00010.bin",
600
+ "model.layers.26.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00008-of-00010.bin",
601
+ "model.layers.26.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00008-of-00010.bin",
602
+ "model.layers.26.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00008-of-00010.bin",
603
+ "model.layers.26.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00008-of-00010.bin",
604
+ "model.layers.26.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00008-of-00010.bin",
605
+ "model.layers.26.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00008-of-00010.bin",
606
+ "model.layers.26.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00008-of-00010.bin",
607
+ "model.layers.26.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00008-of-00010.bin",
608
+ "model.layers.26.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00008-of-00010.bin",
609
+ "model.layers.26.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00008-of-00010.bin",
610
+ "model.layers.26.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00008-of-00010.bin",
611
+ "model.layers.26.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00009-of-00010.bin",
612
+ "model.layers.26.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00009-of-00010.bin",
613
+ "model.layers.26.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00009-of-00010.bin",
614
+ "model.layers.26.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00009-of-00010.bin",
615
+ "model.layers.26.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00009-of-00010.bin",
616
+ "model.layers.26.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00009-of-00010.bin",
617
+ "model.layers.26.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00009-of-00010.bin",
618
+ "model.layers.26.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00009-of-00010.bin",
619
+ "model.layers.26.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00009-of-00010.bin",
620
+ "model.layers.26.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00009-of-00010.bin",
621
+ "model.layers.26.block_sparse_moe.gate.weight": "pytorch_model-00008-of-00010.bin",
622
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00009-of-00010.bin",
623
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00009-of-00010.bin",
624
+ "model.layers.26.self_attn.k_proj.weight": "pytorch_model-00008-of-00010.bin",
625
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00008-of-00010.bin",
626
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00008-of-00010.bin",
627
+ "model.layers.26.self_attn.v_proj.weight": "pytorch_model-00008-of-00010.bin",
628
+ "model.layers.27.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00009-of-00010.bin",
629
+ "model.layers.27.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00009-of-00010.bin",
630
+ "model.layers.27.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00009-of-00010.bin",
631
+ "model.layers.27.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00009-of-00010.bin",
632
+ "model.layers.27.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00009-of-00010.bin",
633
+ "model.layers.27.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00009-of-00010.bin",
634
+ "model.layers.27.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00009-of-00010.bin",
635
+ "model.layers.27.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00009-of-00010.bin",
636
+ "model.layers.27.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00009-of-00010.bin",
637
+ "model.layers.27.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00009-of-00010.bin",
638
+ "model.layers.27.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00009-of-00010.bin",
639
+ "model.layers.27.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00009-of-00010.bin",
640
+ "model.layers.27.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00009-of-00010.bin",
641
+ "model.layers.27.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00009-of-00010.bin",
642
+ "model.layers.27.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00009-of-00010.bin",
643
+ "model.layers.27.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00009-of-00010.bin",
644
+ "model.layers.27.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00009-of-00010.bin",
645
+ "model.layers.27.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00009-of-00010.bin",
646
+ "model.layers.27.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00009-of-00010.bin",
647
+ "model.layers.27.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00009-of-00010.bin",
648
+ "model.layers.27.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00009-of-00010.bin",
649
+ "model.layers.27.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00009-of-00010.bin",
650
+ "model.layers.27.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00009-of-00010.bin",
651
+ "model.layers.27.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00009-of-00010.bin",
652
+ "model.layers.27.block_sparse_moe.gate.weight": "pytorch_model-00009-of-00010.bin",
653
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00009-of-00010.bin",
654
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00009-of-00010.bin",
655
+ "model.layers.27.self_attn.k_proj.weight": "pytorch_model-00009-of-00010.bin",
656
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00009-of-00010.bin",
657
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00009-of-00010.bin",
658
+ "model.layers.27.self_attn.v_proj.weight": "pytorch_model-00009-of-00010.bin",
659
+ "model.layers.28.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00009-of-00010.bin",
660
+ "model.layers.28.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00009-of-00010.bin",
661
+ "model.layers.28.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00009-of-00010.bin",
662
+ "model.layers.28.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00009-of-00010.bin",
663
+ "model.layers.28.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00009-of-00010.bin",
664
+ "model.layers.28.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00009-of-00010.bin",
665
+ "model.layers.28.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00009-of-00010.bin",
666
+ "model.layers.28.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00009-of-00010.bin",
667
+ "model.layers.28.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00009-of-00010.bin",
668
+ "model.layers.28.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00009-of-00010.bin",
669
+ "model.layers.28.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00009-of-00010.bin",
670
+ "model.layers.28.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00009-of-00010.bin",
671
+ "model.layers.28.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00009-of-00010.bin",
672
+ "model.layers.28.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00009-of-00010.bin",
673
+ "model.layers.28.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00009-of-00010.bin",
674
+ "model.layers.28.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00009-of-00010.bin",
675
+ "model.layers.28.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00009-of-00010.bin",
676
+ "model.layers.28.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00009-of-00010.bin",
677
+ "model.layers.28.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00009-of-00010.bin",
678
+ "model.layers.28.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00009-of-00010.bin",
679
+ "model.layers.28.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00009-of-00010.bin",
680
+ "model.layers.28.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00009-of-00010.bin",
681
+ "model.layers.28.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00009-of-00010.bin",
682
+ "model.layers.28.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00009-of-00010.bin",
683
+ "model.layers.28.block_sparse_moe.gate.weight": "pytorch_model-00009-of-00010.bin",
684
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00009-of-00010.bin",
685
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00009-of-00010.bin",
686
+ "model.layers.28.self_attn.k_proj.weight": "pytorch_model-00009-of-00010.bin",
687
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00009-of-00010.bin",
688
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00009-of-00010.bin",
689
+ "model.layers.28.self_attn.v_proj.weight": "pytorch_model-00009-of-00010.bin",
690
+ "model.layers.29.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00009-of-00010.bin",
691
+ "model.layers.29.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00009-of-00010.bin",
692
+ "model.layers.29.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00009-of-00010.bin",
693
+ "model.layers.29.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00009-of-00010.bin",
694
+ "model.layers.29.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00009-of-00010.bin",
695
+ "model.layers.29.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00009-of-00010.bin",
696
+ "model.layers.29.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00009-of-00010.bin",
697
+ "model.layers.29.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00009-of-00010.bin",
698
+ "model.layers.29.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00009-of-00010.bin",
699
+ "model.layers.29.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00009-of-00010.bin",
700
+ "model.layers.29.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00009-of-00010.bin",
701
+ "model.layers.29.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00009-of-00010.bin",
702
+ "model.layers.29.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00009-of-00010.bin",
703
+ "model.layers.29.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00009-of-00010.bin",
704
+ "model.layers.29.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00009-of-00010.bin",
705
+ "model.layers.29.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00009-of-00010.bin",
706
+ "model.layers.29.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00009-of-00010.bin",
707
+ "model.layers.29.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00009-of-00010.bin",
708
+ "model.layers.29.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00009-of-00010.bin",
709
+ "model.layers.29.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00009-of-00010.bin",
710
+ "model.layers.29.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00009-of-00010.bin",
711
+ "model.layers.29.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00009-of-00010.bin",
712
+ "model.layers.29.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00009-of-00010.bin",
713
+ "model.layers.29.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00010-of-00010.bin",
714
+ "model.layers.29.block_sparse_moe.gate.weight": "pytorch_model-00009-of-00010.bin",
715
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00010-of-00010.bin",
716
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00010-of-00010.bin",
717
+ "model.layers.29.self_attn.k_proj.weight": "pytorch_model-00009-of-00010.bin",
718
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00009-of-00010.bin",
719
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00009-of-00010.bin",
720
+ "model.layers.29.self_attn.v_proj.weight": "pytorch_model-00009-of-00010.bin",
721
+ "model.layers.3.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00001-of-00010.bin",
722
+ "model.layers.3.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00002-of-00010.bin",
723
+ "model.layers.3.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00002-of-00010.bin",
724
+ "model.layers.3.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00002-of-00010.bin",
725
+ "model.layers.3.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00002-of-00010.bin",
726
+ "model.layers.3.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00002-of-00010.bin",
727
+ "model.layers.3.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00002-of-00010.bin",
728
+ "model.layers.3.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00002-of-00010.bin",
729
+ "model.layers.3.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00002-of-00010.bin",
730
+ "model.layers.3.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00002-of-00010.bin",
731
+ "model.layers.3.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00002-of-00010.bin",
732
+ "model.layers.3.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00002-of-00010.bin",
733
+ "model.layers.3.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00002-of-00010.bin",
734
+ "model.layers.3.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00002-of-00010.bin",
735
+ "model.layers.3.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00002-of-00010.bin",
736
+ "model.layers.3.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00002-of-00010.bin",
737
+ "model.layers.3.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00002-of-00010.bin",
738
+ "model.layers.3.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00002-of-00010.bin",
739
+ "model.layers.3.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00002-of-00010.bin",
740
+ "model.layers.3.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00002-of-00010.bin",
741
+ "model.layers.3.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00002-of-00010.bin",
742
+ "model.layers.3.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00002-of-00010.bin",
743
+ "model.layers.3.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00002-of-00010.bin",
744
+ "model.layers.3.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00002-of-00010.bin",
745
+ "model.layers.3.block_sparse_moe.gate.weight": "pytorch_model-00001-of-00010.bin",
746
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00002-of-00010.bin",
747
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00002-of-00010.bin",
748
+ "model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00010.bin",
749
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00010.bin",
750
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00010.bin",
751
+ "model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00010.bin",
752
+ "model.layers.30.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00010-of-00010.bin",
753
+ "model.layers.30.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00010-of-00010.bin",
754
+ "model.layers.30.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00010-of-00010.bin",
755
+ "model.layers.30.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00010-of-00010.bin",
756
+ "model.layers.30.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00010-of-00010.bin",
757
+ "model.layers.30.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00010-of-00010.bin",
758
+ "model.layers.30.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00010-of-00010.bin",
759
+ "model.layers.30.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00010-of-00010.bin",
760
+ "model.layers.30.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00010-of-00010.bin",
761
+ "model.layers.30.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00010-of-00010.bin",
762
+ "model.layers.30.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00010-of-00010.bin",
763
+ "model.layers.30.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00010-of-00010.bin",
764
+ "model.layers.30.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00010-of-00010.bin",
765
+ "model.layers.30.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00010-of-00010.bin",
766
+ "model.layers.30.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00010-of-00010.bin",
767
+ "model.layers.30.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00010-of-00010.bin",
768
+ "model.layers.30.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00010-of-00010.bin",
769
+ "model.layers.30.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00010-of-00010.bin",
770
+ "model.layers.30.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00010-of-00010.bin",
771
+ "model.layers.30.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00010-of-00010.bin",
772
+ "model.layers.30.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00010-of-00010.bin",
773
+ "model.layers.30.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00010-of-00010.bin",
774
+ "model.layers.30.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00010-of-00010.bin",
775
+ "model.layers.30.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00010-of-00010.bin",
776
+ "model.layers.30.block_sparse_moe.gate.weight": "pytorch_model-00010-of-00010.bin",
777
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00010-of-00010.bin",
778
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00010-of-00010.bin",
779
+ "model.layers.30.self_attn.k_proj.weight": "pytorch_model-00010-of-00010.bin",
780
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00010-of-00010.bin",
781
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00010-of-00010.bin",
782
+ "model.layers.30.self_attn.v_proj.weight": "pytorch_model-00010-of-00010.bin",
783
+ "model.layers.31.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00010-of-00010.bin",
784
+ "model.layers.31.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00010-of-00010.bin",
785
+ "model.layers.31.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00010-of-00010.bin",
786
+ "model.layers.31.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00010-of-00010.bin",
787
+ "model.layers.31.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00010-of-00010.bin",
788
+ "model.layers.31.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00010-of-00010.bin",
789
+ "model.layers.31.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00010-of-00010.bin",
790
+ "model.layers.31.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00010-of-00010.bin",
791
+ "model.layers.31.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00010-of-00010.bin",
792
+ "model.layers.31.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00010-of-00010.bin",
793
+ "model.layers.31.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00010-of-00010.bin",
794
+ "model.layers.31.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00010-of-00010.bin",
795
+ "model.layers.31.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00010-of-00010.bin",
796
+ "model.layers.31.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00010-of-00010.bin",
797
+ "model.layers.31.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00010-of-00010.bin",
798
+ "model.layers.31.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00010-of-00010.bin",
799
+ "model.layers.31.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00010-of-00010.bin",
800
+ "model.layers.31.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00010-of-00010.bin",
801
+ "model.layers.31.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00010-of-00010.bin",
802
+ "model.layers.31.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00010-of-00010.bin",
803
+ "model.layers.31.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00010-of-00010.bin",
804
+ "model.layers.31.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00010-of-00010.bin",
805
+ "model.layers.31.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00010-of-00010.bin",
806
+ "model.layers.31.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00010-of-00010.bin",
807
+ "model.layers.31.block_sparse_moe.gate.weight": "pytorch_model-00010-of-00010.bin",
808
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00010-of-00010.bin",
809
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00010-of-00010.bin",
810
+ "model.layers.31.self_attn.k_proj.weight": "pytorch_model-00010-of-00010.bin",
811
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00010-of-00010.bin",
812
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00010-of-00010.bin",
813
+ "model.layers.31.self_attn.v_proj.weight": "pytorch_model-00010-of-00010.bin",
814
+ "model.layers.4.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00002-of-00010.bin",
815
+ "model.layers.4.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00002-of-00010.bin",
816
+ "model.layers.4.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00002-of-00010.bin",
817
+ "model.layers.4.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00002-of-00010.bin",
818
+ "model.layers.4.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00002-of-00010.bin",
819
+ "model.layers.4.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00002-of-00010.bin",
820
+ "model.layers.4.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00002-of-00010.bin",
821
+ "model.layers.4.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00002-of-00010.bin",
822
+ "model.layers.4.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00002-of-00010.bin",
823
+ "model.layers.4.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00002-of-00010.bin",
824
+ "model.layers.4.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00002-of-00010.bin",
825
+ "model.layers.4.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00002-of-00010.bin",
826
+ "model.layers.4.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00002-of-00010.bin",
827
+ "model.layers.4.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00002-of-00010.bin",
828
+ "model.layers.4.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00002-of-00010.bin",
829
+ "model.layers.4.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00002-of-00010.bin",
830
+ "model.layers.4.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00002-of-00010.bin",
831
+ "model.layers.4.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00002-of-00010.bin",
832
+ "model.layers.4.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00002-of-00010.bin",
833
+ "model.layers.4.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00002-of-00010.bin",
834
+ "model.layers.4.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00002-of-00010.bin",
835
+ "model.layers.4.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00002-of-00010.bin",
836
+ "model.layers.4.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00002-of-00010.bin",
837
+ "model.layers.4.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00002-of-00010.bin",
838
+ "model.layers.4.block_sparse_moe.gate.weight": "pytorch_model-00002-of-00010.bin",
839
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00002-of-00010.bin",
840
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00002-of-00010.bin",
841
+ "model.layers.4.self_attn.k_proj.weight": "pytorch_model-00002-of-00010.bin",
842
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00002-of-00010.bin",
843
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00002-of-00010.bin",
844
+ "model.layers.4.self_attn.v_proj.weight": "pytorch_model-00002-of-00010.bin",
845
+ "model.layers.5.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00002-of-00010.bin",
846
+ "model.layers.5.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00002-of-00010.bin",
847
+ "model.layers.5.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00002-of-00010.bin",
848
+ "model.layers.5.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00002-of-00010.bin",
849
+ "model.layers.5.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00002-of-00010.bin",
850
+ "model.layers.5.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00002-of-00010.bin",
851
+ "model.layers.5.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00002-of-00010.bin",
852
+ "model.layers.5.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00002-of-00010.bin",
853
+ "model.layers.5.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00002-of-00010.bin",
854
+ "model.layers.5.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00002-of-00010.bin",
855
+ "model.layers.5.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00002-of-00010.bin",
856
+ "model.layers.5.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00002-of-00010.bin",
857
+ "model.layers.5.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00002-of-00010.bin",
858
+ "model.layers.5.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00002-of-00010.bin",
859
+ "model.layers.5.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00002-of-00010.bin",
860
+ "model.layers.5.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00002-of-00010.bin",
861
+ "model.layers.5.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00002-of-00010.bin",
862
+ "model.layers.5.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00002-of-00010.bin",
863
+ "model.layers.5.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00002-of-00010.bin",
864
+ "model.layers.5.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00002-of-00010.bin",
865
+ "model.layers.5.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00002-of-00010.bin",
866
+ "model.layers.5.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00002-of-00010.bin",
867
+ "model.layers.5.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00002-of-00010.bin",
868
+ "model.layers.5.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00002-of-00010.bin",
869
+ "model.layers.5.block_sparse_moe.gate.weight": "pytorch_model-00002-of-00010.bin",
870
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00002-of-00010.bin",
871
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00002-of-00010.bin",
872
+ "model.layers.5.self_attn.k_proj.weight": "pytorch_model-00002-of-00010.bin",
873
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00002-of-00010.bin",
874
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00002-of-00010.bin",
875
+ "model.layers.5.self_attn.v_proj.weight": "pytorch_model-00002-of-00010.bin",
876
+ "model.layers.6.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00002-of-00010.bin",
877
+ "model.layers.6.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00002-of-00010.bin",
878
+ "model.layers.6.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00002-of-00010.bin",
879
+ "model.layers.6.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00002-of-00010.bin",
880
+ "model.layers.6.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00002-of-00010.bin",
881
+ "model.layers.6.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00002-of-00010.bin",
882
+ "model.layers.6.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00002-of-00010.bin",
883
+ "model.layers.6.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00002-of-00010.bin",
884
+ "model.layers.6.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00002-of-00010.bin",
885
+ "model.layers.6.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00002-of-00010.bin",
886
+ "model.layers.6.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00003-of-00010.bin",
887
+ "model.layers.6.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00003-of-00010.bin",
888
+ "model.layers.6.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00003-of-00010.bin",
889
+ "model.layers.6.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00003-of-00010.bin",
890
+ "model.layers.6.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00003-of-00010.bin",
891
+ "model.layers.6.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00003-of-00010.bin",
892
+ "model.layers.6.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00003-of-00010.bin",
893
+ "model.layers.6.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00003-of-00010.bin",
894
+ "model.layers.6.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00003-of-00010.bin",
895
+ "model.layers.6.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00003-of-00010.bin",
896
+ "model.layers.6.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00003-of-00010.bin",
897
+ "model.layers.6.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00003-of-00010.bin",
898
+ "model.layers.6.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00003-of-00010.bin",
899
+ "model.layers.6.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00003-of-00010.bin",
900
+ "model.layers.6.block_sparse_moe.gate.weight": "pytorch_model-00002-of-00010.bin",
901
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00003-of-00010.bin",
902
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00003-of-00010.bin",
903
+ "model.layers.6.self_attn.k_proj.weight": "pytorch_model-00002-of-00010.bin",
904
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00002-of-00010.bin",
905
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00002-of-00010.bin",
906
+ "model.layers.6.self_attn.v_proj.weight": "pytorch_model-00002-of-00010.bin",
907
+ "model.layers.7.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00003-of-00010.bin",
908
+ "model.layers.7.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00003-of-00010.bin",
909
+ "model.layers.7.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00003-of-00010.bin",
910
+ "model.layers.7.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00003-of-00010.bin",
911
+ "model.layers.7.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00003-of-00010.bin",
912
+ "model.layers.7.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00003-of-00010.bin",
913
+ "model.layers.7.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00003-of-00010.bin",
914
+ "model.layers.7.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00003-of-00010.bin",
915
+ "model.layers.7.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00003-of-00010.bin",
916
+ "model.layers.7.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00003-of-00010.bin",
917
+ "model.layers.7.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00003-of-00010.bin",
918
+ "model.layers.7.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00003-of-00010.bin",
919
+ "model.layers.7.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00003-of-00010.bin",
920
+ "model.layers.7.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00003-of-00010.bin",
921
+ "model.layers.7.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00003-of-00010.bin",
922
+ "model.layers.7.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00003-of-00010.bin",
923
+ "model.layers.7.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00003-of-00010.bin",
924
+ "model.layers.7.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00003-of-00010.bin",
925
+ "model.layers.7.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00003-of-00010.bin",
926
+ "model.layers.7.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00003-of-00010.bin",
927
+ "model.layers.7.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00003-of-00010.bin",
928
+ "model.layers.7.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00003-of-00010.bin",
929
+ "model.layers.7.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00003-of-00010.bin",
930
+ "model.layers.7.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00003-of-00010.bin",
931
+ "model.layers.7.block_sparse_moe.gate.weight": "pytorch_model-00003-of-00010.bin",
932
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00003-of-00010.bin",
933
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00003-of-00010.bin",
934
+ "model.layers.7.self_attn.k_proj.weight": "pytorch_model-00003-of-00010.bin",
935
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00003-of-00010.bin",
936
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00003-of-00010.bin",
937
+ "model.layers.7.self_attn.v_proj.weight": "pytorch_model-00003-of-00010.bin",
938
+ "model.layers.8.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00003-of-00010.bin",
939
+ "model.layers.8.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00003-of-00010.bin",
940
+ "model.layers.8.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00003-of-00010.bin",
941
+ "model.layers.8.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00003-of-00010.bin",
942
+ "model.layers.8.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00003-of-00010.bin",
943
+ "model.layers.8.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00003-of-00010.bin",
944
+ "model.layers.8.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00003-of-00010.bin",
945
+ "model.layers.8.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00003-of-00010.bin",
946
+ "model.layers.8.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00003-of-00010.bin",
947
+ "model.layers.8.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00003-of-00010.bin",
948
+ "model.layers.8.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00003-of-00010.bin",
949
+ "model.layers.8.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00003-of-00010.bin",
950
+ "model.layers.8.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00003-of-00010.bin",
951
+ "model.layers.8.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00003-of-00010.bin",
952
+ "model.layers.8.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00003-of-00010.bin",
953
+ "model.layers.8.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00003-of-00010.bin",
954
+ "model.layers.8.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00003-of-00010.bin",
955
+ "model.layers.8.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00003-of-00010.bin",
956
+ "model.layers.8.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00003-of-00010.bin",
957
+ "model.layers.8.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00003-of-00010.bin",
958
+ "model.layers.8.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00003-of-00010.bin",
959
+ "model.layers.8.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00003-of-00010.bin",
960
+ "model.layers.8.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00003-of-00010.bin",
961
+ "model.layers.8.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00003-of-00010.bin",
962
+ "model.layers.8.block_sparse_moe.gate.weight": "pytorch_model-00003-of-00010.bin",
963
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00003-of-00010.bin",
964
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00003-of-00010.bin",
965
+ "model.layers.8.self_attn.k_proj.weight": "pytorch_model-00003-of-00010.bin",
966
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00003-of-00010.bin",
967
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00003-of-00010.bin",
968
+ "model.layers.8.self_attn.v_proj.weight": "pytorch_model-00003-of-00010.bin",
969
+ "model.layers.9.block_sparse_moe.experts.0.w1.weight": "pytorch_model-00003-of-00010.bin",
970
+ "model.layers.9.block_sparse_moe.experts.0.w2.weight": "pytorch_model-00003-of-00010.bin",
971
+ "model.layers.9.block_sparse_moe.experts.0.w3.weight": "pytorch_model-00003-of-00010.bin",
972
+ "model.layers.9.block_sparse_moe.experts.1.w1.weight": "pytorch_model-00003-of-00010.bin",
973
+ "model.layers.9.block_sparse_moe.experts.1.w2.weight": "pytorch_model-00003-of-00010.bin",
974
+ "model.layers.9.block_sparse_moe.experts.1.w3.weight": "pytorch_model-00003-of-00010.bin",
975
+ "model.layers.9.block_sparse_moe.experts.2.w1.weight": "pytorch_model-00003-of-00010.bin",
976
+ "model.layers.9.block_sparse_moe.experts.2.w2.weight": "pytorch_model-00003-of-00010.bin",
977
+ "model.layers.9.block_sparse_moe.experts.2.w3.weight": "pytorch_model-00003-of-00010.bin",
978
+ "model.layers.9.block_sparse_moe.experts.3.w1.weight": "pytorch_model-00003-of-00010.bin",
979
+ "model.layers.9.block_sparse_moe.experts.3.w2.weight": "pytorch_model-00003-of-00010.bin",
980
+ "model.layers.9.block_sparse_moe.experts.3.w3.weight": "pytorch_model-00003-of-00010.bin",
981
+ "model.layers.9.block_sparse_moe.experts.4.w1.weight": "pytorch_model-00003-of-00010.bin",
982
+ "model.layers.9.block_sparse_moe.experts.4.w2.weight": "pytorch_model-00003-of-00010.bin",
983
+ "model.layers.9.block_sparse_moe.experts.4.w3.weight": "pytorch_model-00003-of-00010.bin",
984
+ "model.layers.9.block_sparse_moe.experts.5.w1.weight": "pytorch_model-00003-of-00010.bin",
985
+ "model.layers.9.block_sparse_moe.experts.5.w2.weight": "pytorch_model-00003-of-00010.bin",
986
+ "model.layers.9.block_sparse_moe.experts.5.w3.weight": "pytorch_model-00003-of-00010.bin",
987
+ "model.layers.9.block_sparse_moe.experts.6.w1.weight": "pytorch_model-00003-of-00010.bin",
988
+ "model.layers.9.block_sparse_moe.experts.6.w2.weight": "pytorch_model-00004-of-00010.bin",
989
+ "model.layers.9.block_sparse_moe.experts.6.w3.weight": "pytorch_model-00004-of-00010.bin",
990
+ "model.layers.9.block_sparse_moe.experts.7.w1.weight": "pytorch_model-00004-of-00010.bin",
991
+ "model.layers.9.block_sparse_moe.experts.7.w2.weight": "pytorch_model-00004-of-00010.bin",
992
+ "model.layers.9.block_sparse_moe.experts.7.w3.weight": "pytorch_model-00004-of-00010.bin",
993
+ "model.layers.9.block_sparse_moe.gate.weight": "pytorch_model-00003-of-00010.bin",
994
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00004-of-00010.bin",
995
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00004-of-00010.bin",
996
+ "model.layers.9.self_attn.k_proj.weight": "pytorch_model-00003-of-00010.bin",
997
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00003-of-00010.bin",
998
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00003-of-00010.bin",
999
+ "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00003-of-00010.bin",
1000
+ "model.norm.weight": "pytorch_model-00010-of-00010.bin"
1001
+ }
1002
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenization_orion.py ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2024, Orion Intelligent Technology. All rights reserved.
2
+ # Copied and adapted from https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py
3
+
4
+ import os
5
+ from shutil import copyfile
6
+ from typing import Any, Dict, List, Optional, Tuple
7
+
8
+ import sentencepiece as spm
9
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
10
+ from transformers.utils import logging
11
+
12
+
13
+ logger = logging.get_logger(__name__)
14
+
15
+ SPIECE_UNDERLINE = "▁"
16
+
17
+ VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
18
+
19
+ PRETRAINED_VOCAB_FILES_MAP = {
20
+ "vocab_file": {},
21
+ "tokenizer_file": {},
22
+ }
23
+ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {}
24
+
25
+
26
+ class OrionTokenizer(PreTrainedTokenizer):
27
+ """
28
+ Construct a Orion tokenizer. Based on byte-level Byte-Pair-Encoding.
29
+
30
+ Args:
31
+ vocab_file (`str`):
32
+ Path to the vocabulary file.
33
+ """
34
+
35
+ vocab_files_names = VOCAB_FILES_NAMES
36
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
37
+ max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
38
+ model_input_names = ["input_ids", "attention_mask"]
39
+
40
+ def __init__(
41
+ self,
42
+ vocab_file,
43
+ unk_token="<unk>",
44
+ bos_token="<s>",
45
+ eos_token="</s>",
46
+ pad_token=None,
47
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
48
+ add_bos_token=True,
49
+ add_eos_token=False,
50
+ clean_up_tokenization_spaces=False,
51
+ legacy=None,
52
+ add_prefix_space=True,
53
+ **kwargs,
54
+ ):
55
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
56
+ bos_token = (
57
+ AddedToken(bos_token, lstrip=False, rstrip=False)
58
+ if isinstance(bos_token, str)
59
+ else bos_token
60
+ )
61
+ eos_token = (
62
+ AddedToken(eos_token, lstrip=False, rstrip=False)
63
+ if isinstance(eos_token, str)
64
+ else eos_token
65
+ )
66
+ unk_token = (
67
+ AddedToken(unk_token, lstrip=False, rstrip=False)
68
+ if isinstance(unk_token, str)
69
+ else unk_token
70
+ )
71
+ pad_token = (
72
+ AddedToken(pad_token, lstrip=False, rstrip=False)
73
+ if isinstance(pad_token, str)
74
+ else pad_token
75
+ )
76
+ self.legacy = legacy
77
+ self.vocab_file = vocab_file
78
+ self.add_bos_token = add_bos_token
79
+ self.add_eos_token = add_eos_token
80
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
81
+ self.sp_model.Load(vocab_file)
82
+ self.add_prefix_space = add_prefix_space
83
+ super().__init__(
84
+ bos_token=bos_token,
85
+ eos_token=eos_token,
86
+ unk_token=unk_token,
87
+ pad_token=pad_token,
88
+ add_bos_token=add_bos_token,
89
+ add_eos_token=add_eos_token,
90
+ sp_model_kwargs=self.sp_model_kwargs,
91
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
92
+ legacy=legacy,
93
+ add_prefix_space=add_prefix_space,
94
+ **kwargs,
95
+ )
96
+
97
+ def __getstate__(self):
98
+ state = self.__dict__.copy()
99
+ state["sp_model"] = None
100
+ return state
101
+
102
+ def __setstate__(self, d):
103
+ self.__dict__ = d
104
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
105
+ self.sp_model.Load(self.vocab_file)
106
+
107
+ @property
108
+ def vocab_size(self):
109
+ """Returns vocab size"""
110
+ return self.sp_model.get_piece_size()
111
+
112
+ def get_vocab(self):
113
+ """Returns vocab as a dict"""
114
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
115
+ vocab.update(self.added_tokens_encoder)
116
+ return vocab
117
+
118
+ def _tokenize(self, text):
119
+ """Returns a tokenized string."""
120
+ return self.sp_model.encode(text, out_type=str)
121
+
122
+ def _convert_token_to_id(self, token):
123
+ """Converts a token (str) in an id using the vocab."""
124
+ return self.sp_model.piece_to_id(token)
125
+
126
+ def _convert_id_to_token(self, index):
127
+ """Converts an index (integer) in a token (str) using the vocab."""
128
+ token = self.sp_model.IdToPiece(index)
129
+ return token
130
+
131
+ def convert_tokens_to_string(self, tokens):
132
+ """Converts a sequence of tokens (string) in a single string."""
133
+ # since we manually add the prefix space, we have to remove it when decoding
134
+ if tokens[0].startswith(SPIECE_UNDERLINE) and self.add_prefix_space:
135
+ tokens[0] = tokens[0][1:]
136
+
137
+ current_sub_tokens = []
138
+ out_string = ""
139
+ prev_is_special = False
140
+ for i, token in enumerate(tokens):
141
+ # make sure that special tokens are not decoded using sentencepiece model
142
+ if token in self.all_special_tokens:
143
+ if not prev_is_special and i != 0 and self.legacy:
144
+ out_string += " "
145
+ out_string += self.sp_model.decode(current_sub_tokens) + token
146
+ prev_is_special = True
147
+ current_sub_tokens = []
148
+ else:
149
+ if prev_is_special and i == 1 and self.add_prefix_space and not token.startswith(SPIECE_UNDERLINE):
150
+ out_string += " "
151
+ current_sub_tokens.append(token)
152
+ prev_is_special = False
153
+ out_string += self.sp_model.decode(current_sub_tokens)
154
+ return out_string
155
+
156
+ def save_vocabulary(
157
+ self, save_directory, filename_prefix: Optional[str] = None
158
+ ) -> Tuple[str]:
159
+ """
160
+ Save the vocabulary and special tokens file to a directory.
161
+
162
+ Args:
163
+ save_directory (`str`):
164
+ The directory in which to save the vocabulary.
165
+
166
+ Returns:
167
+ `Tuple(str)`: Paths to the files saved.
168
+ """
169
+ if not os.path.isdir(save_directory):
170
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
171
+ return
172
+ out_vocab_file = os.path.join(
173
+ save_directory,
174
+ (filename_prefix + "-" if filename_prefix else "")
175
+ + VOCAB_FILES_NAMES["vocab_file"],
176
+ )
177
+
178
+ if os.path.abspath(self.vocab_file) != os.path.abspath(
179
+ out_vocab_file
180
+ ) and os.path.isfile(self.vocab_file):
181
+ copyfile(self.vocab_file, out_vocab_file)
182
+ elif not os.path.isfile(self.vocab_file):
183
+ with open(out_vocab_file, "wb") as fi:
184
+ content_spiece_model = self.sp_model.serialized_model_proto()
185
+ fi.write(content_spiece_model)
186
+
187
+ return (out_vocab_file,)
188
+
189
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
190
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
191
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
192
+
193
+ output = bos_token_id + token_ids_0 + eos_token_id
194
+
195
+ if token_ids_1 is not None:
196
+ output = output + bos_token_id + token_ids_1 + eos_token_id
197
+
198
+ return output
199
+
200
+ def get_special_tokens_mask(
201
+ self,
202
+ token_ids_0: List[int],
203
+ token_ids_1: Optional[List[int]] = None,
204
+ already_has_special_tokens: bool = False,
205
+ ) -> List[int]:
206
+ """
207
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
208
+ special tokens using the tokenizer `prepare_for_model` method.
209
+
210
+ Args:
211
+ token_ids_0 (`List[int]`):
212
+ List of IDs.
213
+ token_ids_1 (`List[int]`, *optional*):
214
+ Optional second list of IDs for sequence pairs.
215
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
216
+ Whether or not the token list is already formatted with special tokens for the model.
217
+
218
+ Returns:
219
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
220
+ """
221
+ if already_has_special_tokens:
222
+ return super().get_special_tokens_mask(
223
+ token_ids_0=token_ids_0,
224
+ token_ids_1=token_ids_1,
225
+ already_has_special_tokens=True,
226
+ )
227
+
228
+ bos_token_id = [1] if self.add_bos_token else []
229
+ eos_token_id = [1] if self.add_eos_token else []
230
+
231
+ if token_ids_1 is None:
232
+ return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id
233
+ return (
234
+ bos_token_id
235
+ + ([0] * len(token_ids_0))
236
+ + eos_token_id
237
+ + bos_token_id
238
+ + ([0] * len(token_ids_1))
239
+ + eos_token_id
240
+ )
241
+
242
+ def create_token_type_ids_from_sequences(
243
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
244
+ ) -> List[int]:
245
+ """
246
+ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
247
+ sequence pair mask has the following format:
248
+
249
+ ```
250
+ 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
251
+ | first sequence | second sequence |
252
+ ```
253
+
254
+ if token_ids_1 is None, only returns the first portion of the mask (0s).
255
+
256
+ Args:
257
+ token_ids_0 (`List[int]`):
258
+ List of ids.
259
+ token_ids_1 (`List[int]`, *optional*):
260
+ Optional second list of IDs for sequence pairs.
261
+
262
+ Returns:
263
+ `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
264
+ """
265
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
266
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
267
+
268
+ output = [0] * len(bos_token_id + token_ids_0 + eos_token_id)
269
+
270
+ if token_ids_1 is not None:
271
+ output += [1] * len(bos_token_id + token_ids_1 + eos_token_id)
272
+
273
+ return output
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f37622cef69cf68e0452eac2f6993d1d439fe8fecf34d2b66af386baa4f12b91
3
+ size 1868166
tokenizer_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "auto_map": {
5
+ "AutoTokenizer": [
6
+ "tokenization_orion.OrionTokenizer",
7
+ null
8
+ ]
9
+ },
10
+ "bos_token": {
11
+ "__type": "AddedToken",
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": true
17
+ },
18
+ "clean_up_tokenization_spaces": false,
19
+ "eos_token": {
20
+ "__type": "AddedToken",
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": true
26
+ },
27
+ "model_max_length": 8192,
28
+ "pad_token": {
29
+ "__type": "AddedToken",
30
+ "content": "<unk>",
31
+ "lstrip": false,
32
+ "normalized": true,
33
+ "rstrip": false,
34
+ "single_word": true
35
+ },
36
+ "sp_model_kwargs": {},
37
+ "tokenizer_class": "OrionTokenizer",
38
+ "unk_token": {
39
+ "__type": "AddedToken",
40
+ "content": "<unk>",
41
+ "lstrip": false,
42
+ "normalized": true,
43
+ "rstrip": false,
44
+ "single_word": true
45
+ }
46
+ }