Ajmalps commited on
Commit
bedae5b
1 Parent(s): 687fb23

Added model files and configurations

Browse files
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "budecosystem/Boomer-4b",
3
+ "adapter_dim": 512,
4
+ "adapter_scaling": 0.25,
5
+ "architectures": [
6
+ "BoomerForCausalLM"
7
+ ],
8
+ "attention_dropout": 0.0,
9
+ "auto_map": {
10
+ "AutoConfig": "configuration_boomer.BoomerConfig",
11
+ "AutoModelForCausalLM": "modeling_boomer.BoomerForCausalLM"
12
+ },
13
+ "bos_token_id": null,
14
+ "embd_pdrop": 0.0,
15
+ "eos_token_id": null,
16
+ "hidden_act": "gelu_new",
17
+ "hidden_size": 2560,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 10240,
20
+ "layer_norm_eps": 1e-05,
21
+ "max_position_embeddings": 2048,
22
+ "model_type": "boomer",
23
+ "num_attention_heads": 32,
24
+ "num_hidden_layers": 40,
25
+ "num_key_value_heads": 32,
26
+ "partial_rotary_factor": 0.4,
27
+ "qk_layernorm": false,
28
+ "resid_pdrop": 0.1,
29
+ "rope_scaling": null,
30
+ "rope_theta": 10000.0,
31
+ "tie_word_embeddings": false,
32
+ "torch_dtype": "float16",
33
+ "transformers_version": "4.36.2",
34
+ "use_cache": false,
35
+ "vocab_size": 51200
36
+ }
configuration_boomer.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ """ Boomer model configuration"""
4
+
5
+
6
+ from transformers.configuration_utils import PretrainedConfig
7
+ from transformers.utils import logging
8
+
9
+
10
+ logger = logging.get_logger(__name__)
11
+
12
+
13
+ class BoomerConfig(PretrainedConfig):
14
+ r"""
15
+ This is the configuration class to store the configuration of a [`BoomerModel`]. It is used to instantiate an Boomer
16
+ model according to the specified arguments, defining the model architecture.
17
+
18
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
19
+ documentation from [`PretrainedConfig`] for more information.
20
+
21
+ Args:
22
+ vocab_size (`int`, *optional*, defaults to 51200):
23
+ Vocabulary size of the Boomer model. Defines the number of different tokens that can be represented by the
24
+ `inputs_ids` passed when calling [`BoomerModel`].
25
+ hidden_size (`int`, *optional*, defaults to 2048):
26
+ Dimension of the hidden representations.
27
+ intermediate_size (`int`, *optional*, defaults to 8192):
28
+ Dimension of the MLP representations.
29
+ num_hidden_layers (`int`, *optional*, defaults to 24):
30
+ Number of hidden layers in the Transformer decoder.
31
+ num_attention_heads (`int`, *optional*, defaults to 32):
32
+ Number of attention heads for each attention layer in the Transformer decoder.
33
+ num_key_value_heads (`int`, *optional*):
34
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
35
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
36
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
37
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
38
+ by meanpooling all the original heads within that group. If it is not specified, will default to
39
+ `num_attention_heads`.
40
+ resid_pdrop (`float`, *optional*, defaults to 0.0):
41
+ Dropout probability for mlp outputs.
42
+ embd_pdrop (`int`, *optional*, defaults to 0.0):
43
+ The dropout ratio for the embeddings.
44
+ attention_dropout (`float`, *optional*, defaults to 0.0):
45
+ The dropout ratio after computing the attention scores.
46
+ hidden_act (`str` or `function`, *optional*, defaults to `"gelu_new"`):
47
+ The non-linear activation function (function or string) in the decoder.
48
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
49
+ The maximum sequence length that this model might support up to 2048
50
+ tokens.
51
+ initializer_range (`float`, *optional*, defaults to 0.02):
52
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
53
+ layer_norm_eps (`float`, *optional*, defaults to 1e-05):
54
+ The epsilon used by the rms normalization layers.
55
+ use_cache (`bool`, *optional*, defaults to `True`):
56
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
57
+ relevant if `config.is_decoder=True`. Whether to tie weight embeddings or not.
58
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
59
+ Whether to tie weight embeddings
60
+ rope_theta (`float`, *optional*, defaults to 10000.0):
61
+ The base period of the RoPE embeddings.
62
+ rope_scaling (`Dict`, *optional*):
63
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
64
+ strategies: linear and dynamic. Their scaling factor must be an float greater than 1. The expected format
65
+ is `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
66
+ `max_position_embeddings` to the expected new maximum.
67
+ partial_rotary_factor (`float`, *optional*, defaults to 0.5):
68
+ Percentage of the query and keys which will have rotary embedding.
69
+ qk_layernorm (`bool`, *optional*, defaults to `False`):
70
+ Whether or not to normalize the Queries and Keys after projecting the hidden states.
71
+ bos_token_id (`int`, *optional*, defaults to 1):
72
+ Denotes beginning of sequences token id.
73
+ eos_token_id (`int`, *optional*, defaults to 2):
74
+ Denotes end of sequences token id.
75
+
76
+
77
+ ```"""
78
+
79
+ model_type = "Boomer"
80
+ keys_to_ignore_at_inference = ["past_key_values"]
81
+
82
+ def __init__(
83
+ self,
84
+ vocab_size=51200,
85
+ hidden_size=2048,
86
+ intermediate_size=8192,
87
+ num_hidden_layers=24,
88
+ num_attention_heads=32,
89
+ num_key_value_heads=None,
90
+ resid_pdrop=0.0,
91
+ embd_pdrop=0.0,
92
+ attention_dropout=0.0,
93
+ hidden_act="gelu_new",
94
+ max_position_embeddings=2048,
95
+ initializer_range=0.02,
96
+ layer_norm_eps=1e-5,
97
+ use_cache=True,
98
+ tie_word_embeddings=False,
99
+ rope_theta=10000.0,
100
+ rope_scaling=None,
101
+ partial_rotary_factor=0.5,
102
+ qk_layernorm=False,
103
+ bos_token_id=1,
104
+ eos_token_id=2,
105
+ adapter_scaling=0.25,
106
+ adapter_dim=512,
107
+ **kwargs,
108
+ ):
109
+ self.vocab_size = vocab_size
110
+ self.hidden_size = hidden_size
111
+ self.intermediate_size = intermediate_size
112
+ self.num_hidden_layers = num_hidden_layers
113
+ self.num_attention_heads = num_attention_heads
114
+
115
+ if num_key_value_heads is None:
116
+ num_key_value_heads = num_attention_heads
117
+
118
+ self.num_key_value_heads = num_key_value_heads
119
+ self.resid_pdrop = resid_pdrop
120
+ self.embd_pdrop = embd_pdrop
121
+ self.attention_dropout = attention_dropout
122
+ self.hidden_act = hidden_act
123
+ self.max_position_embeddings = max_position_embeddings
124
+ self.initializer_range = initializer_range
125
+ self.layer_norm_eps = layer_norm_eps
126
+ self.use_cache = use_cache
127
+ self.rope_theta = rope_theta
128
+ self.rope_scaling = rope_scaling
129
+ self.partial_rotary_factor = partial_rotary_factor
130
+ self.qk_layernorm = qk_layernorm
131
+ self._rope_scaling_validation()
132
+
133
+ self.adapter_dim = adapter_dim
134
+ self.adapter_scaling = adapter_scaling
135
+
136
+ super().__init__(
137
+ bos_token_id=bos_token_id,
138
+ eos_token_id=eos_token_id,
139
+ tie_word_embeddings=tie_word_embeddings,
140
+ **kwargs,
141
+ )
142
+
143
+ # Copied from transformers.models.llama.configuration_llama.LlamaConfig._rope_scaling_validation
144
+ def _rope_scaling_validation(self):
145
+ """
146
+ Validate the `rope_scaling` configuration.
147
+ """
148
+ if self.rope_scaling is None:
149
+ return
150
+
151
+ if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
152
+ raise ValueError(
153
+ "`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, "
154
+ f"got {self.rope_scaling}"
155
+ )
156
+ rope_scaling_type = self.rope_scaling.get("type", None)
157
+ rope_scaling_factor = self.rope_scaling.get("factor", None)
158
+ if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
159
+ raise ValueError(
160
+ f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
161
+ )
162
+ if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor <= 1.0:
163
+ raise ValueError(f"`rope_scaling`'s factor field must be a float > 1, got {rope_scaling_factor}")
generation_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "transformers_version": "4.36.2"
4
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a986ac0e3588bab621c153c709aa1102465f7407839ee93ea20a8ade51e792b9
3
+ size 4990290776
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e777cdbae361c2b23709d4cbc079d58f3031b01ac09e2552c21e3ac48bd217d2
3
+ size 2037605680
model.safetensors.index.json ADDED
@@ -0,0 +1,652 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 7027824640
4
+ },
5
+ "weight_map": {
6
+ "lm_head.bias": "model-00002-of-00002.safetensors",
7
+ "lm_head.weight": "model-00002-of-00002.safetensors",
8
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
9
+ "model.final_layernorm.bias": "model-00002-of-00002.safetensors",
10
+ "model.final_layernorm.weight": "model-00002-of-00002.safetensors",
11
+ "model.layers.0.input_layernorm.bias": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.mlp.fc1.bias": "model-00001-of-00002.safetensors",
16
+ "model.layers.0.mlp.fc1.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.0.mlp.fc2.bias": "model-00001-of-00002.safetensors",
18
+ "model.layers.0.mlp.fc2.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.0.self_attn.dense.bias": "model-00001-of-00002.safetensors",
20
+ "model.layers.0.self_attn.dense.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.0.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
22
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.0.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
24
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.0.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
26
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.1.input_layernorm.bias": "model-00001-of-00002.safetensors",
28
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.1.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.1.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.1.mlp.fc1.bias": "model-00001-of-00002.safetensors",
32
+ "model.layers.1.mlp.fc1.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.1.mlp.fc2.bias": "model-00001-of-00002.safetensors",
34
+ "model.layers.1.mlp.fc2.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.1.self_attn.dense.bias": "model-00001-of-00002.safetensors",
36
+ "model.layers.1.self_attn.dense.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.1.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
38
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.1.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
40
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.1.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
42
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.10.input_layernorm.bias": "model-00001-of-00002.safetensors",
44
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.10.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.10.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.10.mlp.fc1.bias": "model-00001-of-00002.safetensors",
48
+ "model.layers.10.mlp.fc1.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.10.mlp.fc2.bias": "model-00001-of-00002.safetensors",
50
+ "model.layers.10.mlp.fc2.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.10.self_attn.dense.bias": "model-00001-of-00002.safetensors",
52
+ "model.layers.10.self_attn.dense.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.10.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
54
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.10.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
56
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.10.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
58
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.11.input_layernorm.bias": "model-00001-of-00002.safetensors",
60
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.11.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.11.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.11.mlp.fc1.bias": "model-00001-of-00002.safetensors",
64
+ "model.layers.11.mlp.fc1.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.11.mlp.fc2.bias": "model-00001-of-00002.safetensors",
66
+ "model.layers.11.mlp.fc2.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.11.self_attn.dense.bias": "model-00001-of-00002.safetensors",
68
+ "model.layers.11.self_attn.dense.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.11.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
70
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.11.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
72
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.11.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
74
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.12.input_layernorm.bias": "model-00001-of-00002.safetensors",
76
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.12.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
78
+ "model.layers.12.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.12.mlp.fc1.bias": "model-00001-of-00002.safetensors",
80
+ "model.layers.12.mlp.fc1.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.12.mlp.fc2.bias": "model-00001-of-00002.safetensors",
82
+ "model.layers.12.mlp.fc2.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.12.self_attn.dense.bias": "model-00001-of-00002.safetensors",
84
+ "model.layers.12.self_attn.dense.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.12.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
86
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.12.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
88
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
89
+ "model.layers.12.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
90
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.13.input_layernorm.bias": "model-00001-of-00002.safetensors",
92
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
93
+ "model.layers.13.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.13.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.13.mlp.fc1.bias": "model-00001-of-00002.safetensors",
96
+ "model.layers.13.mlp.fc1.weight": "model-00001-of-00002.safetensors",
97
+ "model.layers.13.mlp.fc2.bias": "model-00001-of-00002.safetensors",
98
+ "model.layers.13.mlp.fc2.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.13.self_attn.dense.bias": "model-00001-of-00002.safetensors",
100
+ "model.layers.13.self_attn.dense.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.13.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
102
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.13.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
104
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.13.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
106
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.14.input_layernorm.bias": "model-00001-of-00002.safetensors",
108
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
109
+ "model.layers.14.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.14.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
111
+ "model.layers.14.mlp.fc1.bias": "model-00001-of-00002.safetensors",
112
+ "model.layers.14.mlp.fc1.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.14.mlp.fc2.bias": "model-00001-of-00002.safetensors",
114
+ "model.layers.14.mlp.fc2.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.14.self_attn.dense.bias": "model-00001-of-00002.safetensors",
116
+ "model.layers.14.self_attn.dense.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.14.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
118
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.14.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
120
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
121
+ "model.layers.14.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
122
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.15.input_layernorm.bias": "model-00001-of-00002.safetensors",
124
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.15.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
126
+ "model.layers.15.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
127
+ "model.layers.15.mlp.fc1.bias": "model-00001-of-00002.safetensors",
128
+ "model.layers.15.mlp.fc1.weight": "model-00001-of-00002.safetensors",
129
+ "model.layers.15.mlp.fc2.bias": "model-00001-of-00002.safetensors",
130
+ "model.layers.15.mlp.fc2.weight": "model-00001-of-00002.safetensors",
131
+ "model.layers.15.self_attn.dense.bias": "model-00001-of-00002.safetensors",
132
+ "model.layers.15.self_attn.dense.weight": "model-00001-of-00002.safetensors",
133
+ "model.layers.15.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
134
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
135
+ "model.layers.15.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
136
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
137
+ "model.layers.15.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
138
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
139
+ "model.layers.16.input_layernorm.bias": "model-00001-of-00002.safetensors",
140
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
141
+ "model.layers.16.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
142
+ "model.layers.16.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
143
+ "model.layers.16.mlp.fc1.bias": "model-00001-of-00002.safetensors",
144
+ "model.layers.16.mlp.fc1.weight": "model-00001-of-00002.safetensors",
145
+ "model.layers.16.mlp.fc2.bias": "model-00001-of-00002.safetensors",
146
+ "model.layers.16.mlp.fc2.weight": "model-00001-of-00002.safetensors",
147
+ "model.layers.16.self_attn.dense.bias": "model-00001-of-00002.safetensors",
148
+ "model.layers.16.self_attn.dense.weight": "model-00001-of-00002.safetensors",
149
+ "model.layers.16.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
150
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
151
+ "model.layers.16.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
152
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
153
+ "model.layers.16.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
154
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
155
+ "model.layers.17.input_layernorm.bias": "model-00001-of-00002.safetensors",
156
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
157
+ "model.layers.17.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
158
+ "model.layers.17.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
159
+ "model.layers.17.mlp.fc1.bias": "model-00001-of-00002.safetensors",
160
+ "model.layers.17.mlp.fc1.weight": "model-00001-of-00002.safetensors",
161
+ "model.layers.17.mlp.fc2.bias": "model-00001-of-00002.safetensors",
162
+ "model.layers.17.mlp.fc2.weight": "model-00001-of-00002.safetensors",
163
+ "model.layers.17.self_attn.dense.bias": "model-00001-of-00002.safetensors",
164
+ "model.layers.17.self_attn.dense.weight": "model-00001-of-00002.safetensors",
165
+ "model.layers.17.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
166
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
167
+ "model.layers.17.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
168
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
169
+ "model.layers.17.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
170
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
171
+ "model.layers.18.input_layernorm.bias": "model-00001-of-00002.safetensors",
172
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
173
+ "model.layers.18.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
174
+ "model.layers.18.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
175
+ "model.layers.18.mlp.fc1.bias": "model-00001-of-00002.safetensors",
176
+ "model.layers.18.mlp.fc1.weight": "model-00001-of-00002.safetensors",
177
+ "model.layers.18.mlp.fc2.bias": "model-00001-of-00002.safetensors",
178
+ "model.layers.18.mlp.fc2.weight": "model-00001-of-00002.safetensors",
179
+ "model.layers.18.self_attn.dense.bias": "model-00001-of-00002.safetensors",
180
+ "model.layers.18.self_attn.dense.weight": "model-00001-of-00002.safetensors",
181
+ "model.layers.18.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
182
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
183
+ "model.layers.18.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
184
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
185
+ "model.layers.18.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
186
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
187
+ "model.layers.19.input_layernorm.bias": "model-00001-of-00002.safetensors",
188
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
189
+ "model.layers.19.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
190
+ "model.layers.19.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
191
+ "model.layers.19.mlp.fc1.bias": "model-00001-of-00002.safetensors",
192
+ "model.layers.19.mlp.fc1.weight": "model-00001-of-00002.safetensors",
193
+ "model.layers.19.mlp.fc2.bias": "model-00001-of-00002.safetensors",
194
+ "model.layers.19.mlp.fc2.weight": "model-00001-of-00002.safetensors",
195
+ "model.layers.19.self_attn.dense.bias": "model-00001-of-00002.safetensors",
196
+ "model.layers.19.self_attn.dense.weight": "model-00001-of-00002.safetensors",
197
+ "model.layers.19.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
198
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
199
+ "model.layers.19.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
200
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
201
+ "model.layers.19.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
202
+ "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
203
+ "model.layers.2.input_layernorm.bias": "model-00001-of-00002.safetensors",
204
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
205
+ "model.layers.2.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
206
+ "model.layers.2.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
207
+ "model.layers.2.mlp.fc1.bias": "model-00001-of-00002.safetensors",
208
+ "model.layers.2.mlp.fc1.weight": "model-00001-of-00002.safetensors",
209
+ "model.layers.2.mlp.fc2.bias": "model-00001-of-00002.safetensors",
210
+ "model.layers.2.mlp.fc2.weight": "model-00001-of-00002.safetensors",
211
+ "model.layers.2.self_attn.dense.bias": "model-00001-of-00002.safetensors",
212
+ "model.layers.2.self_attn.dense.weight": "model-00001-of-00002.safetensors",
213
+ "model.layers.2.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
214
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
215
+ "model.layers.2.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
216
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
217
+ "model.layers.2.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
218
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
219
+ "model.layers.20.input_layernorm.bias": "model-00001-of-00002.safetensors",
220
+ "model.layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
221
+ "model.layers.20.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
222
+ "model.layers.20.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
223
+ "model.layers.20.mlp.fc1.bias": "model-00001-of-00002.safetensors",
224
+ "model.layers.20.mlp.fc1.weight": "model-00001-of-00002.safetensors",
225
+ "model.layers.20.mlp.fc2.bias": "model-00001-of-00002.safetensors",
226
+ "model.layers.20.mlp.fc2.weight": "model-00001-of-00002.safetensors",
227
+ "model.layers.20.self_attn.dense.bias": "model-00001-of-00002.safetensors",
228
+ "model.layers.20.self_attn.dense.weight": "model-00001-of-00002.safetensors",
229
+ "model.layers.20.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
230
+ "model.layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
231
+ "model.layers.20.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
232
+ "model.layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
233
+ "model.layers.20.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
234
+ "model.layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
235
+ "model.layers.21.input_layernorm.bias": "model-00001-of-00002.safetensors",
236
+ "model.layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors",
237
+ "model.layers.21.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
238
+ "model.layers.21.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
239
+ "model.layers.21.mlp.fc1.bias": "model-00001-of-00002.safetensors",
240
+ "model.layers.21.mlp.fc1.weight": "model-00001-of-00002.safetensors",
241
+ "model.layers.21.mlp.fc2.bias": "model-00001-of-00002.safetensors",
242
+ "model.layers.21.mlp.fc2.weight": "model-00001-of-00002.safetensors",
243
+ "model.layers.21.self_attn.dense.bias": "model-00001-of-00002.safetensors",
244
+ "model.layers.21.self_attn.dense.weight": "model-00001-of-00002.safetensors",
245
+ "model.layers.21.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
246
+ "model.layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
247
+ "model.layers.21.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
248
+ "model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
249
+ "model.layers.21.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
250
+ "model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
251
+ "model.layers.22.input_layernorm.bias": "model-00001-of-00002.safetensors",
252
+ "model.layers.22.input_layernorm.weight": "model-00001-of-00002.safetensors",
253
+ "model.layers.22.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
254
+ "model.layers.22.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
255
+ "model.layers.22.mlp.fc1.bias": "model-00001-of-00002.safetensors",
256
+ "model.layers.22.mlp.fc1.weight": "model-00001-of-00002.safetensors",
257
+ "model.layers.22.mlp.fc2.bias": "model-00001-of-00002.safetensors",
258
+ "model.layers.22.mlp.fc2.weight": "model-00001-of-00002.safetensors",
259
+ "model.layers.22.self_attn.dense.bias": "model-00001-of-00002.safetensors",
260
+ "model.layers.22.self_attn.dense.weight": "model-00001-of-00002.safetensors",
261
+ "model.layers.22.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
262
+ "model.layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
263
+ "model.layers.22.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
264
+ "model.layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
265
+ "model.layers.22.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
266
+ "model.layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
267
+ "model.layers.23.input_layernorm.bias": "model-00001-of-00002.safetensors",
268
+ "model.layers.23.input_layernorm.weight": "model-00001-of-00002.safetensors",
269
+ "model.layers.23.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
270
+ "model.layers.23.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
271
+ "model.layers.23.mlp.fc1.bias": "model-00001-of-00002.safetensors",
272
+ "model.layers.23.mlp.fc1.weight": "model-00001-of-00002.safetensors",
273
+ "model.layers.23.mlp.fc2.bias": "model-00001-of-00002.safetensors",
274
+ "model.layers.23.mlp.fc2.weight": "model-00001-of-00002.safetensors",
275
+ "model.layers.23.self_attn.dense.bias": "model-00001-of-00002.safetensors",
276
+ "model.layers.23.self_attn.dense.weight": "model-00001-of-00002.safetensors",
277
+ "model.layers.23.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
278
+ "model.layers.23.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
279
+ "model.layers.23.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
280
+ "model.layers.23.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
281
+ "model.layers.23.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
282
+ "model.layers.23.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
283
+ "model.layers.24.input_layernorm.bias": "model-00001-of-00002.safetensors",
284
+ "model.layers.24.input_layernorm.weight": "model-00001-of-00002.safetensors",
285
+ "model.layers.24.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
286
+ "model.layers.24.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
287
+ "model.layers.24.mlp.fc1.bias": "model-00001-of-00002.safetensors",
288
+ "model.layers.24.mlp.fc1.weight": "model-00001-of-00002.safetensors",
289
+ "model.layers.24.mlp.fc2.bias": "model-00001-of-00002.safetensors",
290
+ "model.layers.24.mlp.fc2.weight": "model-00001-of-00002.safetensors",
291
+ "model.layers.24.self_attn.dense.bias": "model-00001-of-00002.safetensors",
292
+ "model.layers.24.self_attn.dense.weight": "model-00001-of-00002.safetensors",
293
+ "model.layers.24.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
294
+ "model.layers.24.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
295
+ "model.layers.24.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
296
+ "model.layers.24.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
297
+ "model.layers.24.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
298
+ "model.layers.24.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
299
+ "model.layers.25.input_layernorm.bias": "model-00001-of-00002.safetensors",
300
+ "model.layers.25.input_layernorm.weight": "model-00001-of-00002.safetensors",
301
+ "model.layers.25.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
302
+ "model.layers.25.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
303
+ "model.layers.25.mlp.fc1.bias": "model-00001-of-00002.safetensors",
304
+ "model.layers.25.mlp.fc1.weight": "model-00001-of-00002.safetensors",
305
+ "model.layers.25.mlp.fc2.bias": "model-00001-of-00002.safetensors",
306
+ "model.layers.25.mlp.fc2.weight": "model-00001-of-00002.safetensors",
307
+ "model.layers.25.self_attn.dense.bias": "model-00001-of-00002.safetensors",
308
+ "model.layers.25.self_attn.dense.weight": "model-00001-of-00002.safetensors",
309
+ "model.layers.25.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
310
+ "model.layers.25.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
311
+ "model.layers.25.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
312
+ "model.layers.25.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
313
+ "model.layers.25.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
314
+ "model.layers.25.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
315
+ "model.layers.26.input_layernorm.bias": "model-00001-of-00002.safetensors",
316
+ "model.layers.26.input_layernorm.weight": "model-00001-of-00002.safetensors",
317
+ "model.layers.26.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
318
+ "model.layers.26.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
319
+ "model.layers.26.mlp.fc1.bias": "model-00001-of-00002.safetensors",
320
+ "model.layers.26.mlp.fc1.weight": "model-00001-of-00002.safetensors",
321
+ "model.layers.26.mlp.fc2.bias": "model-00001-of-00002.safetensors",
322
+ "model.layers.26.mlp.fc2.weight": "model-00001-of-00002.safetensors",
323
+ "model.layers.26.self_attn.dense.bias": "model-00001-of-00002.safetensors",
324
+ "model.layers.26.self_attn.dense.weight": "model-00001-of-00002.safetensors",
325
+ "model.layers.26.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
326
+ "model.layers.26.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
327
+ "model.layers.26.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
328
+ "model.layers.26.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
329
+ "model.layers.26.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
330
+ "model.layers.26.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
331
+ "model.layers.27.input_layernorm.bias": "model-00001-of-00002.safetensors",
332
+ "model.layers.27.input_layernorm.weight": "model-00001-of-00002.safetensors",
333
+ "model.layers.27.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
334
+ "model.layers.27.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
335
+ "model.layers.27.mlp.fc1.bias": "model-00001-of-00002.safetensors",
336
+ "model.layers.27.mlp.fc1.weight": "model-00001-of-00002.safetensors",
337
+ "model.layers.27.mlp.fc2.bias": "model-00001-of-00002.safetensors",
338
+ "model.layers.27.mlp.fc2.weight": "model-00001-of-00002.safetensors",
339
+ "model.layers.27.self_attn.dense.bias": "model-00001-of-00002.safetensors",
340
+ "model.layers.27.self_attn.dense.weight": "model-00001-of-00002.safetensors",
341
+ "model.layers.27.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
342
+ "model.layers.27.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
343
+ "model.layers.27.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
344
+ "model.layers.27.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
345
+ "model.layers.27.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
346
+ "model.layers.27.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
347
+ "model.layers.28.input_layernorm.bias": "model-00001-of-00002.safetensors",
348
+ "model.layers.28.input_layernorm.weight": "model-00001-of-00002.safetensors",
349
+ "model.layers.28.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
350
+ "model.layers.28.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
351
+ "model.layers.28.mlp.fc1.bias": "model-00001-of-00002.safetensors",
352
+ "model.layers.28.mlp.fc1.weight": "model-00001-of-00002.safetensors",
353
+ "model.layers.28.mlp.fc2.bias": "model-00001-of-00002.safetensors",
354
+ "model.layers.28.mlp.fc2.weight": "model-00001-of-00002.safetensors",
355
+ "model.layers.28.self_attn.dense.bias": "model-00001-of-00002.safetensors",
356
+ "model.layers.28.self_attn.dense.weight": "model-00001-of-00002.safetensors",
357
+ "model.layers.28.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
358
+ "model.layers.28.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
359
+ "model.layers.28.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
360
+ "model.layers.28.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
361
+ "model.layers.28.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
362
+ "model.layers.28.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
363
+ "model.layers.29.input_layernorm.bias": "model-00002-of-00002.safetensors",
364
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
365
+ "model.layers.29.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
366
+ "model.layers.29.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
367
+ "model.layers.29.mlp.fc1.bias": "model-00002-of-00002.safetensors",
368
+ "model.layers.29.mlp.fc1.weight": "model-00002-of-00002.safetensors",
369
+ "model.layers.29.mlp.fc2.bias": "model-00002-of-00002.safetensors",
370
+ "model.layers.29.mlp.fc2.weight": "model-00002-of-00002.safetensors",
371
+ "model.layers.29.self_attn.dense.bias": "model-00002-of-00002.safetensors",
372
+ "model.layers.29.self_attn.dense.weight": "model-00002-of-00002.safetensors",
373
+ "model.layers.29.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
374
+ "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
375
+ "model.layers.29.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
376
+ "model.layers.29.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
377
+ "model.layers.29.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
378
+ "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
379
+ "model.layers.3.input_layernorm.bias": "model-00001-of-00002.safetensors",
380
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
381
+ "model.layers.3.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
382
+ "model.layers.3.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
383
+ "model.layers.3.mlp.fc1.bias": "model-00001-of-00002.safetensors",
384
+ "model.layers.3.mlp.fc1.weight": "model-00001-of-00002.safetensors",
385
+ "model.layers.3.mlp.fc2.bias": "model-00001-of-00002.safetensors",
386
+ "model.layers.3.mlp.fc2.weight": "model-00001-of-00002.safetensors",
387
+ "model.layers.3.self_attn.dense.bias": "model-00001-of-00002.safetensors",
388
+ "model.layers.3.self_attn.dense.weight": "model-00001-of-00002.safetensors",
389
+ "model.layers.3.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
390
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
391
+ "model.layers.3.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
392
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
393
+ "model.layers.3.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
394
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
395
+ "model.layers.30.input_layernorm.bias": "model-00002-of-00002.safetensors",
396
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
397
+ "model.layers.30.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
398
+ "model.layers.30.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
399
+ "model.layers.30.mlp.fc1.bias": "model-00002-of-00002.safetensors",
400
+ "model.layers.30.mlp.fc1.weight": "model-00002-of-00002.safetensors",
401
+ "model.layers.30.mlp.fc2.bias": "model-00002-of-00002.safetensors",
402
+ "model.layers.30.mlp.fc2.weight": "model-00002-of-00002.safetensors",
403
+ "model.layers.30.self_attn.dense.bias": "model-00002-of-00002.safetensors",
404
+ "model.layers.30.self_attn.dense.weight": "model-00002-of-00002.safetensors",
405
+ "model.layers.30.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
406
+ "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
407
+ "model.layers.30.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
408
+ "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
409
+ "model.layers.30.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
410
+ "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
411
+ "model.layers.31.input_layernorm.bias": "model-00002-of-00002.safetensors",
412
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
413
+ "model.layers.31.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
414
+ "model.layers.31.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
415
+ "model.layers.31.mlp.fc1.bias": "model-00002-of-00002.safetensors",
416
+ "model.layers.31.mlp.fc1.weight": "model-00002-of-00002.safetensors",
417
+ "model.layers.31.mlp.fc2.bias": "model-00002-of-00002.safetensors",
418
+ "model.layers.31.mlp.fc2.weight": "model-00002-of-00002.safetensors",
419
+ "model.layers.31.self_attn.dense.bias": "model-00002-of-00002.safetensors",
420
+ "model.layers.31.self_attn.dense.weight": "model-00002-of-00002.safetensors",
421
+ "model.layers.31.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
422
+ "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
423
+ "model.layers.31.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
424
+ "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
425
+ "model.layers.31.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
426
+ "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
427
+ "model.layers.32.input_layernorm.bias": "model-00002-of-00002.safetensors",
428
+ "model.layers.32.input_layernorm.weight": "model-00002-of-00002.safetensors",
429
+ "model.layers.32.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
430
+ "model.layers.32.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
431
+ "model.layers.32.mlp.fc1.bias": "model-00002-of-00002.safetensors",
432
+ "model.layers.32.mlp.fc1.weight": "model-00002-of-00002.safetensors",
433
+ "model.layers.32.mlp.fc2.bias": "model-00002-of-00002.safetensors",
434
+ "model.layers.32.mlp.fc2.weight": "model-00002-of-00002.safetensors",
435
+ "model.layers.32.self_attn.dense.bias": "model-00002-of-00002.safetensors",
436
+ "model.layers.32.self_attn.dense.weight": "model-00002-of-00002.safetensors",
437
+ "model.layers.32.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
438
+ "model.layers.32.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
439
+ "model.layers.32.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
440
+ "model.layers.32.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
441
+ "model.layers.32.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
442
+ "model.layers.32.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
443
+ "model.layers.33.input_layernorm.bias": "model-00002-of-00002.safetensors",
444
+ "model.layers.33.input_layernorm.weight": "model-00002-of-00002.safetensors",
445
+ "model.layers.33.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
446
+ "model.layers.33.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
447
+ "model.layers.33.mlp.fc1.bias": "model-00002-of-00002.safetensors",
448
+ "model.layers.33.mlp.fc1.weight": "model-00002-of-00002.safetensors",
449
+ "model.layers.33.mlp.fc2.bias": "model-00002-of-00002.safetensors",
450
+ "model.layers.33.mlp.fc2.weight": "model-00002-of-00002.safetensors",
451
+ "model.layers.33.self_attn.dense.bias": "model-00002-of-00002.safetensors",
452
+ "model.layers.33.self_attn.dense.weight": "model-00002-of-00002.safetensors",
453
+ "model.layers.33.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
454
+ "model.layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
455
+ "model.layers.33.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
456
+ "model.layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
457
+ "model.layers.33.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
458
+ "model.layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
459
+ "model.layers.34.input_layernorm.bias": "model-00002-of-00002.safetensors",
460
+ "model.layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
461
+ "model.layers.34.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
462
+ "model.layers.34.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
463
+ "model.layers.34.mlp.fc1.bias": "model-00002-of-00002.safetensors",
464
+ "model.layers.34.mlp.fc1.weight": "model-00002-of-00002.safetensors",
465
+ "model.layers.34.mlp.fc2.bias": "model-00002-of-00002.safetensors",
466
+ "model.layers.34.mlp.fc2.weight": "model-00002-of-00002.safetensors",
467
+ "model.layers.34.self_attn.dense.bias": "model-00002-of-00002.safetensors",
468
+ "model.layers.34.self_attn.dense.weight": "model-00002-of-00002.safetensors",
469
+ "model.layers.34.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
470
+ "model.layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
471
+ "model.layers.34.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
472
+ "model.layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
473
+ "model.layers.34.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
474
+ "model.layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
475
+ "model.layers.35.input_layernorm.bias": "model-00002-of-00002.safetensors",
476
+ "model.layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
477
+ "model.layers.35.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
478
+ "model.layers.35.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
479
+ "model.layers.35.mlp.fc1.bias": "model-00002-of-00002.safetensors",
480
+ "model.layers.35.mlp.fc1.weight": "model-00002-of-00002.safetensors",
481
+ "model.layers.35.mlp.fc2.bias": "model-00002-of-00002.safetensors",
482
+ "model.layers.35.mlp.fc2.weight": "model-00002-of-00002.safetensors",
483
+ "model.layers.35.self_attn.dense.bias": "model-00002-of-00002.safetensors",
484
+ "model.layers.35.self_attn.dense.weight": "model-00002-of-00002.safetensors",
485
+ "model.layers.35.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
486
+ "model.layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
487
+ "model.layers.35.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
488
+ "model.layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
489
+ "model.layers.35.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
490
+ "model.layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
491
+ "model.layers.36.input_layernorm.bias": "model-00002-of-00002.safetensors",
492
+ "model.layers.36.input_layernorm.weight": "model-00002-of-00002.safetensors",
493
+ "model.layers.36.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
494
+ "model.layers.36.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
495
+ "model.layers.36.mlp.fc1.bias": "model-00002-of-00002.safetensors",
496
+ "model.layers.36.mlp.fc1.weight": "model-00002-of-00002.safetensors",
497
+ "model.layers.36.mlp.fc2.bias": "model-00002-of-00002.safetensors",
498
+ "model.layers.36.mlp.fc2.weight": "model-00002-of-00002.safetensors",
499
+ "model.layers.36.self_attn.dense.bias": "model-00002-of-00002.safetensors",
500
+ "model.layers.36.self_attn.dense.weight": "model-00002-of-00002.safetensors",
501
+ "model.layers.36.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
502
+ "model.layers.36.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
503
+ "model.layers.36.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
504
+ "model.layers.36.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
505
+ "model.layers.36.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
506
+ "model.layers.36.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
507
+ "model.layers.37.input_layernorm.bias": "model-00002-of-00002.safetensors",
508
+ "model.layers.37.input_layernorm.weight": "model-00002-of-00002.safetensors",
509
+ "model.layers.37.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
510
+ "model.layers.37.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
511
+ "model.layers.37.mlp.fc1.bias": "model-00002-of-00002.safetensors",
512
+ "model.layers.37.mlp.fc1.weight": "model-00002-of-00002.safetensors",
513
+ "model.layers.37.mlp.fc2.bias": "model-00002-of-00002.safetensors",
514
+ "model.layers.37.mlp.fc2.weight": "model-00002-of-00002.safetensors",
515
+ "model.layers.37.self_attn.dense.bias": "model-00002-of-00002.safetensors",
516
+ "model.layers.37.self_attn.dense.weight": "model-00002-of-00002.safetensors",
517
+ "model.layers.37.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
518
+ "model.layers.37.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
519
+ "model.layers.37.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
520
+ "model.layers.37.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
521
+ "model.layers.37.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
522
+ "model.layers.37.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
523
+ "model.layers.38.input_layernorm.bias": "model-00002-of-00002.safetensors",
524
+ "model.layers.38.input_layernorm.weight": "model-00002-of-00002.safetensors",
525
+ "model.layers.38.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
526
+ "model.layers.38.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
527
+ "model.layers.38.mlp.fc1.bias": "model-00002-of-00002.safetensors",
528
+ "model.layers.38.mlp.fc1.weight": "model-00002-of-00002.safetensors",
529
+ "model.layers.38.mlp.fc2.bias": "model-00002-of-00002.safetensors",
530
+ "model.layers.38.mlp.fc2.weight": "model-00002-of-00002.safetensors",
531
+ "model.layers.38.self_attn.dense.bias": "model-00002-of-00002.safetensors",
532
+ "model.layers.38.self_attn.dense.weight": "model-00002-of-00002.safetensors",
533
+ "model.layers.38.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
534
+ "model.layers.38.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
535
+ "model.layers.38.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
536
+ "model.layers.38.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
537
+ "model.layers.38.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
538
+ "model.layers.38.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
539
+ "model.layers.39.input_layernorm.bias": "model-00002-of-00002.safetensors",
540
+ "model.layers.39.input_layernorm.weight": "model-00002-of-00002.safetensors",
541
+ "model.layers.39.mlp.adapter.adapter_down.weight": "model-00002-of-00002.safetensors",
542
+ "model.layers.39.mlp.adapter.adapter_up.weight": "model-00002-of-00002.safetensors",
543
+ "model.layers.39.mlp.fc1.bias": "model-00002-of-00002.safetensors",
544
+ "model.layers.39.mlp.fc1.weight": "model-00002-of-00002.safetensors",
545
+ "model.layers.39.mlp.fc2.bias": "model-00002-of-00002.safetensors",
546
+ "model.layers.39.mlp.fc2.weight": "model-00002-of-00002.safetensors",
547
+ "model.layers.39.self_attn.dense.bias": "model-00002-of-00002.safetensors",
548
+ "model.layers.39.self_attn.dense.weight": "model-00002-of-00002.safetensors",
549
+ "model.layers.39.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
550
+ "model.layers.39.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
551
+ "model.layers.39.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
552
+ "model.layers.39.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
553
+ "model.layers.39.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
554
+ "model.layers.39.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
555
+ "model.layers.4.input_layernorm.bias": "model-00001-of-00002.safetensors",
556
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
557
+ "model.layers.4.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
558
+ "model.layers.4.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
559
+ "model.layers.4.mlp.fc1.bias": "model-00001-of-00002.safetensors",
560
+ "model.layers.4.mlp.fc1.weight": "model-00001-of-00002.safetensors",
561
+ "model.layers.4.mlp.fc2.bias": "model-00001-of-00002.safetensors",
562
+ "model.layers.4.mlp.fc2.weight": "model-00001-of-00002.safetensors",
563
+ "model.layers.4.self_attn.dense.bias": "model-00001-of-00002.safetensors",
564
+ "model.layers.4.self_attn.dense.weight": "model-00001-of-00002.safetensors",
565
+ "model.layers.4.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
566
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
567
+ "model.layers.4.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
568
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
569
+ "model.layers.4.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
570
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
571
+ "model.layers.5.input_layernorm.bias": "model-00001-of-00002.safetensors",
572
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
573
+ "model.layers.5.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
574
+ "model.layers.5.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
575
+ "model.layers.5.mlp.fc1.bias": "model-00001-of-00002.safetensors",
576
+ "model.layers.5.mlp.fc1.weight": "model-00001-of-00002.safetensors",
577
+ "model.layers.5.mlp.fc2.bias": "model-00001-of-00002.safetensors",
578
+ "model.layers.5.mlp.fc2.weight": "model-00001-of-00002.safetensors",
579
+ "model.layers.5.self_attn.dense.bias": "model-00001-of-00002.safetensors",
580
+ "model.layers.5.self_attn.dense.weight": "model-00001-of-00002.safetensors",
581
+ "model.layers.5.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
582
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
583
+ "model.layers.5.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
584
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
585
+ "model.layers.5.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
586
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
587
+ "model.layers.6.input_layernorm.bias": "model-00001-of-00002.safetensors",
588
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
589
+ "model.layers.6.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
590
+ "model.layers.6.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
591
+ "model.layers.6.mlp.fc1.bias": "model-00001-of-00002.safetensors",
592
+ "model.layers.6.mlp.fc1.weight": "model-00001-of-00002.safetensors",
593
+ "model.layers.6.mlp.fc2.bias": "model-00001-of-00002.safetensors",
594
+ "model.layers.6.mlp.fc2.weight": "model-00001-of-00002.safetensors",
595
+ "model.layers.6.self_attn.dense.bias": "model-00001-of-00002.safetensors",
596
+ "model.layers.6.self_attn.dense.weight": "model-00001-of-00002.safetensors",
597
+ "model.layers.6.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
598
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
599
+ "model.layers.6.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
600
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
601
+ "model.layers.6.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
602
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
603
+ "model.layers.7.input_layernorm.bias": "model-00001-of-00002.safetensors",
604
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
605
+ "model.layers.7.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
606
+ "model.layers.7.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
607
+ "model.layers.7.mlp.fc1.bias": "model-00001-of-00002.safetensors",
608
+ "model.layers.7.mlp.fc1.weight": "model-00001-of-00002.safetensors",
609
+ "model.layers.7.mlp.fc2.bias": "model-00001-of-00002.safetensors",
610
+ "model.layers.7.mlp.fc2.weight": "model-00001-of-00002.safetensors",
611
+ "model.layers.7.self_attn.dense.bias": "model-00001-of-00002.safetensors",
612
+ "model.layers.7.self_attn.dense.weight": "model-00001-of-00002.safetensors",
613
+ "model.layers.7.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
614
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
615
+ "model.layers.7.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
616
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
617
+ "model.layers.7.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
618
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
619
+ "model.layers.8.input_layernorm.bias": "model-00001-of-00002.safetensors",
620
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
621
+ "model.layers.8.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
622
+ "model.layers.8.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
623
+ "model.layers.8.mlp.fc1.bias": "model-00001-of-00002.safetensors",
624
+ "model.layers.8.mlp.fc1.weight": "model-00001-of-00002.safetensors",
625
+ "model.layers.8.mlp.fc2.bias": "model-00001-of-00002.safetensors",
626
+ "model.layers.8.mlp.fc2.weight": "model-00001-of-00002.safetensors",
627
+ "model.layers.8.self_attn.dense.bias": "model-00001-of-00002.safetensors",
628
+ "model.layers.8.self_attn.dense.weight": "model-00001-of-00002.safetensors",
629
+ "model.layers.8.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
630
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
631
+ "model.layers.8.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
632
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
633
+ "model.layers.8.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
634
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
635
+ "model.layers.9.input_layernorm.bias": "model-00001-of-00002.safetensors",
636
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
637
+ "model.layers.9.mlp.adapter.adapter_down.weight": "model-00001-of-00002.safetensors",
638
+ "model.layers.9.mlp.adapter.adapter_up.weight": "model-00001-of-00002.safetensors",
639
+ "model.layers.9.mlp.fc1.bias": "model-00001-of-00002.safetensors",
640
+ "model.layers.9.mlp.fc1.weight": "model-00001-of-00002.safetensors",
641
+ "model.layers.9.mlp.fc2.bias": "model-00001-of-00002.safetensors",
642
+ "model.layers.9.mlp.fc2.weight": "model-00001-of-00002.safetensors",
643
+ "model.layers.9.self_attn.dense.bias": "model-00001-of-00002.safetensors",
644
+ "model.layers.9.self_attn.dense.weight": "model-00001-of-00002.safetensors",
645
+ "model.layers.9.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
646
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
647
+ "model.layers.9.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
648
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
649
+ "model.layers.9.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
650
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors"
651
+ }
652
+ }
modeling_boomer.py ADDED
@@ -0,0 +1,1354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ """ PyTorch Boomer model."""
4
+
5
+
6
+ import math
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 _prepare_4d_causal_attention_mask
18
+ from transformers.modeling_outputs import (
19
+ BaseModelOutputWithPast,
20
+ CausalLMOutputWithPast,
21
+ SequenceClassifierOutputWithPast,
22
+ TokenClassifierOutput,
23
+ )
24
+ from transformers.modeling_utils import PreTrainedModel
25
+ from transformers.utils import (
26
+ add_code_sample_docstrings,
27
+ add_start_docstrings,
28
+ add_start_docstrings_to_model_forward,
29
+ is_flash_attn_2_available,
30
+ is_flash_attn_greater_or_equal_2_10,
31
+ logging,
32
+ replace_return_docstrings,
33
+ )
34
+ from .configuration_boomer import BoomerConfig
35
+
36
+
37
+ try:
38
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
39
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
40
+ except:
41
+ pass
42
+
43
+
44
+ logger = logging.get_logger(__name__)
45
+
46
+ _CHECKPOINT_FOR_DOC = "budecosystem/Boomer-4b"
47
+ _CONFIG_FOR_DOC = "BoomerConfig"
48
+
49
+
50
+
51
+
52
+ # Copied from transformers.models.llama.modeling_llama._get_unpad_data
53
+ def _get_unpad_data(attention_mask):
54
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
55
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
56
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
57
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
58
+ return (
59
+ indices,
60
+ cu_seqlens,
61
+ max_seqlen_in_batch,
62
+ )
63
+
64
+
65
+ # Copied from transformers.models.llama.modeling_llama.LlamaRotaryEmbedding with Llama->Boomer
66
+ class BoomerRotaryEmbedding(nn.Module):
67
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
68
+ super().__init__()
69
+
70
+ self.dim = dim
71
+ self.max_position_embeddings = max_position_embeddings
72
+ self.base = base
73
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
74
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
75
+
76
+ # Build here to make `torch.jit.trace` work.
77
+ self._set_cos_sin_cache(
78
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
79
+ )
80
+
81
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
82
+ self.max_seq_len_cached = seq_len
83
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
84
+
85
+ freqs = torch.outer(t, self.inv_freq)
86
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
87
+ emb = torch.cat((freqs, freqs), dim=-1)
88
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
89
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
90
+
91
+ def forward(self, x, seq_len=None):
92
+ # x: [bs, num_attention_heads, seq_len, head_size]
93
+ if seq_len > self.max_seq_len_cached:
94
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
95
+
96
+ return (
97
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
98
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
99
+ )
100
+
101
+
102
+ # Copied from transformers.models.llama.modeling_llama.LlamaLinearScalingRotaryEmbedding with Llama->Boomer
103
+ class BoomerLinearScalingRotaryEmbedding(BoomerRotaryEmbedding):
104
+ """BoomerRotaryEmbedding extended with linear scaling. Credits to the Reddit user /u/kaiokendev"""
105
+
106
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
107
+ self.scaling_factor = scaling_factor
108
+ super().__init__(dim, max_position_embeddings, base, device)
109
+
110
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
111
+ self.max_seq_len_cached = seq_len
112
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
113
+ t = t / self.scaling_factor
114
+
115
+ freqs = torch.outer(t, self.inv_freq)
116
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
117
+ emb = torch.cat((freqs, freqs), dim=-1)
118
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
119
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
120
+
121
+
122
+ # Copied from transformers.models.llama.modeling_llama.LlamaDynamicNTKScalingRotaryEmbedding with Llama->Boomer
123
+ class BoomerDynamicNTKScalingRotaryEmbedding(BoomerRotaryEmbedding):
124
+ """BoomerRotaryEmbedding extended with Dynamic NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla"""
125
+
126
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None, scaling_factor=1.0):
127
+ self.scaling_factor = scaling_factor
128
+ super().__init__(dim, max_position_embeddings, base, device)
129
+
130
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
131
+ self.max_seq_len_cached = seq_len
132
+
133
+ if seq_len > self.max_position_embeddings:
134
+ base = self.base * (
135
+ (self.scaling_factor * seq_len / self.max_position_embeddings) - (self.scaling_factor - 1)
136
+ ) ** (self.dim / (self.dim - 2))
137
+ inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
138
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
139
+
140
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
141
+
142
+ freqs = torch.outer(t, self.inv_freq)
143
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
144
+ emb = torch.cat((freqs, freqs), dim=-1)
145
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
146
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
147
+
148
+
149
+ # Copied from transformers.models.llama.modeling_llama.rotate_half
150
+ def rotate_half(x):
151
+ """Rotates half the hidden dims of the input."""
152
+ x1 = x[..., : x.shape[-1] // 2]
153
+ x2 = x[..., x.shape[-1] // 2 :]
154
+ return torch.cat((-x2, x1), dim=-1)
155
+
156
+
157
+ # Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
158
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1):
159
+ """Applies Rotary Position Embedding to the query and key tensors.
160
+
161
+ Args:
162
+ q (`torch.Tensor`): The query tensor.
163
+ k (`torch.Tensor`): The key tensor.
164
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
165
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
166
+ position_ids (`torch.Tensor`):
167
+ The position indices of the tokens corresponding to the query and key tensors. For example, this can be
168
+ used to pass offsetted position ids when working with a KV-cache.
169
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
170
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
171
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
172
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
173
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
174
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
175
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
176
+ Returns:
177
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
178
+ """
179
+ cos = cos[position_ids].unsqueeze(unsqueeze_dim)
180
+ sin = sin[position_ids].unsqueeze(unsqueeze_dim)
181
+ q_embed = (q * cos) + (rotate_half(q) * sin)
182
+ k_embed = (k * cos) + (rotate_half(k) * sin)
183
+ return q_embed, k_embed
184
+
185
+
186
+ class AdapterMLP(nn.Module):
187
+ def __init__(self, config, adapter_dim, adapter_scaling):
188
+ super().__init__()
189
+ self.config = config
190
+ self.intermediate_size = config.intermediate_size
191
+ self.hidden_size = config.hidden_size
192
+ self.adapter_down = nn.Linear(self.hidden_size, adapter_dim, bias=False)
193
+ self.adapter_up = nn.Linear(adapter_dim, self.hidden_size, bias=False)
194
+ self.adapter_act = ACT2FN[config.hidden_act]
195
+
196
+ self.adapter_dropout = nn.Dropout(p=0.1)
197
+ self.adapter_scaling = adapter_scaling
198
+
199
+ def forward(self, x):
200
+ x = self.adapter_dropout(x)
201
+ x = self.adapter_scaling * self.adapter_up(self.adapter_act(self.adapter_down(x)))
202
+ return x
203
+
204
+ # Copied from transformers.models.clip.modeling_clip.CLIPMLP with CLIP->Boomer
205
+ class BoomerMLP(nn.Module):
206
+ def __init__(self, config):
207
+ super().__init__()
208
+ self.config = config
209
+ self.activation_fn = ACT2FN[config.hidden_act]
210
+ self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
211
+ self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
212
+
213
+ self.adapter = AdapterMLP(config, config.adapter_dim, config.adapter_scaling)
214
+
215
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
216
+ hidden_states = self.fc1(hidden_states)
217
+ hidden_states = self.activation_fn(hidden_states)
218
+ hidden_states = self.fc2(hidden_states)
219
+ return hidden_states
220
+
221
+
222
+ # Copied from transformers.models.llama.modeling_llama.repeat_kv with llama->boomer
223
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
224
+ """
225
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
226
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
227
+ """
228
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
229
+ if n_rep == 1:
230
+ return hidden_states
231
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
232
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
233
+
234
+
235
+ class BoomerAttention(nn.Module):
236
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
237
+
238
+ def __init__(self, config: BoomerConfig, layer_idx: Optional[int] = None):
239
+ super().__init__()
240
+ self.config = config
241
+ self.layer_idx = layer_idx
242
+ if layer_idx is None:
243
+ logger.warning_once(
244
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
245
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
246
+ "when creating this class."
247
+ )
248
+
249
+ self.attention_dropout = config.attention_dropout
250
+ self.hidden_size = config.hidden_size
251
+ self.num_heads = config.num_attention_heads
252
+ self.head_dim = self.hidden_size // self.num_heads
253
+ self.num_key_value_heads = config.num_key_value_heads
254
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
255
+ self.max_position_embeddings = config.max_position_embeddings
256
+ self.rope_theta = config.rope_theta
257
+ self.partial_rotary_factor = config.partial_rotary_factor
258
+ self.is_causal = True
259
+
260
+ if (self.head_dim * self.num_heads) != self.hidden_size:
261
+ raise ValueError(
262
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
263
+ f" and `num_heads`: {self.num_heads})."
264
+ )
265
+
266
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=True)
267
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
268
+ self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
269
+ self.dense = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=True)
270
+
271
+ self.qk_layernorm = config.qk_layernorm
272
+ if self.qk_layernorm:
273
+ self.q_layernorm = nn.LayerNorm(
274
+ config.hidden_size // self.num_heads, eps=config.layer_norm_eps, elementwise_affine=True
275
+ )
276
+ self.k_layernorm = nn.LayerNorm(
277
+ config.hidden_size // self.num_heads, eps=config.layer_norm_eps, elementwise_affine=True
278
+ )
279
+
280
+ self._init_rope()
281
+
282
+ def _init_rope(self):
283
+ if self.config.rope_scaling is None:
284
+ self.rotary_emb = BoomerRotaryEmbedding(
285
+ int(self.partial_rotary_factor * self.head_dim),
286
+ max_position_embeddings=self.max_position_embeddings,
287
+ base=self.rope_theta,
288
+ )
289
+ else:
290
+ scaling_type = self.config.rope_scaling["type"]
291
+ scaling_factor = self.config.rope_scaling["factor"]
292
+ if scaling_type == "linear":
293
+ self.rotary_emb = BoomerLinearScalingRotaryEmbedding(
294
+ int(self.partial_rotary_factor * self.head_dim),
295
+ max_position_embeddings=self.max_position_embeddings,
296
+ scaling_factor=scaling_factor,
297
+ base=self.rope_theta,
298
+ )
299
+ elif scaling_type == "dynamic":
300
+ self.rotary_emb = BoomerDynamicNTKScalingRotaryEmbedding(
301
+ int(self.partial_rotary_factor * self.head_dim),
302
+ max_position_embeddings=self.max_position_embeddings,
303
+ scaling_factor=scaling_factor,
304
+ base=self.rope_theta,
305
+ )
306
+ else:
307
+ raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
308
+
309
+ def forward(
310
+ self,
311
+ hidden_states: torch.Tensor,
312
+ attention_mask: Optional[torch.Tensor] = None,
313
+ position_ids: Optional[torch.LongTensor] = None,
314
+ past_key_value: Optional[Cache] = None,
315
+ output_attentions: bool = False,
316
+ use_cache: bool = False,
317
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
318
+ bsz, q_len, _ = hidden_states.size()
319
+
320
+ query_states = self.q_proj(hidden_states)
321
+ key_states = self.k_proj(hidden_states)
322
+ value_states = self.v_proj(hidden_states)
323
+
324
+ if self.qk_layernorm:
325
+ query_states = self.q_layernorm(query_states)
326
+ key_states = self.k_layernorm(key_states)
327
+
328
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
329
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
330
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
331
+
332
+ kv_seq_len = key_states.shape[-2]
333
+ if past_key_value is not None:
334
+ if self.layer_idx is None:
335
+ raise ValueError(
336
+ f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
337
+ "for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
338
+ "with a layer index."
339
+ )
340
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
341
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
342
+
343
+ # Partial rotary embedding
344
+ query_rot, query_pass = (
345
+ query_states[..., : self.rotary_emb.dim],
346
+ query_states[..., self.rotary_emb.dim :],
347
+ )
348
+ key_rot, key_pass = (
349
+ key_states[..., : self.rotary_emb.dim],
350
+ key_states[..., self.rotary_emb.dim :],
351
+ )
352
+ # [batch_size, seq_length, num_heads, head_dim // config.partial_rotary_factor]
353
+ query_rot, key_rot = apply_rotary_pos_emb(query_rot, key_rot, cos, sin, position_ids)
354
+
355
+ # [batch_size, seq_length, num_heads, head_dim]
356
+ query_states = torch.cat((query_rot, query_pass), dim=-1)
357
+ key_states = torch.cat((key_rot, key_pass), dim=-1)
358
+
359
+ if past_key_value is not None:
360
+ cache_kwargs = {"sin": sin, "cos": cos, "partial_rotation_size": self.rotary_emb.dim}
361
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
362
+
363
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
364
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
365
+
366
+ # Queries and keys upcast to fp32 is required by Boomer to avoid overflow
367
+ attn_weights = torch.matmul(
368
+ query_states.to(torch.float32), key_states.to(torch.float32).transpose(2, 3)
369
+ ) / math.sqrt(self.head_dim)
370
+
371
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
372
+ raise ValueError(
373
+ f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
374
+ f" {attn_weights.size()}"
375
+ )
376
+
377
+ if attention_mask is not None:
378
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
379
+ raise ValueError(
380
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
381
+ )
382
+ attn_weights = attn_weights + attention_mask
383
+
384
+ # upcast attention to fp32
385
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(value_states.dtype)
386
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
387
+
388
+ attn_output = torch.matmul(attn_weights, value_states)
389
+
390
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
391
+ raise ValueError(
392
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
393
+ f" {attn_output.size()}"
394
+ )
395
+
396
+ attn_output = attn_output.transpose(1, 2).contiguous()
397
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
398
+
399
+ attn_output = self.dense(attn_output)
400
+
401
+ if not output_attentions:
402
+ attn_weights = None
403
+
404
+ return attn_output, attn_weights, past_key_value
405
+
406
+
407
+ class BoomerFlashAttention2(BoomerAttention):
408
+ """
409
+ Boomer flash attention module. This module inherits from `BoomerAttention` as the weights of the module stays
410
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
411
+ flash attention and deal with padding tokens in case the input contains any of them.
412
+ """
413
+
414
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2.__init__
415
+ def __init__(self, *args, **kwargs):
416
+ super().__init__(*args, **kwargs)
417
+
418
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
419
+ # 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.
420
+ # 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).
421
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
422
+
423
+ def forward(
424
+ self,
425
+ hidden_states: torch.Tensor,
426
+ attention_mask: Optional[torch.LongTensor] = None,
427
+ position_ids: Optional[torch.LongTensor] = None,
428
+ past_key_value: Optional[Cache] = None,
429
+ output_attentions: bool = False,
430
+ use_cache: bool = False,
431
+ **kwargs,
432
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
433
+ # BoomerFlashAttention2 attention does not support output_attentions
434
+
435
+ output_attentions = False
436
+
437
+ bsz, q_len, _ = hidden_states.size()
438
+
439
+ query_states = self.q_proj(hidden_states)
440
+ key_states = self.k_proj(hidden_states)
441
+ value_states = self.v_proj(hidden_states)
442
+
443
+ if self.qk_layernorm:
444
+ query_states = self.q_layernorm(query_states)
445
+ key_states = self.k_layernorm(key_states)
446
+
447
+ # Flash attention requires the input to have the shape
448
+ # batch_size x seq_length x head_dim x hidden_dim
449
+ # therefore we just need to keep the original shape
450
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
451
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
452
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
453
+
454
+ kv_seq_len = key_states.shape[-2]
455
+ if past_key_value is not None:
456
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
457
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
458
+
459
+ # Partial rotary embedding
460
+ query_rot, query_pass = (
461
+ query_states[..., : self.rotary_emb.dim],
462
+ query_states[..., self.rotary_emb.dim :],
463
+ )
464
+ key_rot, key_pass = (
465
+ key_states[..., : self.rotary_emb.dim],
466
+ key_states[..., self.rotary_emb.dim :],
467
+ )
468
+ # [batch_size, seq_length, num_heads, head_dim // config.partial_rotary_factor]
469
+ query_rot, key_rot = apply_rotary_pos_emb(query_rot, key_rot, cos, sin, position_ids)
470
+
471
+ # [batch_size, seq_length, num_heads, head_dim]
472
+ query_states = torch.cat((query_rot, query_pass), dim=-1)
473
+ key_states = torch.cat((key_rot, key_pass), dim=-1)
474
+
475
+ if past_key_value is not None:
476
+ cache_kwargs = {"sin": sin, "cos": cos, "partial_rotation_size": self.rotary_emb.dim}
477
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
478
+
479
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
480
+ # to be able to avoid many of these transpose/reshape/view.
481
+ query_states = query_states.transpose(1, 2)
482
+ key_states = key_states.transpose(1, 2)
483
+ value_states = value_states.transpose(1, 2)
484
+
485
+ attn_dropout = self.attention_dropout if self.training else 0.0
486
+
487
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
488
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
489
+ # cast them back in the correct dtype just to be sure everything works as expected.
490
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
491
+ # in fp32.
492
+
493
+ if query_states.dtype == torch.float32:
494
+ if torch.is_autocast_enabled():
495
+ target_dtype = torch.get_autocast_gpu_dtype()
496
+ # Handle the case where the model is quantized
497
+ elif hasattr(self.config, "_pre_quantization_dtype"):
498
+ target_dtype = self.config._pre_quantization_dtype
499
+ else:
500
+ target_dtype = self.q_proj.weight.dtype
501
+
502
+ logger.warning_once(
503
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
504
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
505
+ f" {target_dtype}."
506
+ )
507
+
508
+ query_states = query_states.to(target_dtype)
509
+ key_states = key_states.to(target_dtype)
510
+ value_states = value_states.to(target_dtype)
511
+
512
+ attn_output = self._flash_attention_forward(
513
+ query_states, key_states, value_states, attention_mask, q_len, dropout=attn_dropout, softmax_scale=None
514
+ )
515
+
516
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
517
+ attn_output = self.dense(attn_output)
518
+
519
+ if not output_attentions:
520
+ attn_weights = None
521
+
522
+ return attn_output, attn_weights, past_key_value
523
+
524
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2._flash_attention_forward
525
+ def _flash_attention_forward(
526
+ self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
527
+ ):
528
+ """
529
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
530
+ first unpad the input, then computes the attention scores and pad the final attention scores.
531
+
532
+ Args:
533
+ query_states (`torch.Tensor`):
534
+ Input query states to be passed to Flash Attention API
535
+ key_states (`torch.Tensor`):
536
+ Input key states to be passed to Flash Attention API
537
+ value_states (`torch.Tensor`):
538
+ Input value states to be passed to Flash Attention API
539
+ attention_mask (`torch.Tensor`):
540
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
541
+ position of padding tokens and 1 for the position of non-padding tokens.
542
+ dropout (`int`, *optional*):
543
+ Attention dropout
544
+ softmax_scale (`float`, *optional*):
545
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
546
+ """
547
+ if not self._flash_attn_uses_top_left_mask:
548
+ causal = self.is_causal
549
+ else:
550
+ # 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__.
551
+ causal = self.is_causal and query_length != 1
552
+
553
+ # Contains at least one padding token in the sequence
554
+ if attention_mask is not None:
555
+ batch_size = query_states.shape[0]
556
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
557
+ query_states, key_states, value_states, attention_mask, query_length
558
+ )
559
+
560
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
561
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
562
+
563
+ attn_output_unpad = flash_attn_varlen_func(
564
+ query_states,
565
+ key_states,
566
+ value_states,
567
+ cu_seqlens_q=cu_seqlens_q,
568
+ cu_seqlens_k=cu_seqlens_k,
569
+ max_seqlen_q=max_seqlen_in_batch_q,
570
+ max_seqlen_k=max_seqlen_in_batch_k,
571
+ dropout_p=dropout,
572
+ softmax_scale=softmax_scale,
573
+ causal=causal,
574
+ )
575
+
576
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
577
+ else:
578
+ attn_output = flash_attn_func(
579
+ query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
580
+ )
581
+
582
+ return attn_output
583
+
584
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2._upad_input
585
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
586
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
587
+ batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
588
+
589
+ key_layer = index_first_axis(
590
+ key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
591
+ )
592
+ value_layer = index_first_axis(
593
+ value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
594
+ )
595
+ if query_length == kv_seq_len:
596
+ query_layer = index_first_axis(
597
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
598
+ )
599
+ cu_seqlens_q = cu_seqlens_k
600
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
601
+ indices_q = indices_k
602
+ elif query_length == 1:
603
+ max_seqlen_in_batch_q = 1
604
+ cu_seqlens_q = torch.arange(
605
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
606
+ ) # There is a memcpy here, that is very bad.
607
+ indices_q = cu_seqlens_q[:-1]
608
+ query_layer = query_layer.squeeze(1)
609
+ else:
610
+ # The -q_len: slice assumes left padding.
611
+ attention_mask = attention_mask[:, -query_length:]
612
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
613
+
614
+ return (
615
+ query_layer,
616
+ key_layer,
617
+ value_layer,
618
+ indices_q,
619
+ (cu_seqlens_q, cu_seqlens_k),
620
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
621
+ )
622
+
623
+
624
+ BOOMER_ATTENTION_CLASSES = {
625
+ "eager": BoomerAttention,
626
+ "flash_attention_2": BoomerFlashAttention2,
627
+ }
628
+
629
+
630
+ class BoomerDecoderLayer(nn.Module):
631
+ def __init__(self, config: BoomerConfig, layer_idx: int):
632
+ super().__init__()
633
+ self.self_attn = BOOMER_ATTENTION_CLASSES[config._attn_implementation](config, layer_idx=layer_idx)
634
+ self.mlp = BoomerMLP(config)
635
+ self.input_layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
636
+ self.resid_dropout = nn.Dropout(config.resid_pdrop)
637
+
638
+ def forward(
639
+ self,
640
+ hidden_states: torch.Tensor,
641
+ attention_mask: Optional[torch.Tensor] = None,
642
+ position_ids: Optional[torch.LongTensor] = None,
643
+ output_attentions: Optional[bool] = False,
644
+ use_cache: Optional[bool] = False,
645
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
646
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
647
+ """
648
+ Args:
649
+ hidden_states (`torch.FloatTensor`):
650
+ input to the layer of shape `(batch, seq_len, embed_dim)`
651
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
652
+ `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
653
+ position_ids (`torch.LongTensor` of shape `({0})`, *optional*):
654
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range
655
+ `[0, config.n_positions - 1]`. [What are position IDs?](../glossary#position-ids)
656
+ output_attentions (`bool`, *optional*):
657
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
658
+ returned tensors for more detail.
659
+ use_cache (`bool`, *optional*):
660
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
661
+ (see `past_key_values`).
662
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
663
+ """
664
+
665
+ residual = hidden_states
666
+
667
+ hidden_states = self.input_layernorm(hidden_states)
668
+
669
+ # Self Attention
670
+ attn_outputs, self_attn_weights, present_key_value = self.self_attn(
671
+ hidden_states=hidden_states,
672
+ attention_mask=attention_mask,
673
+ position_ids=position_ids,
674
+ past_key_value=past_key_value,
675
+ output_attentions=output_attentions,
676
+ use_cache=use_cache,
677
+ )
678
+ attn_outputs = self.resid_dropout(attn_outputs)
679
+
680
+ feed_forward_hidden_states = self.resid_dropout(self.mlp(hidden_states))
681
+ hidden_states = attn_outputs + feed_forward_hidden_states + residual
682
+ outputs = (hidden_states,)
683
+
684
+ if output_attentions:
685
+ outputs += (self_attn_weights,)
686
+
687
+ if use_cache:
688
+ outputs += (present_key_value,)
689
+
690
+ return outputs
691
+
692
+
693
+ BOOMER_START_DOCSTRING = r"""
694
+
695
+
696
+ This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
697
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
698
+ and behavior.
699
+
700
+ Parameters:
701
+ config ([`BoomerConfig`]):
702
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
703
+ load the weights associated with the model, only the configuration. Check out the
704
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
705
+ """
706
+
707
+
708
+ @add_start_docstrings(
709
+ "The bare Boomer Model outputting raw hidden-states without any specific head on top.",
710
+ BOOMER_START_DOCSTRING,
711
+ )
712
+ class BoomerPreTrainedModel(PreTrainedModel):
713
+ config_class = BoomerConfig
714
+ base_model_prefix = "model"
715
+ supports_gradient_checkpointing = True
716
+ _no_split_modules = ["BoomerDecoderLayer"]
717
+ _skip_keys_device_placement = "past_key_values"
718
+ _supports_flash_attn_2 = True
719
+ _supports_cache_class = True
720
+
721
+ def _init_weights(self, module):
722
+ std = self.config.initializer_range
723
+ if isinstance(module, nn.Linear):
724
+ module.weight.data.normal_(mean=0.0, std=std)
725
+ if module.bias is not None:
726
+ module.bias.data.zero_()
727
+ elif isinstance(module, nn.Embedding):
728
+ module.weight.data.normal_(mean=0.0, std=std)
729
+ if module.padding_idx is not None:
730
+ module.weight.data[module.padding_idx].zero_()
731
+
732
+
733
+ BOOMER_INPUTS_DOCSTRING = r"""
734
+ Args:
735
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
736
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
737
+ it.
738
+
739
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
740
+ [`PreTrainedTokenizer.__call__`] for details.
741
+
742
+ [What are input IDs?](../glossary#input-ids)
743
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
744
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
745
+
746
+ - 1 for tokens that are **not masked**,
747
+ - 0 for tokens that are **masked**.
748
+
749
+ [What are attention masks?](../glossary#attention-mask)
750
+
751
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
752
+ [`PreTrainedTokenizer.__call__`] for details.
753
+
754
+ If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
755
+ `past_key_values`).
756
+
757
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
758
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
759
+ information on the default strategy.
760
+
761
+ - 1 indicates the head is **not masked**,
762
+ - 0 indicates the head is **masked**.
763
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
764
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
765
+ config.n_positions - 1]`.
766
+
767
+ [What are position IDs?](../glossary#position-ids)
768
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
769
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
770
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
771
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
772
+
773
+ Two formats are allowed:
774
+ - a [`~cache_utils.Cache`] instance;
775
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
776
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
777
+ cache format.
778
+
779
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
780
+ legacy cache format will be returned.
781
+
782
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
783
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
784
+ of shape `(batch_size, sequence_length)`.
785
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
786
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
787
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
788
+ model's internal embedding lookup matrix.
789
+ use_cache (`bool`, *optional*):
790
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
791
+ `past_key_values`).
792
+ output_attentions (`bool`, *optional*):
793
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
794
+ tensors for more detail.
795
+ output_hidden_states (`bool`, *optional*):
796
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
797
+ more detail.
798
+ return_dict (`bool`, *optional*):
799
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
800
+ """
801
+
802
+
803
+ @add_start_docstrings(
804
+ "The bare Boomer Model outputting raw hidden-states without any specific head on top.",
805
+ BOOMER_START_DOCSTRING,
806
+ )
807
+ class BoomerModel(BoomerPreTrainedModel):
808
+ """
809
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`BoomerDecoderLayer`]
810
+
811
+ Args:
812
+ config: BoomerConfig
813
+ """
814
+
815
+ def __init__(self, config: BoomerConfig):
816
+ super().__init__(config)
817
+ self.padding_idx = config.pad_token_id
818
+ self.vocab_size = config.vocab_size
819
+
820
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
821
+ self.embed_dropout = nn.Dropout(config.embd_pdrop)
822
+ self.layers = nn.ModuleList(
823
+ [BoomerDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
824
+ )
825
+ self.final_layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
826
+ self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
827
+
828
+ self.gradient_checkpointing = False
829
+ # Initialize weights and apply final processing
830
+ self.post_init()
831
+
832
+ def get_input_embeddings(self):
833
+ return self.embed_tokens
834
+
835
+ def set_input_embeddings(self, value):
836
+ self.embed_tokens = value
837
+
838
+ @add_start_docstrings_to_model_forward(BOOMER_INPUTS_DOCSTRING)
839
+ def forward(
840
+ self,
841
+ input_ids: torch.LongTensor = None,
842
+ attention_mask: Optional[torch.Tensor] = None,
843
+ position_ids: Optional[torch.LongTensor] = None,
844
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
845
+ inputs_embeds: Optional[torch.FloatTensor] = None,
846
+ use_cache: Optional[bool] = None,
847
+ output_attentions: Optional[bool] = None,
848
+ output_hidden_states: Optional[bool] = None,
849
+ return_dict: Optional[bool] = None,
850
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
851
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
852
+ output_hidden_states = (
853
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
854
+ )
855
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
856
+
857
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
858
+
859
+ # retrieve input_ids and inputs_embeds
860
+ if input_ids is not None and inputs_embeds is not None:
861
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
862
+ elif input_ids is not None:
863
+ batch_size, seq_length = input_ids.shape[:2]
864
+ elif inputs_embeds is not None:
865
+ batch_size, seq_length = inputs_embeds.shape[:2]
866
+ else:
867
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
868
+
869
+ past_key_values_length = 0
870
+
871
+ if self.gradient_checkpointing and self.training:
872
+ if use_cache:
873
+ logger.warning_once(
874
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
875
+ )
876
+ use_cache = False
877
+
878
+ if use_cache:
879
+ use_legacy_cache = not isinstance(past_key_values, Cache)
880
+ if use_legacy_cache:
881
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
882
+ past_key_values_length = past_key_values.get_usable_length(seq_length)
883
+
884
+ if position_ids is None:
885
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
886
+ position_ids = torch.arange(
887
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
888
+ )
889
+ position_ids = position_ids.unsqueeze(0)
890
+
891
+ if inputs_embeds is None:
892
+ inputs_embeds = self.embed_tokens(input_ids)
893
+
894
+ inputs_embeds = self.embed_dropout(inputs_embeds)
895
+
896
+ # Attention mask.
897
+ if self._use_flash_attention_2:
898
+ # 2d mask is passed through the layers
899
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
900
+ else:
901
+ # 4d mask is passed through the layers
902
+ attention_mask = _prepare_4d_causal_attention_mask(
903
+ attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length
904
+ )
905
+
906
+ hidden_states = inputs_embeds
907
+
908
+ # decoder layers
909
+ all_hidden_states = () if output_hidden_states else None
910
+ all_self_attns = () if output_attentions else None
911
+ next_decoder_cache = None
912
+
913
+ for decoder_layer in self.layers:
914
+ if output_hidden_states:
915
+ all_hidden_states += (hidden_states,)
916
+
917
+ if self.gradient_checkpointing and self.training:
918
+ layer_outputs = self._gradient_checkpointing_func(
919
+ decoder_layer.__call__,
920
+ hidden_states,
921
+ attention_mask,
922
+ position_ids,
923
+ past_key_values,
924
+ output_attentions,
925
+ )
926
+ else:
927
+ layer_outputs = decoder_layer(
928
+ hidden_states,
929
+ attention_mask=attention_mask,
930
+ position_ids=position_ids,
931
+ past_key_value=past_key_values,
932
+ output_attentions=output_attentions,
933
+ use_cache=use_cache,
934
+ )
935
+
936
+ hidden_states = layer_outputs[0]
937
+
938
+ if use_cache:
939
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
940
+
941
+ if output_attentions:
942
+ all_self_attns += (layer_outputs[1],)
943
+
944
+ hidden_states = self.final_layernorm(hidden_states)
945
+
946
+ # add hidden states from the last decoder layer
947
+ if output_hidden_states:
948
+ all_hidden_states += (hidden_states,)
949
+
950
+ next_cache = None
951
+ if use_cache:
952
+ next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
953
+ if not return_dict:
954
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
955
+ return BaseModelOutputWithPast(
956
+ last_hidden_state=hidden_states,
957
+ past_key_values=next_cache,
958
+ hidden_states=all_hidden_states,
959
+ attentions=all_self_attns,
960
+ )
961
+
962
+
963
+ class BoomerForCausalLM(BoomerPreTrainedModel):
964
+ _tied_weights_keys = ["lm_head.weight"]
965
+
966
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.__init__ with Llama->Boomer,bias=False->bias=True
967
+ def __init__(self, config):
968
+ super().__init__(config)
969
+ self.model = BoomerModel(config)
970
+ self.vocab_size = config.vocab_size
971
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=True)
972
+
973
+ # Initialize weights and apply final processing
974
+ self.post_init()
975
+
976
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_input_embeddings
977
+ def get_input_embeddings(self):
978
+ return self.model.embed_tokens
979
+
980
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_input_embeddings
981
+ def set_input_embeddings(self, value):
982
+ self.model.embed_tokens = value
983
+
984
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_output_embeddings
985
+ def get_output_embeddings(self):
986
+ return self.lm_head
987
+
988
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_output_embeddings
989
+ def set_output_embeddings(self, new_embeddings):
990
+ self.lm_head = new_embeddings
991
+
992
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_decoder
993
+ def set_decoder(self, decoder):
994
+ self.model = decoder
995
+
996
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_decoder
997
+ def get_decoder(self):
998
+ return self.model
999
+
1000
+ @add_start_docstrings_to_model_forward(BOOMER_INPUTS_DOCSTRING)
1001
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1002
+ def forward(
1003
+ self,
1004
+ input_ids: torch.LongTensor = None,
1005
+ attention_mask: Optional[torch.Tensor] = None,
1006
+ position_ids: Optional[torch.LongTensor] = None,
1007
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1008
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1009
+ labels: Optional[torch.LongTensor] = None,
1010
+ use_cache: Optional[bool] = None,
1011
+ output_attentions: Optional[bool] = None,
1012
+ output_hidden_states: Optional[bool] = None,
1013
+ return_dict: Optional[bool] = None,
1014
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1015
+ r"""
1016
+ Args:
1017
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1018
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1019
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1020
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1021
+
1022
+ Returns:
1023
+
1024
+
1025
+ ```"""
1026
+
1027
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1028
+ output_hidden_states = (
1029
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1030
+ )
1031
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1032
+
1033
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1034
+ outputs = self.model(
1035
+ input_ids=input_ids,
1036
+ attention_mask=attention_mask,
1037
+ position_ids=position_ids,
1038
+ past_key_values=past_key_values,
1039
+ inputs_embeds=inputs_embeds,
1040
+ use_cache=use_cache,
1041
+ output_attentions=output_attentions,
1042
+ output_hidden_states=output_hidden_states,
1043
+ return_dict=return_dict,
1044
+ )
1045
+
1046
+ hidden_states = outputs[0]
1047
+ logits = self.lm_head(hidden_states)
1048
+ logits = logits.float()
1049
+
1050
+ loss = None
1051
+ if labels is not None:
1052
+ # Shift so that tokens < n predict n
1053
+ shift_logits = logits[..., :-1, :].contiguous()
1054
+ shift_labels = labels[..., 1:].contiguous()
1055
+ # Flatten the tokens
1056
+ loss_fct = CrossEntropyLoss()
1057
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1058
+ shift_labels = shift_labels.view(-1)
1059
+ # Enable model parallelism
1060
+ shift_labels = shift_labels.to(shift_logits.device)
1061
+ loss = loss_fct(shift_logits, shift_labels)
1062
+
1063
+ if not return_dict:
1064
+ output = (logits,) + outputs[1:]
1065
+ return (loss,) + output if loss is not None else output
1066
+
1067
+ return CausalLMOutputWithPast(
1068
+ loss=loss,
1069
+ logits=logits,
1070
+ past_key_values=outputs.past_key_values,
1071
+ hidden_states=outputs.hidden_states,
1072
+ attentions=outputs.attentions,
1073
+ )
1074
+
1075
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.prepare_inputs_for_generation
1076
+ def prepare_inputs_for_generation(
1077
+ self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
1078
+ ):
1079
+ if past_key_values is not None:
1080
+ if isinstance(past_key_values, Cache):
1081
+ cache_length = past_key_values.get_seq_length()
1082
+ past_length = past_key_values.seen_tokens
1083
+ max_cache_length = past_key_values.get_max_length()
1084
+ else:
1085
+ cache_length = past_length = past_key_values[0][0].shape[2]
1086
+ max_cache_length = None
1087
+
1088
+ # Keep only the unprocessed tokens:
1089
+ # 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
1090
+ # some of the inputs are exclusively passed as part of the cache (e.g. when passing input_embeds as
1091
+ # input)
1092
+ if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
1093
+ input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
1094
+ # 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
1095
+ # input_ids based on the past_length.
1096
+ elif past_length < input_ids.shape[1]:
1097
+ input_ids = input_ids[:, past_length:]
1098
+ # 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
1099
+
1100
+ # If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
1101
+ if (
1102
+ max_cache_length is not None
1103
+ and attention_mask is not None
1104
+ and cache_length + input_ids.shape[1] > max_cache_length
1105
+ ):
1106
+ attention_mask = attention_mask[:, -max_cache_length:]
1107
+
1108
+ position_ids = kwargs.get("position_ids", None)
1109
+ if attention_mask is not None and position_ids is None:
1110
+ # create position_ids on the fly for batch generation
1111
+ position_ids = attention_mask.long().cumsum(-1) - 1
1112
+ position_ids.masked_fill_(attention_mask == 0, 1)
1113
+ if past_key_values:
1114
+ position_ids = position_ids[:, -input_ids.shape[1] :]
1115
+
1116
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
1117
+ if inputs_embeds is not None and past_key_values is None:
1118
+ model_inputs = {"inputs_embeds": inputs_embeds}
1119
+ else:
1120
+ model_inputs = {"input_ids": input_ids}
1121
+
1122
+ model_inputs.update(
1123
+ {
1124
+ "position_ids": position_ids,
1125
+ "past_key_values": past_key_values,
1126
+ "use_cache": kwargs.get("use_cache"),
1127
+ "attention_mask": attention_mask,
1128
+ }
1129
+ )
1130
+ return model_inputs
1131
+
1132
+ @staticmethod
1133
+ # Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM._reorder_cache
1134
+ def _reorder_cache(past_key_values, beam_idx):
1135
+ reordered_past = ()
1136
+ for layer_past in past_key_values:
1137
+ reordered_past += (
1138
+ tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
1139
+ )
1140
+ return reordered_past
1141
+
1142
+
1143
+ @add_start_docstrings(
1144
+ """
1145
+ The BoomerModel with a sequence classification head on top (linear layer).
1146
+
1147
+ [`BoomerForSequenceClassification`] uses the last token in order to do the classification, as other causal models
1148
+ (e.g. GPT-2) do.
1149
+
1150
+ Since it does classification on the last token, it requires to know the position of the last token. If a
1151
+ `pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
1152
+ no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
1153
+ padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
1154
+ each row of the batch).
1155
+ """,
1156
+ BOOMER_START_DOCSTRING,
1157
+ )
1158
+ # Copied from transformers.models.llama.modeling_llama.LlamaForSequenceClassification with LLAMA->BOOMER,Llama->Boomer with self.transformer->self.model, transformer_outputs->model_outputs
1159
+ class BoomerForSequenceClassification(BoomerPreTrainedModel):
1160
+ def __init__(self, config):
1161
+ super().__init__(config)
1162
+ self.num_labels = config.num_labels
1163
+ self.model = BoomerModel(config)
1164
+ self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
1165
+
1166
+ # Initialize weights and apply final processing
1167
+ self.post_init()
1168
+
1169
+ def get_input_embeddings(self):
1170
+ return self.model.embed_tokens
1171
+
1172
+ def set_input_embeddings(self, value):
1173
+ self.model.embed_tokens = value
1174
+
1175
+ @add_start_docstrings_to_model_forward(BOOMER_INPUTS_DOCSTRING)
1176
+ def forward(
1177
+ self,
1178
+ input_ids: torch.LongTensor = None,
1179
+ attention_mask: Optional[torch.Tensor] = None,
1180
+ position_ids: Optional[torch.LongTensor] = None,
1181
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1182
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1183
+ labels: Optional[torch.LongTensor] = None,
1184
+ use_cache: Optional[bool] = None,
1185
+ output_attentions: Optional[bool] = None,
1186
+ output_hidden_states: Optional[bool] = None,
1187
+ return_dict: Optional[bool] = None,
1188
+ ) -> Union[Tuple, SequenceClassifierOutputWithPast]:
1189
+ r"""
1190
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1191
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1192
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1193
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1194
+ """
1195
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1196
+
1197
+ model_outputs = self.model(
1198
+ input_ids,
1199
+ attention_mask=attention_mask,
1200
+ position_ids=position_ids,
1201
+ past_key_values=past_key_values,
1202
+ inputs_embeds=inputs_embeds,
1203
+ use_cache=use_cache,
1204
+ output_attentions=output_attentions,
1205
+ output_hidden_states=output_hidden_states,
1206
+ return_dict=return_dict,
1207
+ )
1208
+ hidden_states = model_outputs[0]
1209
+ logits = self.score(hidden_states)
1210
+
1211
+ if input_ids is not None:
1212
+ batch_size = input_ids.shape[0]
1213
+ else:
1214
+ batch_size = inputs_embeds.shape[0]
1215
+
1216
+ if self.config.pad_token_id is None and batch_size != 1:
1217
+ raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
1218
+ if self.config.pad_token_id is None:
1219
+ sequence_lengths = -1
1220
+ else:
1221
+ if input_ids is not None:
1222
+ # if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
1223
+ sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
1224
+ sequence_lengths = sequence_lengths % input_ids.shape[-1]
1225
+ sequence_lengths = sequence_lengths.to(logits.device)
1226
+ else:
1227
+ sequence_lengths = -1
1228
+
1229
+ pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
1230
+
1231
+ loss = None
1232
+ if labels is not None:
1233
+ labels = labels.to(logits.device)
1234
+ if self.config.problem_type is None:
1235
+ if self.num_labels == 1:
1236
+ self.config.problem_type = "regression"
1237
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1238
+ self.config.problem_type = "single_label_classification"
1239
+ else:
1240
+ self.config.problem_type = "multi_label_classification"
1241
+
1242
+ if self.config.problem_type == "regression":
1243
+ loss_fct = MSELoss()
1244
+ if self.num_labels == 1:
1245
+ loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
1246
+ else:
1247
+ loss = loss_fct(pooled_logits, labels)
1248
+ elif self.config.problem_type == "single_label_classification":
1249
+ loss_fct = CrossEntropyLoss()
1250
+ loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
1251
+ elif self.config.problem_type == "multi_label_classification":
1252
+ loss_fct = BCEWithLogitsLoss()
1253
+ loss = loss_fct(pooled_logits, labels)
1254
+ if not return_dict:
1255
+ output = (pooled_logits,) + model_outputs[1:]
1256
+ return ((loss,) + output) if loss is not None else output
1257
+
1258
+ return SequenceClassifierOutputWithPast(
1259
+ loss=loss,
1260
+ logits=pooled_logits,
1261
+ past_key_values=model_outputs.past_key_values,
1262
+ hidden_states=model_outputs.hidden_states,
1263
+ attentions=model_outputs.attentions,
1264
+ )
1265
+
1266
+
1267
+ @add_start_docstrings(
1268
+ """
1269
+ BoomerModel with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
1270
+ Named-Entity-Recognition (NER) tasks.
1271
+ """,
1272
+ BOOMER_START_DOCSTRING,
1273
+ )
1274
+ # Copied from transformers.models.mpt.modeling_mpt.MptForTokenClassification with MPT->BOOMER,Mpt->Boomer,self.transformer->self.model,transformer_outputs->model_outputs
1275
+ class BoomerForTokenClassification(BoomerPreTrainedModel):
1276
+ def __init__(self, config: BoomerConfig):
1277
+ super().__init__(config)
1278
+ self.num_labels = config.num_labels
1279
+
1280
+ self.model = BoomerModel(config)
1281
+ if hasattr(config, "classifier_dropout") and config.classifier_dropout is not None:
1282
+ classifier_dropout = config.classifier_dropout
1283
+ elif hasattr(config, "hidden_dropout") and config.hidden_dropout is not None:
1284
+ classifier_dropout = config.hidden_dropout
1285
+ else:
1286
+ classifier_dropout = 0.1
1287
+ self.dropout = nn.Dropout(classifier_dropout)
1288
+ self.classifier = nn.Linear(config.hidden_size, config.num_labels)
1289
+
1290
+ # Initialize weights and apply final processing
1291
+ self.post_init()
1292
+
1293
+ @add_start_docstrings_to_model_forward(BOOMER_INPUTS_DOCSTRING)
1294
+ @add_code_sample_docstrings(
1295
+ checkpoint=_CHECKPOINT_FOR_DOC,
1296
+ output_type=TokenClassifierOutput,
1297
+ config_class=_CONFIG_FOR_DOC,
1298
+ )
1299
+ def forward(
1300
+ self,
1301
+ input_ids: Optional[torch.LongTensor] = None,
1302
+ past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
1303
+ attention_mask: Optional[torch.Tensor] = None,
1304
+ inputs_embeds: Optional[torch.Tensor] = None,
1305
+ labels: Optional[torch.Tensor] = None,
1306
+ use_cache: Optional[bool] = None,
1307
+ output_attentions: Optional[bool] = None,
1308
+ output_hidden_states: Optional[bool] = None,
1309
+ return_dict: Optional[bool] = None,
1310
+ **deprecated_arguments,
1311
+ ) -> Union[Tuple[torch.Tensor], TokenClassifierOutput]:
1312
+ r"""
1313
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1314
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1315
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1316
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1317
+ """
1318
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1319
+
1320
+ model_outputs = self.model(
1321
+ input_ids,
1322
+ past_key_values=past_key_values,
1323
+ attention_mask=attention_mask,
1324
+ inputs_embeds=inputs_embeds,
1325
+ use_cache=use_cache,
1326
+ output_attentions=output_attentions,
1327
+ output_hidden_states=output_hidden_states,
1328
+ return_dict=return_dict,
1329
+ )
1330
+
1331
+ hidden_states = model_outputs[0]
1332
+ hidden_states = self.dropout(hidden_states)
1333
+ logits = self.classifier(hidden_states)
1334
+
1335
+ loss = None
1336
+ if labels is not None:
1337
+ # move labels to correct device to enable model parallelism
1338
+ labels = labels.to(logits.device)
1339
+ batch_size, seq_length = labels.shape
1340
+ loss_fct = CrossEntropyLoss()
1341
+ loss = loss_fct(
1342
+ logits.view(batch_size * seq_length, self.num_labels), labels.view(batch_size * seq_length)
1343
+ )
1344
+
1345
+ if not return_dict:
1346
+ output = (logits,) + model_outputs[2:]
1347
+ return ((loss,) + output) if loss is not None else output
1348
+
1349
+ return TokenClassifierOutput(
1350
+ loss=loss,
1351
+ logits=logits,
1352
+ hidden_states=model_outputs.hidden_states,
1353
+ attentions=model_outputs.attentions,
1354
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|endoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|endoftext|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "!",
17
+ "unk_token": {
18
+ "content": "<|endoftext|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "50256": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "50257": {
13
+ "content": " ",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": false
19
+ },
20
+ "50258": {
21
+ "content": " ",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": false
27
+ },
28
+ "50259": {
29
+ "content": " ",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": false
35
+ },
36
+ "50260": {
37
+ "content": " ",
38
+ "lstrip": false,
39
+ "normalized": true,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": false
43
+ },
44
+ "50261": {
45
+ "content": " ",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": false
51
+ },
52
+ "50262": {
53
+ "content": " ",
54
+ "lstrip": false,
55
+ "normalized": true,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": false
59
+ },
60
+ "50263": {
61
+ "content": " ",
62
+ "lstrip": false,
63
+ "normalized": true,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": false
67
+ },
68
+ "50264": {
69
+ "content": " ",
70
+ "lstrip": false,
71
+ "normalized": true,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": false
75
+ },
76
+ "50265": {
77
+ "content": " ",
78
+ "lstrip": false,
79
+ "normalized": true,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": false
83
+ },
84
+ "50266": {
85
+ "content": " ",
86
+ "lstrip": false,
87
+ "normalized": true,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": false
91
+ },
92
+ "50267": {
93
+ "content": " ",
94
+ "lstrip": false,
95
+ "normalized": true,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": false
99
+ },
100
+ "50268": {
101
+ "content": " ",
102
+ "lstrip": false,
103
+ "normalized": true,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": false
107
+ },
108
+ "50269": {
109
+ "content": " ",
110
+ "lstrip": false,
111
+ "normalized": true,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": false
115
+ },
116
+ "50270": {
117
+ "content": " ",
118
+ "lstrip": false,
119
+ "normalized": true,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": false
123
+ },
124
+ "50271": {
125
+ "content": " ",
126
+ "lstrip": false,
127
+ "normalized": true,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": false
131
+ },
132
+ "50272": {
133
+ "content": " ",
134
+ "lstrip": false,
135
+ "normalized": true,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": false
139
+ },
140
+ "50273": {
141
+ "content": " ",
142
+ "lstrip": false,
143
+ "normalized": true,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": false
147
+ },
148
+ "50274": {
149
+ "content": " ",
150
+ "lstrip": false,
151
+ "normalized": true,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": false
155
+ },
156
+ "50275": {
157
+ "content": " ",
158
+ "lstrip": false,
159
+ "normalized": true,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": false
163
+ },
164
+ "50276": {
165
+ "content": " ",
166
+ "lstrip": false,
167
+ "normalized": true,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": false
171
+ },
172
+ "50277": {
173
+ "content": " ",
174
+ "lstrip": false,
175
+ "normalized": true,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": false
179
+ },
180
+ "50278": {
181
+ "content": " ",
182
+ "lstrip": false,
183
+ "normalized": true,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": false
187
+ },
188
+ "50279": {
189
+ "content": " ",
190
+ "lstrip": false,
191
+ "normalized": true,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": false
195
+ },
196
+ "50280": {
197
+ "content": " ",
198
+ "lstrip": false,
199
+ "normalized": true,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": false
203
+ },
204
+ "50281": {
205
+ "content": " ",
206
+ "lstrip": false,
207
+ "normalized": true,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": false
211
+ },
212
+ "50282": {
213
+ "content": " ",
214
+ "lstrip": false,
215
+ "normalized": true,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": false
219
+ },
220
+ "50283": {
221
+ "content": " ",
222
+ "lstrip": false,
223
+ "normalized": true,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": false
227
+ },
228
+ "50284": {
229
+ "content": " ",
230
+ "lstrip": false,
231
+ "normalized": true,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": false
235
+ },
236
+ "50285": {
237
+ "content": " ",
238
+ "lstrip": false,
239
+ "normalized": true,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": false
243
+ },
244
+ "50286": {
245
+ "content": " ",
246
+ "lstrip": false,
247
+ "normalized": true,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": false
251
+ },
252
+ "50287": {
253
+ "content": "\t\t\t\t\t\t\t\t\t",
254
+ "lstrip": false,
255
+ "normalized": true,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": false
259
+ },
260
+ "50288": {
261
+ "content": "\t\t\t\t\t\t\t\t",
262
+ "lstrip": false,
263
+ "normalized": true,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": false
267
+ },
268
+ "50289": {
269
+ "content": "\t\t\t\t\t\t\t",
270
+ "lstrip": false,
271
+ "normalized": true,
272
+ "rstrip": false,
273
+ "single_word": false,
274
+ "special": false
275
+ },
276
+ "50290": {
277
+ "content": "\t\t\t\t\t\t",
278
+ "lstrip": false,
279
+ "normalized": true,
280
+ "rstrip": false,
281
+ "single_word": false,
282
+ "special": false
283
+ },
284
+ "50291": {
285
+ "content": "\t\t\t\t\t",
286
+ "lstrip": false,
287
+ "normalized": true,
288
+ "rstrip": false,
289
+ "single_word": false,
290
+ "special": false
291
+ },
292
+ "50292": {
293
+ "content": "\t\t\t\t",
294
+ "lstrip": false,
295
+ "normalized": true,
296
+ "rstrip": false,
297
+ "single_word": false,
298
+ "special": false
299
+ },
300
+ "50293": {
301
+ "content": "\t\t\t",
302
+ "lstrip": false,
303
+ "normalized": true,
304
+ "rstrip": false,
305
+ "single_word": false,
306
+ "special": false
307
+ },
308
+ "50294": {
309
+ "content": "\t\t",
310
+ "lstrip": false,
311
+ "normalized": true,
312
+ "rstrip": false,
313
+ "single_word": false,
314
+ "special": false
315
+ }
316
+ },
317
+ "bos_token": "<|endoftext|>",
318
+ "clean_up_tokenization_spaces": true,
319
+ "eos_token": "<|endoftext|>",
320
+ "model_max_length": 2048,
321
+ "pad_token": "!",
322
+ "tokenizer_class": "CodeGenTokenizer",
323
+ "unk_token": "<|endoftext|>"
324
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:597f99bde58a4960d1c3579841da52fc1197cd354ac88da86abe4a186d36f75b
3
+ size 5944
vocab.json ADDED
The diff for this file is too large to render. See raw diff