dongseokmotif commited on
Commit
7c98c2b
·
1 Parent(s): 99f45a5

upload model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -28,7 +28,7 @@ All models listed in the table below are **base models**. *The results of Qwen3
28
  |BBH|3-shot, CoT|81.34|81.07|87.38|81.54|-|-|
29
  |GPQA|5-shot, CoT|42.18|39.9|49.49|43.94|-|-|
30
  |GPQA-Diamond|5-shot, CoT|42.92|-|-|-|25.4|24.3|
31
- |GSM8K|5-shot, CoT|93.85|92.49|93.4|91.81|-|-|
32
  |GSM8K|8-shot, CoT|94.92|-|-|-|71|82.6|
33
  |MATH|4-shot, CoT|73.62|62.02|61.62|59.04|43.3|50|
34
  |EvalPlus|0-shot|72.22|72.23|72.05|71.45|-|-|
 
28
  |BBH|3-shot, CoT|81.34|81.07|87.38|81.54|-|-|
29
  |GPQA|5-shot, CoT|42.18|39.9|49.49|43.94|-|-|
30
  |GPQA-Diamond|5-shot, CoT|42.92|-|-|-|25.4|24.3|
31
+ |GSM8K|4-shot, CoT|93.85|92.49|93.4|91.81|-|-|
32
  |GSM8K|8-shot, CoT|94.92|-|-|-|71|82.6|
33
  |MATH|4-shot, CoT|73.62|62.02|61.62|59.04|43.3|50|
34
  |EvalPlus|0-shot|72.22|72.23|72.05|71.45|-|-|
added_tokens.json ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|assistant|>": 219402,
3
+ "<|beginoftext|>": 219396,
4
+ "<|dummy_id_100|>": 219505,
5
+ "<|dummy_id_101|>": 219506,
6
+ "<|dummy_id_102|>": 219507,
7
+ "<|dummy_id_103|>": 219508,
8
+ "<|dummy_id_104|>": 219509,
9
+ "<|dummy_id_105|>": 219510,
10
+ "<|dummy_id_106|>": 219511,
11
+ "<|dummy_id_107|>": 219512,
12
+ "<|dummy_id_108|>": 219513,
13
+ "<|dummy_id_109|>": 219514,
14
+ "<|dummy_id_10|>": 219414,
15
+ "<|dummy_id_110|>": 219515,
16
+ "<|dummy_id_111|>": 219516,
17
+ "<|dummy_id_112|>": 219517,
18
+ "<|dummy_id_113|>": 219518,
19
+ "<|dummy_id_114|>": 219519,
20
+ "<|dummy_id_11|>": 219415,
21
+ "<|dummy_id_12|>": 219417,
22
+ "<|dummy_id_13|>": 219418,
23
+ "<|dummy_id_14|>": 219419,
24
+ "<|dummy_id_15|>": 219420,
25
+ "<|dummy_id_16|>": 219421,
26
+ "<|dummy_id_17|>": 219422,
27
+ "<|dummy_id_18|>": 219423,
28
+ "<|dummy_id_19|>": 219424,
29
+ "<|dummy_id_1|>": 219404,
30
+ "<|dummy_id_20|>": 219425,
31
+ "<|dummy_id_21|>": 219426,
32
+ "<|dummy_id_22|>": 219427,
33
+ "<|dummy_id_23|>": 219428,
34
+ "<|dummy_id_24|>": 219429,
35
+ "<|dummy_id_25|>": 219430,
36
+ "<|dummy_id_26|>": 219431,
37
+ "<|dummy_id_27|>": 219432,
38
+ "<|dummy_id_28|>": 219433,
39
+ "<|dummy_id_29|>": 219434,
40
+ "<|dummy_id_2|>": 219406,
41
+ "<|dummy_id_30|>": 219435,
42
+ "<|dummy_id_31|>": 219436,
43
+ "<|dummy_id_32|>": 219437,
44
+ "<|dummy_id_33|>": 219438,
45
+ "<|dummy_id_34|>": 219439,
46
+ "<|dummy_id_35|>": 219440,
47
+ "<|dummy_id_36|>": 219441,
48
+ "<|dummy_id_37|>": 219442,
49
+ "<|dummy_id_38|>": 219443,
50
+ "<|dummy_id_39|>": 219444,
51
+ "<|dummy_id_3|>": 219407,
52
+ "<|dummy_id_40|>": 219445,
53
+ "<|dummy_id_41|>": 219446,
54
+ "<|dummy_id_42|>": 219447,
55
+ "<|dummy_id_43|>": 219448,
56
+ "<|dummy_id_44|>": 219449,
57
+ "<|dummy_id_45|>": 219450,
58
+ "<|dummy_id_46|>": 219451,
59
+ "<|dummy_id_47|>": 219452,
60
+ "<|dummy_id_48|>": 219453,
61
+ "<|dummy_id_49|>": 219454,
62
+ "<|dummy_id_4|>": 219408,
63
+ "<|dummy_id_50|>": 219455,
64
+ "<|dummy_id_51|>": 219456,
65
+ "<|dummy_id_52|>": 219457,
66
+ "<|dummy_id_53|>": 219458,
67
+ "<|dummy_id_54|>": 219459,
68
+ "<|dummy_id_55|>": 219460,
69
+ "<|dummy_id_56|>": 219461,
70
+ "<|dummy_id_57|>": 219462,
71
+ "<|dummy_id_58|>": 219463,
72
+ "<|dummy_id_59|>": 219464,
73
+ "<|dummy_id_5|>": 219409,
74
+ "<|dummy_id_60|>": 219465,
75
+ "<|dummy_id_61|>": 219466,
76
+ "<|dummy_id_62|>": 219467,
77
+ "<|dummy_id_63|>": 219468,
78
+ "<|dummy_id_64|>": 219469,
79
+ "<|dummy_id_65|>": 219470,
80
+ "<|dummy_id_66|>": 219471,
81
+ "<|dummy_id_67|>": 219472,
82
+ "<|dummy_id_68|>": 219473,
83
+ "<|dummy_id_69|>": 219474,
84
+ "<|dummy_id_6|>": 219410,
85
+ "<|dummy_id_70|>": 219475,
86
+ "<|dummy_id_71|>": 219476,
87
+ "<|dummy_id_72|>": 219477,
88
+ "<|dummy_id_73|>": 219478,
89
+ "<|dummy_id_74|>": 219479,
90
+ "<|dummy_id_75|>": 219480,
91
+ "<|dummy_id_76|>": 219481,
92
+ "<|dummy_id_77|>": 219482,
93
+ "<|dummy_id_78|>": 219483,
94
+ "<|dummy_id_79|>": 219484,
95
+ "<|dummy_id_7|>": 219411,
96
+ "<|dummy_id_80|>": 219485,
97
+ "<|dummy_id_81|>": 219486,
98
+ "<|dummy_id_82|>": 219487,
99
+ "<|dummy_id_83|>": 219488,
100
+ "<|dummy_id_84|>": 219489,
101
+ "<|dummy_id_85|>": 219490,
102
+ "<|dummy_id_86|>": 219491,
103
+ "<|dummy_id_87|>": 219492,
104
+ "<|dummy_id_88|>": 219493,
105
+ "<|dummy_id_89|>": 219494,
106
+ "<|dummy_id_8|>": 219412,
107
+ "<|dummy_id_90|>": 219495,
108
+ "<|dummy_id_91|>": 219496,
109
+ "<|dummy_id_92|>": 219497,
110
+ "<|dummy_id_93|>": 219498,
111
+ "<|dummy_id_94|>": 219499,
112
+ "<|dummy_id_95|>": 219500,
113
+ "<|dummy_id_96|>": 219501,
114
+ "<|dummy_id_97|>": 219502,
115
+ "<|dummy_id_98|>": 219503,
116
+ "<|dummy_id_99|>": 219504,
117
+ "<|dummy_id_9|>": 219413,
118
+ "<|endofprompt|>": 219416,
119
+ "<|endoftext|>": 219395,
120
+ "<|endofturn|>": 219405,
121
+ "<|fim_middle|>": 219398,
122
+ "<|fim_prefix|>": 219397,
123
+ "<|fim_suffix|>": 219399,
124
+ "<|startofturn|>": 219403,
125
+ "<|system|>": 219400,
126
+ "<|user|>": 219401
127
+ }
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "absolute_position_embedding": false,
3
+ "architectures": [
4
+ "MotifForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "attn_rms_norm_eps": 1e-05,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_motif.MotifConfig",
10
+ "AutoModelForCausalLM": "modeling_motif.MotifForCausalLM"
11
+ },
12
+ "bfloat16": true,
13
+ "bos_token_id": 219396,
14
+ "decoder_split_layers": [],
15
+ "encoder_split_layers": [],
16
+ "eos_token_id": 219395,
17
+ "expanded": true,
18
+ "fused_rope": false,
19
+ "head_dim": 128,
20
+ "hidden_act": "poly_norm",
21
+ "hidden_size": 4096,
22
+ "initializer_range": 2e-05,
23
+ "intermediate_size": 16384,
24
+ "load_pretrained": null,
25
+ "loss_reduction": "mean",
26
+ "max_position_embeddings": 32768,
27
+ "max_window_layers": 28,
28
+ "model_type": "Motif",
29
+ "num_attention_heads": 40,
30
+ "num_hidden_layers": 40,
31
+ "num_key_value_heads": 16,
32
+ "num_noise_heads": 8,
33
+ "k_ratio": 1,
34
+ "rms_norm_eps": 1e-06,
35
+ "rope_scaling": null,
36
+ "rope_theta": 1000000.0,
37
+ "sliding_window": null,
38
+ "tie_word_embeddings": false,
39
+ "torch_dtype": "float32",
40
+ "transformers_version": "4.55.0",
41
+ "use_bias": false,
42
+ "use_cache": true,
43
+ "use_moreh_attention": false,
44
+ "use_pipeline": false,
45
+ "use_sliding_window": false,
46
+ "vocab_size": 219520
47
+ }
configuration_motif.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ from typing import Optional
3
+
4
+ from transformers.configuration_utils import PretrainedConfig
5
+ from transformers.modeling_rope_utils import rope_config_validation
6
+ from transformers.utils import logging
7
+
8
+ logger = logging.get_logger(__name__)
9
+
10
+
11
+ class MotifConfig(PretrainedConfig):
12
+ r"""
13
+ This is the configuration class to store the configuration of a [`MotifModel`]. It is used to instantiate a
14
+ Motif model according to the specified arguments, defining the model architecture. Instantiating a configuration
15
+ with the defaults will yield a similar configuration to that of
16
+ Motif-102B [moreh/Motif-102B](https://huggingface.co/moreh/Motif-102B).
17
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
18
+ documentation from [`PretrainedConfig`] for more information.
19
+ Args:
20
+ vocab_size (`int`, *optional*, defaults to 151936):
21
+ Vocabulary size of the Motif model. Defines the number of different tokens that can be represented by the
22
+ `inputs_ids` passed when calling [`MotifModel`]
23
+ hidden_size (`int`, *optional*, defaults to 4096):
24
+ Dimension of the hidden representations.
25
+ intermediate_size (`int`, *optional*, defaults to 22016):
26
+ Dimension of the MLP representations.
27
+ num_hidden_layers (`int`, *optional*, defaults to 32):
28
+ Number of hidden layers in the Transformer encoder.
29
+ num_attention_heads (`int`, *optional*, defaults to 32):
30
+ Number of attention heads for each attention layer in the Transformer encoder.
31
+ num_key_value_heads (`int`, *optional*, defaults to 32):
32
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
33
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
34
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
35
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
36
+ by meanpooling all the original heads within that group. For more details checkout [this
37
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
38
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
39
+ The non-linear activation function (function or string) in the decoder.
40
+ max_position_embeddings (`int`, *optional*, defaults to 32768):
41
+ The maximum sequence length that this model might ever be used with.
42
+ initializer_range (`float`, *optional*, defaults to 0.02):
43
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
44
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
45
+ The epsilon used by the rms normalization layers.
46
+ use_cache (`bool`, *optional*, defaults to `True`):
47
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
48
+ relevant if `config.is_decoder=True`.
49
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
50
+ Whether the model's input and output word embeddings should be tied.
51
+ rope_theta (`float`, *optional*, defaults to 10000.0):
52
+ The base period of the RoPE embeddings.
53
+ rope_scaling (`Dict`, *optional*):
54
+ Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
55
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
56
+ accordingly.
57
+ Expected contents:
58
+ `rope_type` (`str`):
59
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
60
+ 'llama3'], with 'default' being the original RoPE implementation.
61
+ `factor` (`float`, *optional*):
62
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
63
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
64
+ original maximum pre-trained length.
65
+ `original_max_position_embeddings` (`int`, *optional*):
66
+ Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
67
+ pretraining.
68
+ `attention_factor` (`float`, *optional*):
69
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
70
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
71
+ `factor` field to infer the suggested value.
72
+ `beta_fast` (`float`, *optional*):
73
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
74
+ ramp function. If unspecified, it defaults to 32.
75
+ `beta_slow` (`float`, *optional*):
76
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
77
+ ramp function. If unspecified, it defaults to 1.
78
+ `short_factor` (`List[float]`, *optional*):
79
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
80
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
81
+ size divided by the number of attention heads divided by 2
82
+ `long_factor` (`List[float]`, *optional*):
83
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
84
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
85
+ size divided by the number of attention heads divided by 2
86
+ `low_freq_factor` (`float`, *optional*):
87
+ Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
88
+ `high_freq_factor` (`float`, *optional*):
89
+ Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
90
+ use_sliding_window (`bool`, *optional*, defaults to `False`):
91
+ Whether to use sliding window attention.
92
+ sliding_window (`int`, *optional*, defaults to 4096):
93
+ Sliding window attention (SWA) window size. If not specified, will default to `4096`.
94
+ max_window_layers (`int`, *optional*, defaults to 28):
95
+ The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.
96
+ attention_dropout (`float`, *optional*, defaults to 0.0):
97
+ The dropout ratio for the attention probabilities.
98
+ ```python
99
+ >>> from transformers import MotifModel, MotifConfig
100
+ >>> # Initializing a Motif style configuration
101
+ >>> configuration = MotifConfig()
102
+ >>> # Initializing a model from the Motif-102B style configuration
103
+ >>> model = MotifModel(configuration)
104
+ >>> # Accessing the model configuration
105
+ >>> configuration = model.config
106
+ ```"""
107
+
108
+ model_type = "Motif"
109
+ keys_to_ignore_at_inference = ["past_key_values"]
110
+
111
+ def __init__(
112
+ self,
113
+ vocab_size=151936,
114
+ hidden_size=4096,
115
+ intermediate_size=22016,
116
+ num_hidden_layers=32,
117
+ num_attention_heads=32,
118
+ num_key_value_heads=32,
119
+ hidden_act="silu",
120
+ max_position_embeddings=32768,
121
+ initializer_range=0.02,
122
+ rms_norm_eps=1e-6,
123
+ use_cache=True,
124
+ tie_word_embeddings=False,
125
+ rope_theta=10000.0,
126
+ rope_scaling=None,
127
+ use_sliding_window=False,
128
+ sliding_window=4096,
129
+ max_window_layers=28,
130
+ attention_dropout=0.0,
131
+ **kwargs,
132
+ ):
133
+
134
+ self.vocab_size = vocab_size
135
+ self.max_position_embeddings = max_position_embeddings
136
+ self.hidden_size = hidden_size
137
+ self.intermediate_size = intermediate_size
138
+ self.num_hidden_layers = num_hidden_layers
139
+ self.num_attention_heads = num_attention_heads
140
+ self.use_sliding_window = use_sliding_window
141
+ self.sliding_window = sliding_window if use_sliding_window else None
142
+ self.max_window_layers = max_window_layers
143
+
144
+ # for backward compatibility
145
+ if num_key_value_heads is None:
146
+ num_key_value_heads = num_attention_heads
147
+
148
+ self.num_key_value_heads = num_key_value_heads
149
+ self.hidden_act = hidden_act
150
+ self.initializer_range = initializer_range
151
+ self.rms_norm_eps = rms_norm_eps
152
+ self.use_cache = use_cache
153
+ self.rope_theta = rope_theta
154
+ self.rope_scaling = rope_scaling
155
+ self.attention_dropout = attention_dropout
156
+
157
+ # Validate the correctness of rotary position embeddings parameters
158
+ # BC: if there is a 'type' field, move it to 'rope_type'.
159
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
160
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
161
+ rope_config_validation(self)
162
+
163
+ super().__init__(
164
+ tie_word_embeddings=tie_word_embeddings,
165
+ **kwargs,
166
+ )
167
+ logger.info(f' kwargs : {kwargs}')
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 219396,
4
+ "eos_token_id": 219395,
5
+ "transformers_version": "4.56.2",
6
+ "use_cache": false
7
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe67699a04c009206358b131f5946f8f522a023d03e918d3839df1c842dd66c5
3
+ size 4972389224
model-00002-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c04307c332b0e4e1149e410126431a36ef977b1268e21ed7a06f7e2674af415b
3
+ size 4899097784
model-00003-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6aba9bc10fdf694a73b5e78e93ff583a852ed9f444c29ae183a0043e80aafa22
3
+ size 4915912176
model-00004-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf16233d8b2f49da48e9df06ac235977491895198dc9331d8fdefa5de06c25db
3
+ size 4899097848
model-00005-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91fef6c3aa8849c86fc809a104b394a47b1d271f204a220fac3a0aee7ba8faa6
3
+ size 4915912248
model-00006-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:647e4e8b33b5c65a7d46dcb9cef7fe7a4ca0e0aa1b4bac7c6bebebd76c57e27e
3
+ size 4899097848
model-00007-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7270d836dbdd7264d33d484f9c735898a11348dc506616935cd592588cd2282f
3
+ size 4915912248
model-00008-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3fe99f41212a377536ff1e58f15bd728379fd7e9068b109e286614d6a3b5b29
3
+ size 4899097848
model-00009-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b3a8fcffb3e4a6a8abdb9462b6d2a691c1b1141208efe829b265e5b1c19aa52
3
+ size 4915912248
model-00010-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4724ed8cd44951d7dd6c37cc608944c7e2cf7b1af16e9f58f9d36717d17a3db
3
+ size 2986469752
model-00011-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6eb1b0b244cb1194e2d85b5c391b27cfef10dbab4e11ec260b2ff718fc30b2b9
3
+ size 3596615808
model.safetensors.index.json ADDED
@@ -0,0 +1,651 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 12703860896,
4
+ "total_size": 50815443584
5
+ },
6
+ "weight_map": {
7
+ "lm_head.weight": "model-00011-of-00011.safetensors",
8
+ "model.embed_tokens.weight": "model-00001-of-00011.safetensors",
9
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00011.safetensors",
10
+ "model.layers.0.mlp.act_fn.bias": "model-00001-of-00011.safetensors",
11
+ "model.layers.0.mlp.act_fn.weight": "model-00001-of-00011.safetensors",
12
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00011.safetensors",
13
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00011.safetensors",
14
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00011.safetensors",
15
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00011.safetensors",
16
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00011.safetensors",
17
+ "model.layers.0.self_attn.lambda_k1": "model-00001-of-00011.safetensors",
18
+ "model.layers.0.self_attn.lambda_k2": "model-00001-of-00011.safetensors",
19
+ "model.layers.0.self_attn.lambda_q1": "model-00001-of-00011.safetensors",
20
+ "model.layers.0.self_attn.lambda_q2": "model-00001-of-00011.safetensors",
21
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00011.safetensors",
22
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00011.safetensors",
23
+ "model.layers.0.self_attn.subln.weight": "model-00001-of-00011.safetensors",
24
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00011.safetensors",
25
+ "model.layers.1.input_layernorm.weight": "model-00002-of-00011.safetensors",
26
+ "model.layers.1.mlp.act_fn.bias": "model-00002-of-00011.safetensors",
27
+ "model.layers.1.mlp.act_fn.weight": "model-00002-of-00011.safetensors",
28
+ "model.layers.1.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
29
+ "model.layers.1.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
30
+ "model.layers.1.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
31
+ "model.layers.1.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
32
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00011.safetensors",
33
+ "model.layers.1.self_attn.lambda_k1": "model-00001-of-00011.safetensors",
34
+ "model.layers.1.self_attn.lambda_k2": "model-00001-of-00011.safetensors",
35
+ "model.layers.1.self_attn.lambda_q1": "model-00001-of-00011.safetensors",
36
+ "model.layers.1.self_attn.lambda_q2": "model-00001-of-00011.safetensors",
37
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00011.safetensors",
38
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00011.safetensors",
39
+ "model.layers.1.self_attn.subln.weight": "model-00001-of-00011.safetensors",
40
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00011.safetensors",
41
+ "model.layers.10.input_layernorm.weight": "model-00004-of-00011.safetensors",
42
+ "model.layers.10.mlp.act_fn.bias": "model-00004-of-00011.safetensors",
43
+ "model.layers.10.mlp.act_fn.weight": "model-00004-of-00011.safetensors",
44
+ "model.layers.10.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
45
+ "model.layers.10.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
46
+ "model.layers.10.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
47
+ "model.layers.10.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
48
+ "model.layers.10.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
49
+ "model.layers.10.self_attn.lambda_k1": "model-00003-of-00011.safetensors",
50
+ "model.layers.10.self_attn.lambda_k2": "model-00003-of-00011.safetensors",
51
+ "model.layers.10.self_attn.lambda_q1": "model-00003-of-00011.safetensors",
52
+ "model.layers.10.self_attn.lambda_q2": "model-00003-of-00011.safetensors",
53
+ "model.layers.10.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
54
+ "model.layers.10.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
55
+ "model.layers.10.self_attn.subln.weight": "model-00003-of-00011.safetensors",
56
+ "model.layers.10.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
57
+ "model.layers.11.input_layernorm.weight": "model-00004-of-00011.safetensors",
58
+ "model.layers.11.mlp.act_fn.bias": "model-00004-of-00011.safetensors",
59
+ "model.layers.11.mlp.act_fn.weight": "model-00004-of-00011.safetensors",
60
+ "model.layers.11.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
61
+ "model.layers.11.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
62
+ "model.layers.11.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
63
+ "model.layers.11.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
64
+ "model.layers.11.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
65
+ "model.layers.11.self_attn.lambda_k1": "model-00004-of-00011.safetensors",
66
+ "model.layers.11.self_attn.lambda_k2": "model-00004-of-00011.safetensors",
67
+ "model.layers.11.self_attn.lambda_q1": "model-00004-of-00011.safetensors",
68
+ "model.layers.11.self_attn.lambda_q2": "model-00004-of-00011.safetensors",
69
+ "model.layers.11.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
70
+ "model.layers.11.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
71
+ "model.layers.11.self_attn.subln.weight": "model-00004-of-00011.safetensors",
72
+ "model.layers.11.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
73
+ "model.layers.12.input_layernorm.weight": "model-00004-of-00011.safetensors",
74
+ "model.layers.12.mlp.act_fn.bias": "model-00004-of-00011.safetensors",
75
+ "model.layers.12.mlp.act_fn.weight": "model-00004-of-00011.safetensors",
76
+ "model.layers.12.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
77
+ "model.layers.12.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
78
+ "model.layers.12.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
79
+ "model.layers.12.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
80
+ "model.layers.12.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
81
+ "model.layers.12.self_attn.lambda_k1": "model-00004-of-00011.safetensors",
82
+ "model.layers.12.self_attn.lambda_k2": "model-00004-of-00011.safetensors",
83
+ "model.layers.12.self_attn.lambda_q1": "model-00004-of-00011.safetensors",
84
+ "model.layers.12.self_attn.lambda_q2": "model-00004-of-00011.safetensors",
85
+ "model.layers.12.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
86
+ "model.layers.12.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
87
+ "model.layers.12.self_attn.subln.weight": "model-00004-of-00011.safetensors",
88
+ "model.layers.12.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
89
+ "model.layers.13.input_layernorm.weight": "model-00004-of-00011.safetensors",
90
+ "model.layers.13.mlp.act_fn.bias": "model-00004-of-00011.safetensors",
91
+ "model.layers.13.mlp.act_fn.weight": "model-00004-of-00011.safetensors",
92
+ "model.layers.13.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
93
+ "model.layers.13.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
94
+ "model.layers.13.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
95
+ "model.layers.13.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
96
+ "model.layers.13.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
97
+ "model.layers.13.self_attn.lambda_k1": "model-00004-of-00011.safetensors",
98
+ "model.layers.13.self_attn.lambda_k2": "model-00004-of-00011.safetensors",
99
+ "model.layers.13.self_attn.lambda_q1": "model-00004-of-00011.safetensors",
100
+ "model.layers.13.self_attn.lambda_q2": "model-00004-of-00011.safetensors",
101
+ "model.layers.13.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
102
+ "model.layers.13.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
103
+ "model.layers.13.self_attn.subln.weight": "model-00004-of-00011.safetensors",
104
+ "model.layers.13.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
105
+ "model.layers.14.input_layernorm.weight": "model-00005-of-00011.safetensors",
106
+ "model.layers.14.mlp.act_fn.bias": "model-00005-of-00011.safetensors",
107
+ "model.layers.14.mlp.act_fn.weight": "model-00005-of-00011.safetensors",
108
+ "model.layers.14.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
109
+ "model.layers.14.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
110
+ "model.layers.14.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
111
+ "model.layers.14.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
112
+ "model.layers.14.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
113
+ "model.layers.14.self_attn.lambda_k1": "model-00004-of-00011.safetensors",
114
+ "model.layers.14.self_attn.lambda_k2": "model-00004-of-00011.safetensors",
115
+ "model.layers.14.self_attn.lambda_q1": "model-00004-of-00011.safetensors",
116
+ "model.layers.14.self_attn.lambda_q2": "model-00004-of-00011.safetensors",
117
+ "model.layers.14.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
118
+ "model.layers.14.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
119
+ "model.layers.14.self_attn.subln.weight": "model-00004-of-00011.safetensors",
120
+ "model.layers.14.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
121
+ "model.layers.15.input_layernorm.weight": "model-00005-of-00011.safetensors",
122
+ "model.layers.15.mlp.act_fn.bias": "model-00005-of-00011.safetensors",
123
+ "model.layers.15.mlp.act_fn.weight": "model-00005-of-00011.safetensors",
124
+ "model.layers.15.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
125
+ "model.layers.15.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
126
+ "model.layers.15.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
127
+ "model.layers.15.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
128
+ "model.layers.15.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
129
+ "model.layers.15.self_attn.lambda_k1": "model-00005-of-00011.safetensors",
130
+ "model.layers.15.self_attn.lambda_k2": "model-00005-of-00011.safetensors",
131
+ "model.layers.15.self_attn.lambda_q1": "model-00005-of-00011.safetensors",
132
+ "model.layers.15.self_attn.lambda_q2": "model-00005-of-00011.safetensors",
133
+ "model.layers.15.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
134
+ "model.layers.15.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
135
+ "model.layers.15.self_attn.subln.weight": "model-00005-of-00011.safetensors",
136
+ "model.layers.15.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
137
+ "model.layers.16.input_layernorm.weight": "model-00005-of-00011.safetensors",
138
+ "model.layers.16.mlp.act_fn.bias": "model-00005-of-00011.safetensors",
139
+ "model.layers.16.mlp.act_fn.weight": "model-00005-of-00011.safetensors",
140
+ "model.layers.16.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
141
+ "model.layers.16.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
142
+ "model.layers.16.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
143
+ "model.layers.16.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
144
+ "model.layers.16.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
145
+ "model.layers.16.self_attn.lambda_k1": "model-00005-of-00011.safetensors",
146
+ "model.layers.16.self_attn.lambda_k2": "model-00005-of-00011.safetensors",
147
+ "model.layers.16.self_attn.lambda_q1": "model-00005-of-00011.safetensors",
148
+ "model.layers.16.self_attn.lambda_q2": "model-00005-of-00011.safetensors",
149
+ "model.layers.16.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
150
+ "model.layers.16.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
151
+ "model.layers.16.self_attn.subln.weight": "model-00005-of-00011.safetensors",
152
+ "model.layers.16.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
153
+ "model.layers.17.input_layernorm.weight": "model-00005-of-00011.safetensors",
154
+ "model.layers.17.mlp.act_fn.bias": "model-00005-of-00011.safetensors",
155
+ "model.layers.17.mlp.act_fn.weight": "model-00005-of-00011.safetensors",
156
+ "model.layers.17.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
157
+ "model.layers.17.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
158
+ "model.layers.17.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
159
+ "model.layers.17.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
160
+ "model.layers.17.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
161
+ "model.layers.17.self_attn.lambda_k1": "model-00005-of-00011.safetensors",
162
+ "model.layers.17.self_attn.lambda_k2": "model-00005-of-00011.safetensors",
163
+ "model.layers.17.self_attn.lambda_q1": "model-00005-of-00011.safetensors",
164
+ "model.layers.17.self_attn.lambda_q2": "model-00005-of-00011.safetensors",
165
+ "model.layers.17.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
166
+ "model.layers.17.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
167
+ "model.layers.17.self_attn.subln.weight": "model-00005-of-00011.safetensors",
168
+ "model.layers.17.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
169
+ "model.layers.18.input_layernorm.weight": "model-00005-of-00011.safetensors",
170
+ "model.layers.18.mlp.act_fn.bias": "model-00005-of-00011.safetensors",
171
+ "model.layers.18.mlp.act_fn.weight": "model-00005-of-00011.safetensors",
172
+ "model.layers.18.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
173
+ "model.layers.18.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
174
+ "model.layers.18.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
175
+ "model.layers.18.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
176
+ "model.layers.18.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
177
+ "model.layers.18.self_attn.lambda_k1": "model-00005-of-00011.safetensors",
178
+ "model.layers.18.self_attn.lambda_k2": "model-00005-of-00011.safetensors",
179
+ "model.layers.18.self_attn.lambda_q1": "model-00005-of-00011.safetensors",
180
+ "model.layers.18.self_attn.lambda_q2": "model-00005-of-00011.safetensors",
181
+ "model.layers.18.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
182
+ "model.layers.18.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
183
+ "model.layers.18.self_attn.subln.weight": "model-00005-of-00011.safetensors",
184
+ "model.layers.18.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
185
+ "model.layers.19.input_layernorm.weight": "model-00006-of-00011.safetensors",
186
+ "model.layers.19.mlp.act_fn.bias": "model-00006-of-00011.safetensors",
187
+ "model.layers.19.mlp.act_fn.weight": "model-00006-of-00011.safetensors",
188
+ "model.layers.19.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
189
+ "model.layers.19.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
190
+ "model.layers.19.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
191
+ "model.layers.19.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
192
+ "model.layers.19.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
193
+ "model.layers.19.self_attn.lambda_k1": "model-00005-of-00011.safetensors",
194
+ "model.layers.19.self_attn.lambda_k2": "model-00005-of-00011.safetensors",
195
+ "model.layers.19.self_attn.lambda_q1": "model-00005-of-00011.safetensors",
196
+ "model.layers.19.self_attn.lambda_q2": "model-00005-of-00011.safetensors",
197
+ "model.layers.19.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
198
+ "model.layers.19.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
199
+ "model.layers.19.self_attn.subln.weight": "model-00005-of-00011.safetensors",
200
+ "model.layers.19.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
201
+ "model.layers.2.input_layernorm.weight": "model-00002-of-00011.safetensors",
202
+ "model.layers.2.mlp.act_fn.bias": "model-00002-of-00011.safetensors",
203
+ "model.layers.2.mlp.act_fn.weight": "model-00002-of-00011.safetensors",
204
+ "model.layers.2.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
205
+ "model.layers.2.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
206
+ "model.layers.2.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
207
+ "model.layers.2.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
208
+ "model.layers.2.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
209
+ "model.layers.2.self_attn.lambda_k1": "model-00002-of-00011.safetensors",
210
+ "model.layers.2.self_attn.lambda_k2": "model-00002-of-00011.safetensors",
211
+ "model.layers.2.self_attn.lambda_q1": "model-00002-of-00011.safetensors",
212
+ "model.layers.2.self_attn.lambda_q2": "model-00002-of-00011.safetensors",
213
+ "model.layers.2.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
214
+ "model.layers.2.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
215
+ "model.layers.2.self_attn.subln.weight": "model-00002-of-00011.safetensors",
216
+ "model.layers.2.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
217
+ "model.layers.20.input_layernorm.weight": "model-00006-of-00011.safetensors",
218
+ "model.layers.20.mlp.act_fn.bias": "model-00006-of-00011.safetensors",
219
+ "model.layers.20.mlp.act_fn.weight": "model-00006-of-00011.safetensors",
220
+ "model.layers.20.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
221
+ "model.layers.20.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
222
+ "model.layers.20.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
223
+ "model.layers.20.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
224
+ "model.layers.20.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
225
+ "model.layers.20.self_attn.lambda_k1": "model-00006-of-00011.safetensors",
226
+ "model.layers.20.self_attn.lambda_k2": "model-00006-of-00011.safetensors",
227
+ "model.layers.20.self_attn.lambda_q1": "model-00006-of-00011.safetensors",
228
+ "model.layers.20.self_attn.lambda_q2": "model-00006-of-00011.safetensors",
229
+ "model.layers.20.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
230
+ "model.layers.20.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
231
+ "model.layers.20.self_attn.subln.weight": "model-00006-of-00011.safetensors",
232
+ "model.layers.20.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
233
+ "model.layers.21.input_layernorm.weight": "model-00006-of-00011.safetensors",
234
+ "model.layers.21.mlp.act_fn.bias": "model-00006-of-00011.safetensors",
235
+ "model.layers.21.mlp.act_fn.weight": "model-00006-of-00011.safetensors",
236
+ "model.layers.21.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
237
+ "model.layers.21.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
238
+ "model.layers.21.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
239
+ "model.layers.21.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
240
+ "model.layers.21.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
241
+ "model.layers.21.self_attn.lambda_k1": "model-00006-of-00011.safetensors",
242
+ "model.layers.21.self_attn.lambda_k2": "model-00006-of-00011.safetensors",
243
+ "model.layers.21.self_attn.lambda_q1": "model-00006-of-00011.safetensors",
244
+ "model.layers.21.self_attn.lambda_q2": "model-00006-of-00011.safetensors",
245
+ "model.layers.21.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
246
+ "model.layers.21.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
247
+ "model.layers.21.self_attn.subln.weight": "model-00006-of-00011.safetensors",
248
+ "model.layers.21.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
249
+ "model.layers.22.input_layernorm.weight": "model-00006-of-00011.safetensors",
250
+ "model.layers.22.mlp.act_fn.bias": "model-00006-of-00011.safetensors",
251
+ "model.layers.22.mlp.act_fn.weight": "model-00006-of-00011.safetensors",
252
+ "model.layers.22.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
253
+ "model.layers.22.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
254
+ "model.layers.22.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
255
+ "model.layers.22.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
256
+ "model.layers.22.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
257
+ "model.layers.22.self_attn.lambda_k1": "model-00006-of-00011.safetensors",
258
+ "model.layers.22.self_attn.lambda_k2": "model-00006-of-00011.safetensors",
259
+ "model.layers.22.self_attn.lambda_q1": "model-00006-of-00011.safetensors",
260
+ "model.layers.22.self_attn.lambda_q2": "model-00006-of-00011.safetensors",
261
+ "model.layers.22.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
262
+ "model.layers.22.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
263
+ "model.layers.22.self_attn.subln.weight": "model-00006-of-00011.safetensors",
264
+ "model.layers.22.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
265
+ "model.layers.23.input_layernorm.weight": "model-00007-of-00011.safetensors",
266
+ "model.layers.23.mlp.act_fn.bias": "model-00007-of-00011.safetensors",
267
+ "model.layers.23.mlp.act_fn.weight": "model-00007-of-00011.safetensors",
268
+ "model.layers.23.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
269
+ "model.layers.23.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
270
+ "model.layers.23.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
271
+ "model.layers.23.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
272
+ "model.layers.23.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
273
+ "model.layers.23.self_attn.lambda_k1": "model-00006-of-00011.safetensors",
274
+ "model.layers.23.self_attn.lambda_k2": "model-00006-of-00011.safetensors",
275
+ "model.layers.23.self_attn.lambda_q1": "model-00006-of-00011.safetensors",
276
+ "model.layers.23.self_attn.lambda_q2": "model-00006-of-00011.safetensors",
277
+ "model.layers.23.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
278
+ "model.layers.23.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
279
+ "model.layers.23.self_attn.subln.weight": "model-00006-of-00011.safetensors",
280
+ "model.layers.23.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
281
+ "model.layers.24.input_layernorm.weight": "model-00007-of-00011.safetensors",
282
+ "model.layers.24.mlp.act_fn.bias": "model-00007-of-00011.safetensors",
283
+ "model.layers.24.mlp.act_fn.weight": "model-00007-of-00011.safetensors",
284
+ "model.layers.24.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
285
+ "model.layers.24.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
286
+ "model.layers.24.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
287
+ "model.layers.24.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
288
+ "model.layers.24.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
289
+ "model.layers.24.self_attn.lambda_k1": "model-00007-of-00011.safetensors",
290
+ "model.layers.24.self_attn.lambda_k2": "model-00007-of-00011.safetensors",
291
+ "model.layers.24.self_attn.lambda_q1": "model-00007-of-00011.safetensors",
292
+ "model.layers.24.self_attn.lambda_q2": "model-00007-of-00011.safetensors",
293
+ "model.layers.24.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
294
+ "model.layers.24.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
295
+ "model.layers.24.self_attn.subln.weight": "model-00007-of-00011.safetensors",
296
+ "model.layers.24.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
297
+ "model.layers.25.input_layernorm.weight": "model-00007-of-00011.safetensors",
298
+ "model.layers.25.mlp.act_fn.bias": "model-00007-of-00011.safetensors",
299
+ "model.layers.25.mlp.act_fn.weight": "model-00007-of-00011.safetensors",
300
+ "model.layers.25.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
301
+ "model.layers.25.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
302
+ "model.layers.25.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
303
+ "model.layers.25.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
304
+ "model.layers.25.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
305
+ "model.layers.25.self_attn.lambda_k1": "model-00007-of-00011.safetensors",
306
+ "model.layers.25.self_attn.lambda_k2": "model-00007-of-00011.safetensors",
307
+ "model.layers.25.self_attn.lambda_q1": "model-00007-of-00011.safetensors",
308
+ "model.layers.25.self_attn.lambda_q2": "model-00007-of-00011.safetensors",
309
+ "model.layers.25.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
310
+ "model.layers.25.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
311
+ "model.layers.25.self_attn.subln.weight": "model-00007-of-00011.safetensors",
312
+ "model.layers.25.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
313
+ "model.layers.26.input_layernorm.weight": "model-00007-of-00011.safetensors",
314
+ "model.layers.26.mlp.act_fn.bias": "model-00007-of-00011.safetensors",
315
+ "model.layers.26.mlp.act_fn.weight": "model-00007-of-00011.safetensors",
316
+ "model.layers.26.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
317
+ "model.layers.26.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
318
+ "model.layers.26.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
319
+ "model.layers.26.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
320
+ "model.layers.26.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
321
+ "model.layers.26.self_attn.lambda_k1": "model-00007-of-00011.safetensors",
322
+ "model.layers.26.self_attn.lambda_k2": "model-00007-of-00011.safetensors",
323
+ "model.layers.26.self_attn.lambda_q1": "model-00007-of-00011.safetensors",
324
+ "model.layers.26.self_attn.lambda_q2": "model-00007-of-00011.safetensors",
325
+ "model.layers.26.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
326
+ "model.layers.26.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
327
+ "model.layers.26.self_attn.subln.weight": "model-00007-of-00011.safetensors",
328
+ "model.layers.26.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
329
+ "model.layers.27.input_layernorm.weight": "model-00007-of-00011.safetensors",
330
+ "model.layers.27.mlp.act_fn.bias": "model-00007-of-00011.safetensors",
331
+ "model.layers.27.mlp.act_fn.weight": "model-00007-of-00011.safetensors",
332
+ "model.layers.27.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
333
+ "model.layers.27.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
334
+ "model.layers.27.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
335
+ "model.layers.27.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
336
+ "model.layers.27.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
337
+ "model.layers.27.self_attn.lambda_k1": "model-00007-of-00011.safetensors",
338
+ "model.layers.27.self_attn.lambda_k2": "model-00007-of-00011.safetensors",
339
+ "model.layers.27.self_attn.lambda_q1": "model-00007-of-00011.safetensors",
340
+ "model.layers.27.self_attn.lambda_q2": "model-00007-of-00011.safetensors",
341
+ "model.layers.27.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
342
+ "model.layers.27.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
343
+ "model.layers.27.self_attn.subln.weight": "model-00007-of-00011.safetensors",
344
+ "model.layers.27.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
345
+ "model.layers.28.input_layernorm.weight": "model-00008-of-00011.safetensors",
346
+ "model.layers.28.mlp.act_fn.bias": "model-00008-of-00011.safetensors",
347
+ "model.layers.28.mlp.act_fn.weight": "model-00008-of-00011.safetensors",
348
+ "model.layers.28.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
349
+ "model.layers.28.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
350
+ "model.layers.28.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
351
+ "model.layers.28.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
352
+ "model.layers.28.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
353
+ "model.layers.28.self_attn.lambda_k1": "model-00007-of-00011.safetensors",
354
+ "model.layers.28.self_attn.lambda_k2": "model-00007-of-00011.safetensors",
355
+ "model.layers.28.self_attn.lambda_q1": "model-00007-of-00011.safetensors",
356
+ "model.layers.28.self_attn.lambda_q2": "model-00007-of-00011.safetensors",
357
+ "model.layers.28.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
358
+ "model.layers.28.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
359
+ "model.layers.28.self_attn.subln.weight": "model-00007-of-00011.safetensors",
360
+ "model.layers.28.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
361
+ "model.layers.29.input_layernorm.weight": "model-00008-of-00011.safetensors",
362
+ "model.layers.29.mlp.act_fn.bias": "model-00008-of-00011.safetensors",
363
+ "model.layers.29.mlp.act_fn.weight": "model-00008-of-00011.safetensors",
364
+ "model.layers.29.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
365
+ "model.layers.29.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
366
+ "model.layers.29.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
367
+ "model.layers.29.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
368
+ "model.layers.29.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
369
+ "model.layers.29.self_attn.lambda_k1": "model-00008-of-00011.safetensors",
370
+ "model.layers.29.self_attn.lambda_k2": "model-00008-of-00011.safetensors",
371
+ "model.layers.29.self_attn.lambda_q1": "model-00008-of-00011.safetensors",
372
+ "model.layers.29.self_attn.lambda_q2": "model-00008-of-00011.safetensors",
373
+ "model.layers.29.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
374
+ "model.layers.29.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
375
+ "model.layers.29.self_attn.subln.weight": "model-00008-of-00011.safetensors",
376
+ "model.layers.29.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
377
+ "model.layers.3.input_layernorm.weight": "model-00002-of-00011.safetensors",
378
+ "model.layers.3.mlp.act_fn.bias": "model-00002-of-00011.safetensors",
379
+ "model.layers.3.mlp.act_fn.weight": "model-00002-of-00011.safetensors",
380
+ "model.layers.3.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
381
+ "model.layers.3.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
382
+ "model.layers.3.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
383
+ "model.layers.3.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
384
+ "model.layers.3.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
385
+ "model.layers.3.self_attn.lambda_k1": "model-00002-of-00011.safetensors",
386
+ "model.layers.3.self_attn.lambda_k2": "model-00002-of-00011.safetensors",
387
+ "model.layers.3.self_attn.lambda_q1": "model-00002-of-00011.safetensors",
388
+ "model.layers.3.self_attn.lambda_q2": "model-00002-of-00011.safetensors",
389
+ "model.layers.3.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
390
+ "model.layers.3.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
391
+ "model.layers.3.self_attn.subln.weight": "model-00002-of-00011.safetensors",
392
+ "model.layers.3.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
393
+ "model.layers.30.input_layernorm.weight": "model-00008-of-00011.safetensors",
394
+ "model.layers.30.mlp.act_fn.bias": "model-00008-of-00011.safetensors",
395
+ "model.layers.30.mlp.act_fn.weight": "model-00008-of-00011.safetensors",
396
+ "model.layers.30.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
397
+ "model.layers.30.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
398
+ "model.layers.30.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
399
+ "model.layers.30.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
400
+ "model.layers.30.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
401
+ "model.layers.30.self_attn.lambda_k1": "model-00008-of-00011.safetensors",
402
+ "model.layers.30.self_attn.lambda_k2": "model-00008-of-00011.safetensors",
403
+ "model.layers.30.self_attn.lambda_q1": "model-00008-of-00011.safetensors",
404
+ "model.layers.30.self_attn.lambda_q2": "model-00008-of-00011.safetensors",
405
+ "model.layers.30.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
406
+ "model.layers.30.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
407
+ "model.layers.30.self_attn.subln.weight": "model-00008-of-00011.safetensors",
408
+ "model.layers.30.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
409
+ "model.layers.31.input_layernorm.weight": "model-00008-of-00011.safetensors",
410
+ "model.layers.31.mlp.act_fn.bias": "model-00008-of-00011.safetensors",
411
+ "model.layers.31.mlp.act_fn.weight": "model-00008-of-00011.safetensors",
412
+ "model.layers.31.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
413
+ "model.layers.31.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
414
+ "model.layers.31.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
415
+ "model.layers.31.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
416
+ "model.layers.31.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
417
+ "model.layers.31.self_attn.lambda_k1": "model-00008-of-00011.safetensors",
418
+ "model.layers.31.self_attn.lambda_k2": "model-00008-of-00011.safetensors",
419
+ "model.layers.31.self_attn.lambda_q1": "model-00008-of-00011.safetensors",
420
+ "model.layers.31.self_attn.lambda_q2": "model-00008-of-00011.safetensors",
421
+ "model.layers.31.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
422
+ "model.layers.31.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
423
+ "model.layers.31.self_attn.subln.weight": "model-00008-of-00011.safetensors",
424
+ "model.layers.31.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
425
+ "model.layers.32.input_layernorm.weight": "model-00009-of-00011.safetensors",
426
+ "model.layers.32.mlp.act_fn.bias": "model-00009-of-00011.safetensors",
427
+ "model.layers.32.mlp.act_fn.weight": "model-00009-of-00011.safetensors",
428
+ "model.layers.32.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
429
+ "model.layers.32.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
430
+ "model.layers.32.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
431
+ "model.layers.32.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
432
+ "model.layers.32.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
433
+ "model.layers.32.self_attn.lambda_k1": "model-00008-of-00011.safetensors",
434
+ "model.layers.32.self_attn.lambda_k2": "model-00008-of-00011.safetensors",
435
+ "model.layers.32.self_attn.lambda_q1": "model-00008-of-00011.safetensors",
436
+ "model.layers.32.self_attn.lambda_q2": "model-00008-of-00011.safetensors",
437
+ "model.layers.32.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
438
+ "model.layers.32.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
439
+ "model.layers.32.self_attn.subln.weight": "model-00008-of-00011.safetensors",
440
+ "model.layers.32.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
441
+ "model.layers.33.input_layernorm.weight": "model-00009-of-00011.safetensors",
442
+ "model.layers.33.mlp.act_fn.bias": "model-00009-of-00011.safetensors",
443
+ "model.layers.33.mlp.act_fn.weight": "model-00009-of-00011.safetensors",
444
+ "model.layers.33.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
445
+ "model.layers.33.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
446
+ "model.layers.33.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
447
+ "model.layers.33.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
448
+ "model.layers.33.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
449
+ "model.layers.33.self_attn.lambda_k1": "model-00009-of-00011.safetensors",
450
+ "model.layers.33.self_attn.lambda_k2": "model-00009-of-00011.safetensors",
451
+ "model.layers.33.self_attn.lambda_q1": "model-00009-of-00011.safetensors",
452
+ "model.layers.33.self_attn.lambda_q2": "model-00009-of-00011.safetensors",
453
+ "model.layers.33.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
454
+ "model.layers.33.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
455
+ "model.layers.33.self_attn.subln.weight": "model-00009-of-00011.safetensors",
456
+ "model.layers.33.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
457
+ "model.layers.34.input_layernorm.weight": "model-00009-of-00011.safetensors",
458
+ "model.layers.34.mlp.act_fn.bias": "model-00009-of-00011.safetensors",
459
+ "model.layers.34.mlp.act_fn.weight": "model-00009-of-00011.safetensors",
460
+ "model.layers.34.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
461
+ "model.layers.34.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
462
+ "model.layers.34.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
463
+ "model.layers.34.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
464
+ "model.layers.34.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
465
+ "model.layers.34.self_attn.lambda_k1": "model-00009-of-00011.safetensors",
466
+ "model.layers.34.self_attn.lambda_k2": "model-00009-of-00011.safetensors",
467
+ "model.layers.34.self_attn.lambda_q1": "model-00009-of-00011.safetensors",
468
+ "model.layers.34.self_attn.lambda_q2": "model-00009-of-00011.safetensors",
469
+ "model.layers.34.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
470
+ "model.layers.34.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
471
+ "model.layers.34.self_attn.subln.weight": "model-00009-of-00011.safetensors",
472
+ "model.layers.34.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
473
+ "model.layers.35.input_layernorm.weight": "model-00009-of-00011.safetensors",
474
+ "model.layers.35.mlp.act_fn.bias": "model-00009-of-00011.safetensors",
475
+ "model.layers.35.mlp.act_fn.weight": "model-00009-of-00011.safetensors",
476
+ "model.layers.35.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
477
+ "model.layers.35.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
478
+ "model.layers.35.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
479
+ "model.layers.35.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
480
+ "model.layers.35.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
481
+ "model.layers.35.self_attn.lambda_k1": "model-00009-of-00011.safetensors",
482
+ "model.layers.35.self_attn.lambda_k2": "model-00009-of-00011.safetensors",
483
+ "model.layers.35.self_attn.lambda_q1": "model-00009-of-00011.safetensors",
484
+ "model.layers.35.self_attn.lambda_q2": "model-00009-of-00011.safetensors",
485
+ "model.layers.35.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
486
+ "model.layers.35.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
487
+ "model.layers.35.self_attn.subln.weight": "model-00009-of-00011.safetensors",
488
+ "model.layers.35.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
489
+ "model.layers.36.input_layernorm.weight": "model-00009-of-00011.safetensors",
490
+ "model.layers.36.mlp.act_fn.bias": "model-00009-of-00011.safetensors",
491
+ "model.layers.36.mlp.act_fn.weight": "model-00009-of-00011.safetensors",
492
+ "model.layers.36.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
493
+ "model.layers.36.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
494
+ "model.layers.36.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
495
+ "model.layers.36.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
496
+ "model.layers.36.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
497
+ "model.layers.36.self_attn.lambda_k1": "model-00009-of-00011.safetensors",
498
+ "model.layers.36.self_attn.lambda_k2": "model-00009-of-00011.safetensors",
499
+ "model.layers.36.self_attn.lambda_q1": "model-00009-of-00011.safetensors",
500
+ "model.layers.36.self_attn.lambda_q2": "model-00009-of-00011.safetensors",
501
+ "model.layers.36.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
502
+ "model.layers.36.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
503
+ "model.layers.36.self_attn.subln.weight": "model-00009-of-00011.safetensors",
504
+ "model.layers.36.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
505
+ "model.layers.37.input_layernorm.weight": "model-00010-of-00011.safetensors",
506
+ "model.layers.37.mlp.act_fn.bias": "model-00010-of-00011.safetensors",
507
+ "model.layers.37.mlp.act_fn.weight": "model-00010-of-00011.safetensors",
508
+ "model.layers.37.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
509
+ "model.layers.37.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
510
+ "model.layers.37.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
511
+ "model.layers.37.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
512
+ "model.layers.37.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
513
+ "model.layers.37.self_attn.lambda_k1": "model-00009-of-00011.safetensors",
514
+ "model.layers.37.self_attn.lambda_k2": "model-00009-of-00011.safetensors",
515
+ "model.layers.37.self_attn.lambda_q1": "model-00009-of-00011.safetensors",
516
+ "model.layers.37.self_attn.lambda_q2": "model-00009-of-00011.safetensors",
517
+ "model.layers.37.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
518
+ "model.layers.37.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
519
+ "model.layers.37.self_attn.subln.weight": "model-00009-of-00011.safetensors",
520
+ "model.layers.37.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
521
+ "model.layers.38.input_layernorm.weight": "model-00010-of-00011.safetensors",
522
+ "model.layers.38.mlp.act_fn.bias": "model-00010-of-00011.safetensors",
523
+ "model.layers.38.mlp.act_fn.weight": "model-00010-of-00011.safetensors",
524
+ "model.layers.38.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
525
+ "model.layers.38.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
526
+ "model.layers.38.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
527
+ "model.layers.38.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
528
+ "model.layers.38.self_attn.k_proj.weight": "model-00010-of-00011.safetensors",
529
+ "model.layers.38.self_attn.lambda_k1": "model-00010-of-00011.safetensors",
530
+ "model.layers.38.self_attn.lambda_k2": "model-00010-of-00011.safetensors",
531
+ "model.layers.38.self_attn.lambda_q1": "model-00010-of-00011.safetensors",
532
+ "model.layers.38.self_attn.lambda_q2": "model-00010-of-00011.safetensors",
533
+ "model.layers.38.self_attn.o_proj.weight": "model-00010-of-00011.safetensors",
534
+ "model.layers.38.self_attn.q_proj.weight": "model-00010-of-00011.safetensors",
535
+ "model.layers.38.self_attn.subln.weight": "model-00010-of-00011.safetensors",
536
+ "model.layers.38.self_attn.v_proj.weight": "model-00010-of-00011.safetensors",
537
+ "model.layers.39.input_layernorm.weight": "model-00010-of-00011.safetensors",
538
+ "model.layers.39.mlp.act_fn.bias": "model-00010-of-00011.safetensors",
539
+ "model.layers.39.mlp.act_fn.weight": "model-00010-of-00011.safetensors",
540
+ "model.layers.39.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
541
+ "model.layers.39.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
542
+ "model.layers.39.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
543
+ "model.layers.39.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
544
+ "model.layers.39.self_attn.k_proj.weight": "model-00010-of-00011.safetensors",
545
+ "model.layers.39.self_attn.lambda_k1": "model-00010-of-00011.safetensors",
546
+ "model.layers.39.self_attn.lambda_k2": "model-00010-of-00011.safetensors",
547
+ "model.layers.39.self_attn.lambda_q1": "model-00010-of-00011.safetensors",
548
+ "model.layers.39.self_attn.lambda_q2": "model-00010-of-00011.safetensors",
549
+ "model.layers.39.self_attn.o_proj.weight": "model-00010-of-00011.safetensors",
550
+ "model.layers.39.self_attn.q_proj.weight": "model-00010-of-00011.safetensors",
551
+ "model.layers.39.self_attn.subln.weight": "model-00010-of-00011.safetensors",
552
+ "model.layers.39.self_attn.v_proj.weight": "model-00010-of-00011.safetensors",
553
+ "model.layers.4.input_layernorm.weight": "model-00002-of-00011.safetensors",
554
+ "model.layers.4.mlp.act_fn.bias": "model-00002-of-00011.safetensors",
555
+ "model.layers.4.mlp.act_fn.weight": "model-00002-of-00011.safetensors",
556
+ "model.layers.4.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
557
+ "model.layers.4.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
558
+ "model.layers.4.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
559
+ "model.layers.4.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
560
+ "model.layers.4.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
561
+ "model.layers.4.self_attn.lambda_k1": "model-00002-of-00011.safetensors",
562
+ "model.layers.4.self_attn.lambda_k2": "model-00002-of-00011.safetensors",
563
+ "model.layers.4.self_attn.lambda_q1": "model-00002-of-00011.safetensors",
564
+ "model.layers.4.self_attn.lambda_q2": "model-00002-of-00011.safetensors",
565
+ "model.layers.4.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
566
+ "model.layers.4.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
567
+ "model.layers.4.self_attn.subln.weight": "model-00002-of-00011.safetensors",
568
+ "model.layers.4.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
569
+ "model.layers.5.input_layernorm.weight": "model-00003-of-00011.safetensors",
570
+ "model.layers.5.mlp.act_fn.bias": "model-00003-of-00011.safetensors",
571
+ "model.layers.5.mlp.act_fn.weight": "model-00003-of-00011.safetensors",
572
+ "model.layers.5.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
573
+ "model.layers.5.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
574
+ "model.layers.5.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
575
+ "model.layers.5.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
576
+ "model.layers.5.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
577
+ "model.layers.5.self_attn.lambda_k1": "model-00002-of-00011.safetensors",
578
+ "model.layers.5.self_attn.lambda_k2": "model-00002-of-00011.safetensors",
579
+ "model.layers.5.self_attn.lambda_q1": "model-00002-of-00011.safetensors",
580
+ "model.layers.5.self_attn.lambda_q2": "model-00002-of-00011.safetensors",
581
+ "model.layers.5.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
582
+ "model.layers.5.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
583
+ "model.layers.5.self_attn.subln.weight": "model-00002-of-00011.safetensors",
584
+ "model.layers.5.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
585
+ "model.layers.6.input_layernorm.weight": "model-00003-of-00011.safetensors",
586
+ "model.layers.6.mlp.act_fn.bias": "model-00003-of-00011.safetensors",
587
+ "model.layers.6.mlp.act_fn.weight": "model-00003-of-00011.safetensors",
588
+ "model.layers.6.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
589
+ "model.layers.6.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
590
+ "model.layers.6.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
591
+ "model.layers.6.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
592
+ "model.layers.6.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
593
+ "model.layers.6.self_attn.lambda_k1": "model-00003-of-00011.safetensors",
594
+ "model.layers.6.self_attn.lambda_k2": "model-00003-of-00011.safetensors",
595
+ "model.layers.6.self_attn.lambda_q1": "model-00003-of-00011.safetensors",
596
+ "model.layers.6.self_attn.lambda_q2": "model-00003-of-00011.safetensors",
597
+ "model.layers.6.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
598
+ "model.layers.6.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
599
+ "model.layers.6.self_attn.subln.weight": "model-00003-of-00011.safetensors",
600
+ "model.layers.6.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
601
+ "model.layers.7.input_layernorm.weight": "model-00003-of-00011.safetensors",
602
+ "model.layers.7.mlp.act_fn.bias": "model-00003-of-00011.safetensors",
603
+ "model.layers.7.mlp.act_fn.weight": "model-00003-of-00011.safetensors",
604
+ "model.layers.7.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
605
+ "model.layers.7.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
606
+ "model.layers.7.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
607
+ "model.layers.7.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
608
+ "model.layers.7.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
609
+ "model.layers.7.self_attn.lambda_k1": "model-00003-of-00011.safetensors",
610
+ "model.layers.7.self_attn.lambda_k2": "model-00003-of-00011.safetensors",
611
+ "model.layers.7.self_attn.lambda_q1": "model-00003-of-00011.safetensors",
612
+ "model.layers.7.self_attn.lambda_q2": "model-00003-of-00011.safetensors",
613
+ "model.layers.7.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
614
+ "model.layers.7.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
615
+ "model.layers.7.self_attn.subln.weight": "model-00003-of-00011.safetensors",
616
+ "model.layers.7.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
617
+ "model.layers.8.input_layernorm.weight": "model-00003-of-00011.safetensors",
618
+ "model.layers.8.mlp.act_fn.bias": "model-00003-of-00011.safetensors",
619
+ "model.layers.8.mlp.act_fn.weight": "model-00003-of-00011.safetensors",
620
+ "model.layers.8.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
621
+ "model.layers.8.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
622
+ "model.layers.8.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
623
+ "model.layers.8.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
624
+ "model.layers.8.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
625
+ "model.layers.8.self_attn.lambda_k1": "model-00003-of-00011.safetensors",
626
+ "model.layers.8.self_attn.lambda_k2": "model-00003-of-00011.safetensors",
627
+ "model.layers.8.self_attn.lambda_q1": "model-00003-of-00011.safetensors",
628
+ "model.layers.8.self_attn.lambda_q2": "model-00003-of-00011.safetensors",
629
+ "model.layers.8.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
630
+ "model.layers.8.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
631
+ "model.layers.8.self_attn.subln.weight": "model-00003-of-00011.safetensors",
632
+ "model.layers.8.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
633
+ "model.layers.9.input_layernorm.weight": "model-00003-of-00011.safetensors",
634
+ "model.layers.9.mlp.act_fn.bias": "model-00003-of-00011.safetensors",
635
+ "model.layers.9.mlp.act_fn.weight": "model-00003-of-00011.safetensors",
636
+ "model.layers.9.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
637
+ "model.layers.9.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
638
+ "model.layers.9.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
639
+ "model.layers.9.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
640
+ "model.layers.9.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
641
+ "model.layers.9.self_attn.lambda_k1": "model-00003-of-00011.safetensors",
642
+ "model.layers.9.self_attn.lambda_k2": "model-00003-of-00011.safetensors",
643
+ "model.layers.9.self_attn.lambda_q1": "model-00003-of-00011.safetensors",
644
+ "model.layers.9.self_attn.lambda_q2": "model-00003-of-00011.safetensors",
645
+ "model.layers.9.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
646
+ "model.layers.9.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
647
+ "model.layers.9.self_attn.subln.weight": "model-00003-of-00011.safetensors",
648
+ "model.layers.9.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
649
+ "model.norm.weight": "model-00010-of-00011.safetensors"
650
+ }
651
+ }
modeling_motif.py ADDED
@@ -0,0 +1,1513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ from typing import List, Optional, Tuple, Union
3
+
4
+ import torch
5
+ import torch.utils.checkpoint
6
+ from torch import nn
7
+ from torch.nn import CrossEntropyLoss
8
+
9
+ from transformers.activations import ACT2CLS as _ACT2CLS
10
+ from transformers.activations import ClassInstantier
11
+ from transformers.cache_utils import Cache, DynamicCache, SlidingWindowCache, StaticCache
12
+ from transformers.generation import GenerationMixin
13
+ from transformers.modeling_attn_mask_utils import AttentionMaskConverter
14
+ from transformers.modeling_flash_attention_utils import _flash_attention_forward
15
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
16
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS
17
+ from transformers.modeling_utils import PreTrainedModel
18
+ from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
19
+ from transformers.utils import (
20
+ add_start_docstrings,
21
+ add_start_docstrings_to_model_forward,
22
+ is_flash_attn_2_available,
23
+ is_flash_attn_greater_or_equal_2_10,
24
+ logging,
25
+ replace_return_docstrings,
26
+ )
27
+
28
+ from .configuration_motif import MotifConfig
29
+ import kernels
30
+ try:
31
+ activation = kernels.get_kernel("Motif-Technologies/activation")
32
+ except:
33
+ activation = None
34
+ logger = logging.get_logger(__name__)
35
+
36
+ if is_flash_attn_2_available():
37
+ from transformers.modeling_flash_attention_utils import _flash_attention_forward
38
+
39
+ import einops
40
+
41
+ MorehFlashAttention = None
42
+ try:
43
+ kernelRMSNorm = activation.layers.RMSNorm
44
+ PolyNormKernel = activation.layers.PolyNorm
45
+ logger.warning_once("Using kernel ops")
46
+ except AttributeError:
47
+ kernelRMSNorm = None
48
+ PolyNormKernel = None
49
+ logger.warning_once("Failed to import moreh ops")
50
+
51
+ _CONFIG_FOR_DOC = "MotifConfig"
52
+
53
+
54
+ class PolyNormTorch(torch.nn.Module):
55
+ """
56
+ A trainable activation function introduced in https://arxiv.org/html/2411.03884v1.
57
+ The code is copied from https://github.com/BryceZhuo/PolyCom?tab=readme-ov-file/README.md,
58
+ with the change `* torch.rsqrt` => `/ torch.sqrt`.
59
+ """
60
+
61
+ def __init__(self, eps=1e-6):
62
+ super(PolyNorm, self).__init__()
63
+ self.weight = torch.nn.Parameter(torch.ones(3) / 3)
64
+ self.bias = torch.nn.Parameter(torch.zeros(1))
65
+ self.eps = eps
66
+
67
+ def _norm(self, x):
68
+ return x / torch.sqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
69
+
70
+ def forward(self, x):
71
+ return (
72
+ self.weight[0] * self._norm(x**3)
73
+ + self.weight[1] * self._norm(x**2)
74
+ + self.weight[2] * self._norm(x)
75
+ + self.bias
76
+ )
77
+
78
+
79
+ PolyNorm = PolyNormKernel if PolyNormKernel is not None else PolyNormTorch
80
+ CUSTOM_ACT2CLS = {"poly_norm": PolyNorm}
81
+ ACT2CLS = {**_ACT2CLS, **CUSTOM_ACT2CLS}
82
+ ACT2FN = ClassInstantier(ACT2CLS)
83
+
84
+
85
+ class MotifRMSNorm(nn.Module):
86
+ def __init__(self, hidden_size, eps=1e-6):
87
+ """
88
+ MotifRMSNorm is equivalent to T5LayerNorm
89
+ """
90
+ super().__init__()
91
+ self.weight = nn.Parameter(torch.ones(hidden_size))
92
+ self.variance_epsilon = eps
93
+
94
+ def forward(self, hidden_states):
95
+ input_dtype = hidden_states.dtype
96
+ hidden_states = hidden_states.to(torch.float32)
97
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
98
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
99
+ return self.weight * hidden_states.to(input_dtype)
100
+
101
+ def extra_repr(self):
102
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
103
+
104
+
105
+ class MotifRotaryEmbeddingWithCache(nn.Module):
106
+ """
107
+ Rotary positional embedding module with caching for efficiency.
108
+
109
+ Args:
110
+ dim (int): Dimensionality of the embedding.
111
+ max_position_embeddings (int): Maximum sequence length for caching. Default is 2048.
112
+ base (int): Base for computing inverse frequency. Default is 10000.
113
+ device (torch.device, optional): Device for tensor storage.
114
+
115
+ Methods:
116
+ forward(x, seq_len=None):
117
+ Computes cosine and sine embeddings for input sequence length.
118
+ Automatically updates cache if `seq_len` exceeds cached length.
119
+
120
+ Attributes:
121
+ inv_freq (torch.Tensor): Inverse frequency tensor for position encoding.
122
+ cos_cached (torch.Tensor): Cached cosine embeddings.
123
+ sin_cached (torch.Tensor): Cached sine embeddings.
124
+ """
125
+
126
+ def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
127
+ super().__init__()
128
+
129
+ self.dim = dim
130
+ self.max_position_embeddings = max_position_embeddings
131
+ self.base = base
132
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
133
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
134
+
135
+ # Build here to make `torch.jit.trace` work.
136
+ self._set_cos_sin_cache(
137
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
138
+ )
139
+
140
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
141
+ self.max_seq_len_cached = seq_len
142
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=self.inv_freq.dtype)
143
+
144
+ freqs = torch.outer(t, self.inv_freq)
145
+ # Different from paper, but it uses a different permutation in order to obtain the same calculation
146
+ emb = torch.cat((freqs, freqs), dim=-1)
147
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
148
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
149
+
150
+ def forward(self, x, seq_len=None):
151
+ # x: [bs, num_attention_heads, seq_len, head_size]
152
+ if seq_len > self.max_seq_len_cached:
153
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
154
+
155
+ return (
156
+ self.cos_cached[:seq_len].to(dtype=x.dtype),
157
+ self.sin_cached[:seq_len].to(dtype=x.dtype),
158
+ )
159
+
160
+
161
+ class MotifRotaryEmbedding(nn.Module):
162
+ def __init__(
163
+ self,
164
+ dim=None,
165
+ max_position_embeddings=2048,
166
+ base=10000,
167
+ device=None,
168
+ scaling_factor=1.0,
169
+ rope_type="default",
170
+ config: Optional[MotifConfig] = None,
171
+ ):
172
+ super().__init__()
173
+ # TODO (joao): remove the `if` below, only used for BC
174
+ self.rope_kwargs = {}
175
+ if config is None:
176
+ logger.warning_once(
177
+ "`MotifRotaryEmbedding` can now be fully parameterized by passing the model config through the "
178
+ "`config` argument. All other arguments will be removed in v4.46"
179
+ )
180
+ self.rope_kwargs = {
181
+ "rope_type": rope_type,
182
+ "factor": scaling_factor,
183
+ "dim": dim,
184
+ "base": base,
185
+ "max_position_embeddings": max_position_embeddings,
186
+ }
187
+ self.rope_type = rope_type
188
+ self.max_seq_len_cached = max_position_embeddings
189
+ self.original_max_seq_len = max_position_embeddings
190
+ else:
191
+ # BC: "rope_type" was originally "type"
192
+ if config.rope_scaling is not None:
193
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
194
+ else:
195
+ self.rope_type = "default"
196
+ self.max_seq_len_cached = config.max_position_embeddings
197
+ self.original_max_seq_len = config.max_position_embeddings
198
+
199
+ self.config = config
200
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
201
+
202
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device, **self.rope_kwargs)
203
+
204
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
205
+ self.original_inv_freq = self.inv_freq
206
+
207
+ def _dynamic_frequency_update(self, position_ids, device):
208
+ """
209
+ dynamic RoPE layers should recompute `inv_freq` in the following situations:
210
+ 1 - growing beyond the cached sequence length (allow scaling)
211
+ 2 - the current sequence length is in the original scale (avoid losing precision with small sequences)
212
+ """
213
+ seq_len = torch.max(position_ids) + 1
214
+ if seq_len > self.max_seq_len_cached: # growth
215
+ inv_freq, self.attention_scaling = self.rope_init_fn(
216
+ self.config, device, seq_len=seq_len, **self.rope_kwargs
217
+ )
218
+ self.register_buffer("inv_freq", inv_freq, persistent=False) # TODO joao: may break with compilation
219
+ self.max_seq_len_cached = seq_len
220
+
221
+ if seq_len < self.original_max_seq_len and self.max_seq_len_cached > self.original_max_seq_len: # reset
222
+ self.register_buffer("inv_freq", self.original_inv_freq, persistent=False)
223
+ self.max_seq_len_cached = self.original_max_seq_len
224
+
225
+ @torch.no_grad()
226
+ def forward(self, x, position_ids):
227
+ if "dynamic" in self.rope_type:
228
+ self._dynamic_frequency_update(position_ids, device=x.device)
229
+
230
+ # Core RoPE block
231
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
232
+ position_ids_expanded = position_ids[:, None, :].float()
233
+ # Force float32 (see https://github.com/huggingface/transformers/pull/29285)
234
+ device_type = x.device.type
235
+ device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
236
+ with torch.autocast(device_type=device_type, enabled=False):
237
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
238
+ emb = torch.cat((freqs, freqs), dim=-1)
239
+ cos = emb.cos()
240
+ sin = emb.sin()
241
+
242
+ # Advanced RoPE types (e.g. yarn) apply a post-processing scaling factor, equivalent to scaling attention
243
+ cos = cos * self.attention_scaling
244
+ sin = sin * self.attention_scaling
245
+
246
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
247
+
248
+
249
+ def rotate_half(x):
250
+ """
251
+ Rotates half of the dimensions of the input tensor using torch.roll and in-place negation.
252
+
253
+ Args:
254
+ x (torch.Tensor): The input tensor.
255
+
256
+ Returns:
257
+ torch.Tensor: A tensor where the latter half of the dimensions are negated
258
+ and moved before the first half.
259
+ """
260
+ half_size = x.shape[-1] // 2
261
+ rotated_tensor = torch.roll(x, shifts=-half_size, dims=-1)
262
+ rotated_tensor[..., :half_size] *= -1
263
+
264
+ return rotated_tensor
265
+
266
+
267
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1, fused_rope=False):
268
+ """
269
+ Applies rotary position embeddings to the input tensors.
270
+ Args:
271
+ q (torch.Tensor): Query tensor of shape (B, NH, S, D_KV).
272
+ k (torch.Tensor): Key tensor of shape (B, NH, S, D_KV).
273
+ cos (torch.Tensor): Cosine values for rotary embedding.
274
+ sin (torch.Tensor): Sine values for rotary embedding.
275
+ unsqueeze_dim (int, optional): Dimension along which `cos` and `sin` are unsqueezed.
276
+ Defaults to 1.
277
+ Returns:
278
+ Tuple[torch.Tensor, torch.Tensor]: Returns transformed query and key tensors after applying rotary embeddings.
279
+ """
280
+ '''
281
+ # (B, NH, S, D_KV) -> (B, S, NH, D_KV)
282
+ cos = cos.unsqueeze(unsqueeze_dim)
283
+ sin = sin.unsqueeze(unsqueeze_dim)
284
+ q_embed = (q * cos) + (rotate_half(q) * sin)
285
+ k_embed = (k * cos) + (rotate_half(k) * sin)
286
+ '''
287
+ if fused_rope:
288
+ raise NotImplementedError("Fused rotary embedding not yet supported.")
289
+
290
+ device = q.device
291
+ return map(
292
+ lambda x: (x * cos[position_ids].unsqueeze(unsqueeze_dim).to(device)) +
293
+ (rotate_half(x) * sin[position_ids].unsqueeze(unsqueeze_dim).to(device)), (q, k))
294
+
295
+
296
+ class MotifMLP(nn.Module):
297
+ def __init__(self, config):
298
+ super().__init__()
299
+ self.hidden_size = config.hidden_size
300
+ self.intermediate_size = config.intermediate_size
301
+
302
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
303
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
304
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
305
+ self.act_fn = ACT2FN[config.hidden_act]
306
+
307
+
308
+ def forward(self, hidden_state):
309
+ hidden_state = self.act_fn(self.gate_proj(hidden_state).float()).bfloat16() * self.up_proj(hidden_state)
310
+ return self.down_proj(hidden_state)
311
+
312
+
313
+ def repeat_kv(hidden_states: torch.Tensor, dim: int, n_rep: int) -> torch.Tensor:
314
+ return torch.repeat_interleave(hidden_states, dim=dim, repeats=n_rep)
315
+
316
+
317
+ class MotifAttention(nn.Module):
318
+ """
319
+ Differential Attention (DiffAttention) module.
320
+
321
+ Implements the Differential Attention from
322
+ "DIFFERENTIAL TRANSFORMER" (https://arxiv.org/pdf/2410.05258).
323
+
324
+ Overview
325
+ Standard transformers often over-allocate attention to irrelevant context.
326
+ DiffAttention addresses this by computing attention as the difference between
327
+ two separate softmax attention maps, effectively canceling noise and promoting
328
+ sparse, structured attention patterns.
329
+
330
+ Reference Implementation
331
+ https://github.com/microsoft/unilm/tree/master/Diff-Transformer
332
+
333
+ Args
334
+ The differential attention mechanism computes attention as the difference of two softmax attention scores, weighted by a learnable scalar λ.
335
+ λ is re-parameterized as λ = exp(λ_q1 · λ_k1) − exp(λ_q2 · λ_k2) + λ_init.
336
+ - lambda_q1, lambda_q2 (nn.Parameter): Learnable vectors used to compute the first and second components of λ for query transformations.
337
+ - lambda_k1, lambda_k2 (nn.Parameter): Learnable vectors used to compute the first and second components of λ for key transformations.
338
+ - lambda_init (float): A constant used for initializing λ, typically set as λ_init = 0.8 − 0.6 × exp(−0.3 × (layer_index − 1)).
339
+
340
+ """
341
+
342
+ def __init__(self, config: MotifConfig, layer_idx: Optional[int] = None):
343
+ super().__init__()
344
+ self.config = config
345
+ self.layer_idx = layer_idx
346
+ if layer_idx is None:
347
+ logger.warning_once(
348
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
349
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
350
+ "when creating this class."
351
+ )
352
+
353
+ self.hidden_size = config.hidden_size
354
+ self.num_heads = config.num_attention_heads
355
+ self.head_dim = self.hidden_size // self.num_heads if config.head_dim is None else config.head_dim
356
+ self.num_key_value_heads = config.num_key_value_heads
357
+ self.max_position_embeddings = config.max_position_embeddings
358
+ self.rope_theta = config.rope_theta
359
+ self.is_causal = True
360
+ self.attention_dropout = config.attention_dropout
361
+
362
+ """
363
+ Grouped Differential Transformer. The group ratio is defined as origin_heads / noised_heads.
364
+ Only integer ratios are allowed; in other words, origin_heads must be a multiple of noised_heads.
365
+ """
366
+ self.num_noise_heads = config.num_noise_heads
367
+ self.grouped_ratio = (self.num_heads - self.num_noise_heads) // self.num_noise_heads
368
+ self.q_heads = (self.grouped_ratio + 1) * self.num_noise_heads
369
+ # Used only for motif-small, expanded from motif-tiny.
370
+ self.expanded = getattr(config, "expanded", False)
371
+
372
+ if (self.head_dim * self.num_heads) != self.hidden_size and not self.expanded:
373
+ raise ValueError(
374
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
375
+ f" and `num_heads`: {self.num_heads})."
376
+ )
377
+
378
+ # re-init projections
379
+ self.q_proj = nn.Linear(self.hidden_size, self.q_heads * self.head_dim, bias=False)
380
+ self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=False)
381
+ self.k_ratio = config.k_ratio
382
+ k_noise_heads = self.num_key_value_heads // (self.k_ratio + 1)
383
+ self.kv_repeat = self.num_noise_heads // k_noise_heads
384
+
385
+ self.v_proj = nn.Linear(self.hidden_size, 2 * k_noise_heads * self.head_dim, bias=False)
386
+ self.o_proj = nn.Linear(
387
+ 2 * self.grouped_ratio * self.num_noise_heads * self.head_dim, self.hidden_size, bias=False
388
+ )
389
+
390
+ # init lambdas
391
+ for name in ["lambda_q1", "lambda_k1", "lambda_q2", "lambda_k2"]:
392
+ setattr(self, name, nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32)))
393
+ getattr(self, name).data.normal_(mean=0.0, std=0.1)
394
+
395
+ # Uses same norm as motif norm, without elementwise_affine option
396
+ RMSNorm = kernelRMSNorm if kernelRMSNorm is not None else MotifRMSNorm
397
+ self.subln = RMSNorm(2 * self.head_dim, eps=1e-5)
398
+ self.lambda_init = 0.8 - 0.6 * math.exp(-0.3 * (layer_idx - 1))
399
+
400
+ self.rotary_emb = MotifRotaryEmbeddingWithCache(
401
+ self.head_dim, max_position_embeddings=self.max_position_embeddings, base=self.rope_theta
402
+ )
403
+
404
+ self.fused_rope = getattr(config, "fused_rope", False)
405
+
406
+ def _reshape_heads(self, tensor, grouped_ratio, num_groups):
407
+ """2-way head split tensor reshape"""
408
+
409
+ # split by num_heads, the stripe pattern is friendly to tensor parallel.
410
+ tensor = einops.rearrange(
411
+ tensor,
412
+ "... (num_groups group_size) D -> ... num_groups group_size D",
413
+ num_groups=num_groups,
414
+ group_size=grouped_ratio + 1,
415
+ )
416
+
417
+ tensor1 = tensor[..., :grouped_ratio, :]
418
+ tensor2 = tensor[..., grouped_ratio:, :]
419
+
420
+ return tensor1.contiguous(), tensor2.contiguous()
421
+
422
+
423
+ def _restore_shape(self, tensor, batch_size, seq_len):
424
+ """restore tensor"""
425
+ return tensor.reshape(batch_size, seq_len, -1, self.head_dim)
426
+
427
+
428
+ def forward(
429
+ self,
430
+ hidden_states: torch.Tensor,
431
+ attention_mask: Optional[torch.Tensor] = None,
432
+ position_ids: Optional[torch.LongTensor] = None,
433
+ past_key_value: Optional[Cache] = None,
434
+ output_attentions: bool = False,
435
+ use_cache: bool = False,
436
+ cache_position: Optional[torch.LongTensor] = None,
437
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.46
438
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
439
+ assert self.grouped_ratio == 1, "Vanilla attention cannot be used when grouped_ratio > 1."
440
+
441
+ bsz, q_len, _ = hidden_states.size()
442
+
443
+ query_states = self.q_proj(hidden_states)
444
+ key_states = self.k_proj(hidden_states)
445
+ value_states = self.v_proj(hidden_states)
446
+
447
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
448
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
449
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, -1).transpose(1, 2)
450
+
451
+ kv_seq_len = key_states.shape[-2]
452
+
453
+ if position_embeddings is None:
454
+ logger.warning_once(
455
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
456
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
457
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.46 `position_ids` will be "
458
+ "removed and `position_embeddings` will be mandatory."
459
+ )
460
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
461
+ else:
462
+ cos, sin = (
463
+ self.rotary_emb(value_states, q_len + past_key_value.get_seq_length(self.layer_idx))
464
+ if use_cache
465
+ else position_embeddings
466
+ )
467
+
468
+ query_states, key_states = apply_rotary_pos_emb(
469
+ query_states, key_states, cos, sin, position_ids=position_ids, fused_rope=self.fused_rope
470
+ )
471
+
472
+ if past_key_value is not None:
473
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position} # Specific to RoPE models
474
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
475
+
476
+ key_states = repeat_kv(key_states, 1, self.num_key_value_groups)
477
+ value_states = repeat_kv(value_states, 1, self.num_key_value_groups)
478
+
479
+ # repeat k/v heads if n_kv_heads < n_heads
480
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
481
+
482
+ kv_seq_len = key_states.shape[-2]
483
+ offset = kv_seq_len - q_len
484
+
485
+ attention_mask = torch.triu(
486
+ torch.full((q_len, kv_seq_len), float("-inf"), dtype=attn_weights.dtype, device=attn_weights.device),
487
+ 1 + offset,
488
+ )
489
+
490
+ attn_weights = attn_weights + attention_mask
491
+
492
+ # upcast attention to fp32
493
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
494
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
495
+
496
+ # differential transformer lambdas
497
+ lambda_1 = torch.exp(torch.sum(self.lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(attn_weights)
498
+ lambda_2 = torch.exp(torch.sum(self.lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(attn_weights)
499
+ lambda_full = lambda_1 - lambda_2 + self.lambda_init
500
+ attn_weights = attn_weights.view(bsz, self.num_heads, 2, q_len, -1)
501
+ attn_weights = attn_weights[:, :, 0] - lambda_full * attn_weights[:, :, 1]
502
+
503
+ attn_output = torch.matmul(attn_weights, value_states)
504
+ attn_output = self.subln(attn_output)
505
+ attn_output = attn_output * (1 - self.lambda_init)
506
+
507
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim * 2):
508
+ raise ValueError(
509
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
510
+ f" {attn_output.size()}"
511
+ )
512
+
513
+ attn_output = attn_output.transpose(1, 2).contiguous()
514
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
515
+
516
+ attn_output = self.o_proj(attn_output)
517
+
518
+ if not output_attentions:
519
+ attn_weights = None
520
+
521
+ return attn_output, attn_weights, past_key_value
522
+
523
+
524
+ class MotifFlashAttention2(MotifAttention):
525
+ """
526
+ Motif flash attention module, following Motif attention module. This module inherits from `MotifAttention`
527
+ as the weights of the module stays untouched. The only required change would be on the forward pass
528
+ where it needs to correctly call the public API of flash attention and deal with padding tokens
529
+ in case the input contains any of them. Additionally, for sliding window attention, we apply SWA only to the bottom
530
+ config.max_window_layers layers.
531
+ """
532
+
533
+ # Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2.__init__
534
+ def __init__(self, *args, **kwargs):
535
+ super().__init__(*args, **kwargs)
536
+
537
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
538
+ # 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.
539
+ # 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).
540
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
541
+
542
+ def _compute_attention(
543
+ self,
544
+ query_states,
545
+ key_states,
546
+ value_states,
547
+ attention_mask,
548
+ q_len,
549
+ position_ids,
550
+ dropout_rate,
551
+ sliding_window,
552
+ ):
553
+ """Flash Attention 2 implements"""
554
+
555
+ return _flash_attention_forward(
556
+ query_states,
557
+ key_states,
558
+ value_states,
559
+ attention_mask,
560
+ q_len,
561
+ position_ids=position_ids,
562
+ dropout=dropout_rate,
563
+ sliding_window=sliding_window,
564
+ is_causal=self.is_causal,
565
+ use_top_left_mask=self._flash_attn_uses_top_left_mask,
566
+ )
567
+
568
+ def forward(
569
+ self,
570
+ hidden_states: torch.Tensor,
571
+ attention_mask: Optional[torch.Tensor] = None,
572
+ position_ids: Optional[torch.LongTensor] = None,
573
+ past_key_value: Optional[Cache] = None,
574
+ output_attentions: bool = False,
575
+ use_cache: bool = False,
576
+ cache_position: Optional[torch.LongTensor] = None,
577
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.46
578
+ ):
579
+ bsz, q_len, _ = hidden_states.size()
580
+
581
+ query_states = self.q_proj(hidden_states)
582
+ key_states = self.k_proj(hidden_states)
583
+ value_states = self.v_proj(hidden_states)
584
+
585
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
586
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
587
+ value_states = value_states.view(bsz, q_len, -1, self.head_dim).transpose(1, 2)
588
+
589
+ kv_seq_len = key_states.shape[-2]
590
+
591
+ if position_embeddings is None:
592
+ logger.warning_once(
593
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
594
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
595
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.46 `position_ids` will be "
596
+ "removed and `position_embeddings` will be mandatory."
597
+ )
598
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
599
+ else:
600
+ cos, sin = (
601
+ self.rotary_emb(value_states, q_len + past_key_value.get_seq_length(self.layer_idx))
602
+ if use_cache
603
+ else position_embeddings
604
+ )
605
+
606
+ query_states, key_states = apply_rotary_pos_emb(
607
+ query_states, key_states, cos, sin, position_ids=position_ids, fused_rope=self.fused_rope
608
+ )
609
+
610
+ if past_key_value is not None:
611
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position} # Specific to RoPE models
612
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
613
+
614
+ dropout_rate = 0.0 if not self.training else self.attention_dropout
615
+
616
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
617
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
618
+ # cast them back in float16 just to be sure everything works as expected.
619
+ input_dtype = query_states.dtype
620
+ if input_dtype == torch.float32 and MorehFlashAttention is None:
621
+ if torch.is_autocast_enabled():
622
+ target_dtype = torch.get_autocast_gpu_dtype()
623
+ # Handle the case where the model is quantized
624
+ elif hasattr(self.config, "_pre_quantization_dtype"):
625
+ target_dtype = self.config._pre_quantization_dtype
626
+ else:
627
+ target_dtype = self.q_proj.weight.dtype
628
+
629
+ logger.warning_once(
630
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
631
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
632
+ f" {target_dtype}."
633
+ )
634
+
635
+ query_states = query_states.to(target_dtype)
636
+ key_states = key_states.to(target_dtype)
637
+ value_states = value_states.to(target_dtype)
638
+
639
+ q_len = query_states.shape[-2]
640
+ kv_seq_len = key_states.shape[-2]
641
+
642
+ # Reashape to the expected shape for Flash Attention
643
+ query_states = query_states.transpose(1, 2)
644
+ key_states = key_states.transpose(1, 2)
645
+ value_states = value_states.transpose(1, 2)
646
+
647
+ if (
648
+ self.config.use_sliding_window
649
+ and getattr(self.config, "sliding_window", None) is not None
650
+ and self.layer_idx >= self.config.max_window_layers
651
+ and MorehFlashAttention is None
652
+ ):
653
+ sliding_window = self.config.sliding_window
654
+ else:
655
+ sliding_window = None
656
+
657
+ num_groups = self.q_heads // (self.grouped_ratio + 1)
658
+ q1, q2 = self._reshape_heads(query_states, self.grouped_ratio, num_groups)
659
+
660
+ num_groups = self.num_key_value_heads // (self.k_ratio + 1)
661
+ k1, k2 = self._reshape_heads(key_states, self.k_ratio, num_groups)
662
+ v1, v2 = self._reshape_heads(value_states, 1, num_groups)
663
+
664
+ q1, q2 = self._restore_shape(q1, bsz, q_len), self._restore_shape(q2, bsz, q_len)
665
+ k1, k2 = self._restore_shape(k1, bsz, kv_seq_len), self._restore_shape(k2, bsz, kv_seq_len)
666
+ v1, v2 = self._restore_shape(v1, bsz, kv_seq_len), self._restore_shape(v2, bsz, kv_seq_len)
667
+
668
+ q_f = torch.cat([q1, q2], dim=2)
669
+
670
+ num_kv_groups = q1.shape[2] // k1.shape[2]
671
+
672
+ k1 = repeat_kv(k1, 2, self.kv_repeat)
673
+ k2 = repeat_kv(k2, 2, self.kv_repeat)
674
+ v1 = repeat_kv(v1, 2, self.kv_repeat)
675
+ v2 = repeat_kv(v2, 2, self.kv_repeat)
676
+
677
+ if self.k_ratio == 1:
678
+ k_f = torch.cat([repeat_kv(k1, 2, self.grouped_ratio), k2], dim=2)
679
+ else:
680
+ k_f = torch.cat([k1, k2], dim=2)
681
+ v1_f = torch.cat([repeat_kv(v1, 2, self.grouped_ratio), v1], dim=2)
682
+ v2_f = torch.cat([repeat_kv(v2, 2, self.grouped_ratio), v2], dim=2)
683
+
684
+ attn_1, attn_2 = (
685
+ self._compute_attention(
686
+ q_f, k_f, v1_f, attention_mask, q_len, position_ids, dropout_rate, sliding_window
687
+ ),
688
+ self._compute_attention(
689
+ q_f, k_f, v2_f, attention_mask, q_len, position_ids, dropout_rate, sliding_window
690
+ ),
691
+ )
692
+
693
+ merged_attn = torch.cat([attn_1, attn_2], dim=-1)
694
+ attn_o = merged_attn[..., :-num_groups, :]
695
+ attn_n_group = merged_attn[..., -num_groups:, :]
696
+ attn_n = repeat_kv(attn_n_group, 2, self.grouped_ratio)
697
+
698
+ lambda_q1 = self.lambda_q1.unsqueeze(0).expand([bsz, self.lambda_q1.shape[0]])
699
+ lambda_q2 = self.lambda_q2.unsqueeze(0).expand([bsz, self.lambda_q2.shape[0]])
700
+
701
+ lambda_1 = torch.exp(torch.sum(lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(attn_o)
702
+ lambda_2 = torch.exp(torch.sum(lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(attn_n)
703
+
704
+ lambda_full = lambda_1 - lambda_2 + self.lambda_init
705
+
706
+ attn_output = attn_o - lambda_full.view([bsz, 1, 1, 1]) * attn_n
707
+
708
+ attn_output = self.subln(attn_output.float()).bfloat16()
709
+ attn_output = attn_output * (1 - self.lambda_init)
710
+
711
+ if attn_output.size() != (bsz, q_len, self.grouped_ratio * self.num_noise_heads, self.head_dim * 2):
712
+ raise ValueError(
713
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
714
+ f" {attn_output.size()}"
715
+ )
716
+
717
+ attn_output = attn_output.reshape(bsz, q_len, -1)
718
+ attn_output = self.o_proj(attn_output)
719
+
720
+ return attn_output, None, past_key_value
721
+
722
+
723
+ class MotifSdpaAttention(MotifAttention):
724
+ """
725
+ Motif attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
726
+ `MotifAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
727
+ SDPA API.
728
+ """
729
+
730
+ # Adapted from MotifAttention.forward
731
+ def forward(
732
+ self,
733
+ hidden_states: torch.Tensor,
734
+ attention_mask: Optional[torch.Tensor] = None,
735
+ position_ids: Optional[torch.LongTensor] = None,
736
+ past_key_value: Optional[Cache] = None,
737
+ output_attentions: bool = False,
738
+ use_cache: bool = False,
739
+ cache_position: Optional[torch.LongTensor] = None,
740
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.46
741
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
742
+ assert self.grouped_ratio == 1, "Scaled dot product attention cannot be used when grouped_ratio > 1."
743
+ if output_attentions:
744
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
745
+ logger.warning_once(
746
+ "MotifModel is using MotifSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
747
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
748
+ )
749
+ return super().forward(
750
+ hidden_states=hidden_states,
751
+ attention_mask=attention_mask,
752
+ position_ids=position_ids,
753
+ past_key_value=past_key_value,
754
+ output_attentions=output_attentions,
755
+ use_cache=use_cache,
756
+ )
757
+
758
+ bsz, q_len, _ = hidden_states.size()
759
+
760
+ query_states = self.q_proj(hidden_states)
761
+ key_states = self.k_proj(hidden_states)
762
+ value_states = self.v_proj(hidden_states)
763
+
764
+ query_states = query_states.view(bsz, q_len, 2 * self.num_heads, self.head_dim).transpose(1, 2)
765
+ key_states = key_states.view(bsz, q_len, 2 * self.num_key_value_heads, self.head_dim).transpose(1, 2)
766
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, 2 * self.head_dim).transpose(1, 2)
767
+
768
+ kv_seq_len = key_states.shape[-2]
769
+
770
+ if position_embeddings is None:
771
+ logger.warning_once(
772
+ "The attention layers in this model are transitioning from computing the RoPE embeddings internally "
773
+ "through `position_ids` (2D tensor with the indexes of the tokens), to using externally computed "
774
+ "`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.46 `position_ids` will be "
775
+ "removed and `position_embeddings` will be mandatory."
776
+ )
777
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
778
+ else:
779
+ cos, sin = (
780
+ self.rotary_emb(value_states, q_len + past_key_value.get_seq_length(self.layer_idx))
781
+ if use_cache
782
+ else position_embeddings
783
+ )
784
+
785
+ query_states, key_states = apply_rotary_pos_emb(
786
+ query_states, key_states, cos, sin, position_ids=position_ids, fused_rope=self.fused_rope
787
+ )
788
+
789
+ if past_key_value is not None:
790
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position} # Specific to RoPE models
791
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
792
+
793
+ dropout_rate = 0.0 if not self.training else self.attention_dropout
794
+
795
+ q = query_states.transpose(1, 2)
796
+ k = key_states.transpose(1, 2)
797
+ v = value_states.transpose(1, 2)
798
+
799
+ num_groups = self.q_heads // (self.grouped_ratio + 1)
800
+ q1, q2 = self._reshape_heads(query_states, self.grouped_ratio, num_groups)
801
+
802
+ num_groups = self.num_key_value_heads // (self.k_ratio + 1)
803
+ k1, k2 = self._reshape_heads(key_states, self.k_ratio, num_groups)
804
+ v1, v2 = self._reshape_heads(value_states, 1, num_groups)
805
+
806
+ q1, q2 = self._restore_shape(q1, bsz, q_len), self._restore_shape(q2, bsz, q_len)
807
+ k1, k2 = self._restore_shape(k1, bsz, kv_seq_len), self._restore_shape(k2, bsz, kv_seq_len)
808
+ v1, v2 = self._restore_shape(v1, bsz, kv_seq_len), self._restore_shape(v2, bsz, kv_seq_len)
809
+
810
+ q_f = torch.cat([q1, q2], dim=2)
811
+
812
+ if self.k_ratio == 1:
813
+ k_f = torch.cat([repeat_kv(k1, 2, self.grouped_ratio), k2], dim=2)
814
+ else:
815
+ k_f = torch.cat([k1, k2], dim=2)
816
+
817
+ scale_factor = 1.0 / (self.head_dim**0.5)
818
+ masked_bias = attention_mask.expand(bsz, self.q_heads, q_len, kv_seq_len)
819
+
820
+ attn1 = ScaledDotProductAttention(
821
+ q_f, k_f, v1_f, masked_bias, dropout_rate, self.training, scale_factor, False
822
+ )
823
+ attn2 = ScaledDotProductAttention(
824
+ q_f, k_f, v2_f, masked_bias, dropout_rate, self.training, scale_factor, False
825
+ )
826
+
827
+ merged_attn = torch.cat([attn_1, attn_2], dim=-1)
828
+ attn_o = merged_attn[..., :-num_groups, :]
829
+ attn_n_group = merged_attn[..., -num_groups:, :]
830
+ attn_n = repeat_kv(attn_n_group, 2, self.grouped_ratio)
831
+
832
+ lambda_1 = torch.exp(torch.sum(self.lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(q)
833
+ lambda_2 = torch.exp(torch.sum(self.lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(q)
834
+ lambda_full = lambda_1 - lambda_2 + self.lambda_init
835
+ attn_output = attn_o - lambda_full.view([bsz, 1, 1, 1]) * attn_n
836
+
837
+ attn_output = self.subln(attn_output.float()).bfloat16()
838
+ attn_output = attn_output * (1 - self.lambda_init)
839
+
840
+ if attn_output.size() != (bsz, q_len, self.grouped_ratio * self.num_noise_heads, self.head_dim * 2):
841
+ raise ValueError(
842
+ f"`attn_output` should be of size {(bsz, self.grouped_ratio * self.num_noise_heads, q_len, self.head_dim)}, but is"
843
+ f" {attn_output.size()}"
844
+ )
845
+
846
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
847
+ attn_output = self.o_proj(attn_output)
848
+
849
+ return attn_output, None, past_key_value
850
+
851
+
852
+ MOTIF_ATTENTION_CLASSES = {
853
+ "eager": MotifAttention,
854
+ "flash_attention_2": MotifFlashAttention2,
855
+ "sdpa": MotifSdpaAttention,
856
+ }
857
+
858
+
859
+ class MotifDecoderLayer(nn.Module):
860
+ def __init__(self, config: MotifConfig, layer_idx: int):
861
+ super().__init__()
862
+ self.hidden_size = config.hidden_size
863
+ if config.sliding_window and config._attn_implementation != "flash_attention_2":
864
+ logger.warning_once(
865
+ f"Sliding Window Attention is enabled but not implemented for `{config._attn_implementation}`; "
866
+ "unexpected results may be encountered."
867
+ )
868
+ self.self_attn = MOTIF_ATTENTION_CLASSES[config._attn_implementation](config, layer_idx)
869
+
870
+ self.mlp = MotifMLP(config)
871
+ RMSNorm = kernelRMSNorm if kernelRMSNorm is not None else MotifRMSNorm
872
+ self.input_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
873
+ self.post_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
874
+
875
+ def forward(
876
+ self,
877
+ hidden_states: torch.Tensor,
878
+ attention_mask: Optional[torch.Tensor] = None,
879
+ position_ids: Optional[torch.LongTensor] = None,
880
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
881
+ output_attentions: Optional[bool] = False,
882
+ use_cache: Optional[bool] = False,
883
+ cache_position: Optional[torch.LongTensor] = None,
884
+ position_embeddings: Optional[Tuple[torch.Tensor, torch.Tensor]] = None, # will become mandatory in v4.46
885
+ **kwargs,
886
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
887
+ """
888
+ Args:
889
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
890
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
891
+ `(batch, sequence_length)` where padding elements are indicated by 0.
892
+ output_attentions (`bool`, *optional*):
893
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
894
+ returned tensors for more detail.
895
+ use_cache (`bool`, *optional*):
896
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
897
+ (see `past_key_values`).
898
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
899
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
900
+ Indices depicting the position of the input sequence tokens in the sequence.
901
+ position_embeddings (`Tuple[torch.FloatTensor, torch.FloatTensor]`, *optional*):
902
+ Tuple containing the cosine and sine positional embeddings of shape `(batch_size, seq_len, head_dim)`,
903
+ with `head_dim` being the embedding dimension of each attention head.
904
+ kwargs (`dict`, *optional*):
905
+ Arbitrary kwargs to be ignored, used for FSDP and other methods that injects code
906
+ into the model
907
+ """
908
+
909
+ residual = hidden_states
910
+
911
+ hidden_states = self.input_layernorm(hidden_states.float()).bfloat16()
912
+
913
+ # Self Attention
914
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
915
+ hidden_states=hidden_states,
916
+ attention_mask=attention_mask,
917
+ position_ids=position_ids,
918
+ past_key_value=past_key_value,
919
+ output_attentions=output_attentions,
920
+ use_cache=use_cache,
921
+ cache_position=cache_position,
922
+ position_embeddings=position_embeddings,
923
+ )
924
+ hidden_states = residual + hidden_states
925
+
926
+ # Fully Connected
927
+ residual = hidden_states
928
+ hidden_states = self.post_attention_layernorm(hidden_states.float()).bfloat16()
929
+ hidden_states = self.mlp(hidden_states)
930
+ hidden_states = residual + hidden_states
931
+
932
+ outputs = (hidden_states,)
933
+
934
+ if output_attentions:
935
+ outputs += (self_attn_weights,)
936
+
937
+ if use_cache:
938
+ outputs += (present_key_value,)
939
+
940
+ return outputs
941
+
942
+
943
+ MOTIF_START_DOCSTRING = r"""
944
+ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
945
+ library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
946
+ etc.)
947
+
948
+ This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
949
+ Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
950
+ and behavior.
951
+
952
+ Parameters:
953
+ config ([`MotifConfig`]):
954
+ Model configuration class with all the parameters of the model. Initializing with a config file does not
955
+ load the weights associated with the model, only the configuration. Check out the
956
+ [`~PreTrainedModel.from_pretrained`] method to load the model weights.
957
+ """
958
+
959
+
960
+ @add_start_docstrings(
961
+ "The bare Motif Model outputting raw hidden-states without any specific head on top.",
962
+ MOTIF_START_DOCSTRING,
963
+ )
964
+ class MotifPreTrainedModel(PreTrainedModel):
965
+ config_class = MotifConfig
966
+ base_model_prefix = "model"
967
+ supports_gradient_checkpointing = True
968
+ _no_split_modules = ["MotifDecoderLayer"]
969
+ _skip_keys_device_placement = "past_key_values"
970
+ _supports_flash_attn_2 = True
971
+ _supports_sdpa = True
972
+ _supports_cache_class = True
973
+ _supports_quantized_cache = True
974
+ _supports_static_cache = True
975
+
976
+ def _init_weights(self, module):
977
+ std = self.config.initializer_range
978
+ if isinstance(module, nn.Linear):
979
+ module.weight.data = torch.where(abs(module.weight.data) > 3 * std, 0, module.weight.data)
980
+ if module.bias is not None:
981
+ module.bias.data.zero_()
982
+
983
+ if module.bias is not None:
984
+ module.bias.data.zero_()
985
+ elif isinstance(module, nn.Embedding):
986
+ module.weight.data = torch.where(abs(module.weight.data) > 3 * std, 0, module.weight.data)
987
+ if module.padding_idx is not None:
988
+ module.weight.data[module.padding_idx].zero_()
989
+
990
+
991
+ MOTIF_INPUTS_DOCSTRING = r"""
992
+ Args:
993
+ input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
994
+ Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
995
+ it.
996
+
997
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
998
+ [`PreTrainedTokenizer.__call__`] for details.
999
+
1000
+ [What are input IDs?](../glossary#input-ids)
1001
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
1002
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
1003
+
1004
+ - 1 for tokens that are **not masked**,
1005
+ - 0 for tokens that are **masked**.
1006
+
1007
+ [What are attention masks?](../glossary#attention-mask)
1008
+
1009
+ Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
1010
+ [`PreTrainedTokenizer.__call__`] for details.
1011
+
1012
+ If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see
1013
+ `past_key_values`).
1014
+
1015
+ If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
1016
+ and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
1017
+ information on the default strategy.
1018
+
1019
+ - 1 indicates the head is **not masked**,
1020
+ - 0 indicates the head is **masked**.
1021
+ position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1022
+ Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
1023
+ config.n_positions - 1]`.
1024
+
1025
+ [What are position IDs?](../glossary#position-ids)
1026
+ past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
1027
+ Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
1028
+ blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
1029
+ returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
1030
+
1031
+ Two formats are allowed:
1032
+ - a [`~cache_utils.Cache`] instance, see our
1033
+ [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache);
1034
+ - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
1035
+ shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
1036
+ cache format.
1037
+
1038
+ The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
1039
+ legacy cache format will be returned.
1040
+
1041
+ If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
1042
+ have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
1043
+ of shape `(batch_size, sequence_length)`.
1044
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
1045
+ Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
1046
+ is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
1047
+ model's internal embedding lookup matrix.
1048
+ use_cache (`bool`, *optional*):
1049
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
1050
+ `past_key_values`).
1051
+ output_attentions (`bool`, *optional*):
1052
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
1053
+ tensors for more detail.
1054
+ output_hidden_states (`bool`, *optional*):
1055
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
1056
+ more detail.
1057
+ return_dict (`bool`, *optional*):
1058
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
1059
+ cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
1060
+ Indices depicting the position of the input sequence tokens in the sequence. Contrarily to `position_ids`,
1061
+ this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
1062
+ the complete sequence length.
1063
+ """
1064
+
1065
+
1066
+ @add_start_docstrings(
1067
+ "The bare Motif Model outputting raw hidden-states without any specific head on top.",
1068
+ MOTIF_START_DOCSTRING,
1069
+ )
1070
+ class MotifModel(MotifPreTrainedModel):
1071
+ """
1072
+ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`MotifDecoderLayer`]
1073
+
1074
+ Args:
1075
+ config: MotifConfig
1076
+ """
1077
+
1078
+ def __init__(self, config: MotifConfig):
1079
+ super().__init__(config)
1080
+ self.padding_idx = config.pad_token_id
1081
+ self.vocab_size = config.vocab_size
1082
+
1083
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
1084
+ self.layers = nn.ModuleList(
1085
+ [MotifDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
1086
+ )
1087
+ self._attn_implementation = config._attn_implementation
1088
+ RMSNorm = kernelRMSNorm if kernelRMSNorm is not None else MotifRMSNorm
1089
+ self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
1090
+ self.hidden_size = config.hidden_size
1091
+ self.num_heads = config.num_attention_heads
1092
+ self.head_dim = self.hidden_size // self.num_heads if config.head_dim is None else config.head_dim
1093
+ self.max_position_embeddings = config.max_position_embeddings
1094
+ self.rope_theta = config.rope_theta
1095
+ self.rotary_emb = MotifRotaryEmbeddingWithCache(
1096
+ self.head_dim, max_position_embeddings=self.max_position_embeddings, base=self.rope_theta
1097
+ )
1098
+
1099
+ self.gradient_checkpointing = False
1100
+ # Initialize weights and apply final processing
1101
+ self.post_init()
1102
+
1103
+ def get_input_embeddings(self):
1104
+ return self.embed_tokens
1105
+
1106
+ def set_input_embeddings(self, value):
1107
+ self.embed_tokens = value
1108
+
1109
+ @add_start_docstrings_to_model_forward(MOTIF_INPUTS_DOCSTRING)
1110
+ def forward(
1111
+ self,
1112
+ input_ids: torch.LongTensor = None,
1113
+ attention_mask: Optional[torch.Tensor] = None,
1114
+ position_ids: Optional[torch.LongTensor] = None,
1115
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1116
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1117
+ use_cache: Optional[bool] = None,
1118
+ output_attentions: Optional[bool] = None,
1119
+ output_hidden_states: Optional[bool] = None,
1120
+ return_dict: Optional[bool] = None,
1121
+ cache_position: Optional[torch.LongTensor] = None,
1122
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
1123
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1124
+ output_hidden_states = (
1125
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1126
+ )
1127
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
1128
+
1129
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1130
+
1131
+ if (input_ids is None) ^ (inputs_embeds is not None):
1132
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
1133
+
1134
+ if self.gradient_checkpointing and self.training:
1135
+ if use_cache:
1136
+ logger.warning_once(
1137
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
1138
+ )
1139
+ use_cache = False
1140
+
1141
+ # kept for BC (non `Cache` `past_key_values` inputs)
1142
+ return_legacy_cache = False
1143
+ if use_cache and not isinstance(past_key_values, Cache):
1144
+ return_legacy_cache = True
1145
+ if past_key_values is None:
1146
+ past_key_values = DynamicCache()
1147
+ else:
1148
+ past_key_values = DynamicCache.from_legacy_cache(past_key_values)
1149
+ logger.warning_once(
1150
+ "We detected that you are passing `past_key_values` as a tuple of tuples. This is deprecated and "
1151
+ "will be removed in v4.47. Please convert your cache or use an appropriate `Cache` class "
1152
+ "(https://huggingface.co/docs/transformers/kv_cache#legacy-cache-format)"
1153
+ )
1154
+
1155
+ if inputs_embeds is None:
1156
+ inputs_embeds = self.embed_tokens(input_ids)
1157
+
1158
+ if cache_position is None:
1159
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
1160
+ cache_position = torch.arange(
1161
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
1162
+ )
1163
+ if position_ids is None:
1164
+ position_ids = cache_position.unsqueeze(0)
1165
+
1166
+ causal_mask = self._update_causal_mask(
1167
+ attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
1168
+ )
1169
+
1170
+ hidden_states = inputs_embeds
1171
+ bsz, q_len, _ = hidden_states.size()
1172
+ # create position embeddings to be shared across the decoder layers
1173
+ position_embeddings = self.rotary_emb(hidden_states, seq_len=q_len)
1174
+
1175
+ # decoder layers
1176
+ all_hidden_states = () if output_hidden_states else None
1177
+ all_self_attns = () if output_attentions else None
1178
+ next_decoder_cache = None
1179
+
1180
+ for decoder_layer in self.layers:
1181
+ if output_hidden_states:
1182
+ all_hidden_states += (hidden_states,)
1183
+
1184
+ if self.gradient_checkpointing and self.training:
1185
+ layer_outputs = self._gradient_checkpointing_func(
1186
+ decoder_layer.__call__,
1187
+ hidden_states,
1188
+ causal_mask,
1189
+ position_ids,
1190
+ past_key_values,
1191
+ output_attentions,
1192
+ use_cache,
1193
+ cache_position,
1194
+ position_embeddings,
1195
+ )
1196
+ else:
1197
+ layer_outputs = decoder_layer(
1198
+ hidden_states,
1199
+ attention_mask=causal_mask,
1200
+ position_ids=position_ids,
1201
+ past_key_value=past_key_values,
1202
+ output_attentions=output_attentions,
1203
+ use_cache=use_cache,
1204
+ cache_position=cache_position,
1205
+ position_embeddings=position_embeddings,
1206
+ )
1207
+
1208
+ hidden_states = layer_outputs[0]
1209
+
1210
+ if use_cache:
1211
+ next_decoder_cache = layer_outputs[2 if output_attentions else 1]
1212
+
1213
+ if output_attentions:
1214
+ all_self_attns += (layer_outputs[1],)
1215
+
1216
+ hidden_states = self.norm(hidden_states.float()).bfloat16()
1217
+
1218
+ # add hidden states from the last decoder layer
1219
+ if output_hidden_states:
1220
+ all_hidden_states += (hidden_states,)
1221
+
1222
+ next_cache = next_decoder_cache if use_cache else None
1223
+ if return_legacy_cache:
1224
+ next_cache = next_cache.to_legacy_cache()
1225
+
1226
+ if not return_dict:
1227
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
1228
+ return BaseModelOutputWithPast(
1229
+ last_hidden_state=hidden_states,
1230
+ past_key_values=next_cache,
1231
+ hidden_states=all_hidden_states,
1232
+ attentions=all_self_attns,
1233
+ )
1234
+
1235
+ def _update_causal_mask(
1236
+ self,
1237
+ attention_mask: torch.Tensor,
1238
+ input_tensor: torch.Tensor,
1239
+ cache_position: torch.Tensor,
1240
+ past_key_values: Cache,
1241
+ output_attentions: bool,
1242
+ ):
1243
+ if self.config._attn_implementation == "flash_attention_2":
1244
+ if MorehFlashAttention is not None:
1245
+ return attention_mask
1246
+ if attention_mask is not None and 0.0 in attention_mask:
1247
+ return attention_mask
1248
+ return None
1249
+
1250
+ # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
1251
+ # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
1252
+ # to infer the attention mask.
1253
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
1254
+ using_static_cache = isinstance(past_key_values, StaticCache)
1255
+ using_sliding_window_cache = isinstance(past_key_values, SlidingWindowCache)
1256
+
1257
+ # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
1258
+ if (
1259
+ self.config._attn_implementation == "sdpa"
1260
+ and not (using_static_cache or using_sliding_window_cache)
1261
+ and not output_attentions
1262
+ ):
1263
+ if AttentionMaskConverter._ignore_causal_mask_sdpa(
1264
+ attention_mask,
1265
+ inputs_embeds=input_tensor,
1266
+ past_key_values_length=past_seen_tokens,
1267
+ sliding_window=self.config.sliding_window,
1268
+ is_training=self.training,
1269
+ ):
1270
+ return None
1271
+
1272
+ dtype, device = input_tensor.dtype, input_tensor.device
1273
+ min_dtype = torch.finfo(dtype).min
1274
+ sequence_length = input_tensor.shape[1]
1275
+ # SlidingWindowCache or StaticCache
1276
+ if using_sliding_window_cache or using_static_cache:
1277
+ target_length = past_key_values.get_max_cache_shape()
1278
+ # DynamicCache or no cache
1279
+ else:
1280
+ target_length = (
1281
+ attention_mask.shape[-1]
1282
+ if isinstance(attention_mask, torch.Tensor)
1283
+ else past_seen_tokens + sequence_length + 1
1284
+ )
1285
+
1286
+ # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
1287
+ causal_mask = self._prepare_4d_causal_attention_mask_with_cache_position(
1288
+ attention_mask,
1289
+ sequence_length=sequence_length,
1290
+ target_length=target_length,
1291
+ dtype=dtype,
1292
+ device=device,
1293
+ cache_position=cache_position,
1294
+ batch_size=input_tensor.shape[0],
1295
+ config=self.config,
1296
+ past_key_values=past_key_values,
1297
+ )
1298
+
1299
+ if (
1300
+ self.config._attn_implementation == "sdpa"
1301
+ and attention_mask is not None
1302
+ and attention_mask.device.type == "cuda"
1303
+ and not output_attentions
1304
+ ):
1305
+ # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
1306
+ # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
1307
+ # Details: https://github.com/pytorch/pytorch/issues/110213
1308
+ causal_mask = AttentionMaskConverter._unmask_unattended(causal_mask, min_dtype)
1309
+
1310
+ return causal_mask
1311
+
1312
+ @staticmethod
1313
+ def _prepare_4d_causal_attention_mask_with_cache_position(
1314
+ attention_mask: torch.Tensor,
1315
+ sequence_length: int,
1316
+ target_length: int,
1317
+ dtype: torch.dtype,
1318
+ device: torch.device,
1319
+ cache_position: torch.Tensor,
1320
+ batch_size: int,
1321
+ config: MotifConfig,
1322
+ past_key_values: Cache,
1323
+ ):
1324
+ """
1325
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
1326
+ `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
1327
+
1328
+ Args:
1329
+ attention_mask (`torch.Tensor`):
1330
+ A 2D attention mask of shape `(batch_size, key_value_length)` or a 4D attention mask of shape `(batch_size, 1, query_length, key_value_length)`.
1331
+ sequence_length (`int`):
1332
+ The sequence length being processed.
1333
+ target_length (`int`):
1334
+ The target length: when generating with static cache, the mask should be as long as the static cache, to account for the 0 padding, the part of the cache that is not filled yet.
1335
+ dtype (`torch.dtype`):
1336
+ The dtype to use for the 4D attention mask.
1337
+ device (`torch.device`):
1338
+ The device to plcae the 4D attention mask on.
1339
+ cache_position (`torch.Tensor`):
1340
+ Indices depicting the position of the input sequence tokens in the sequence.
1341
+ batch_size (`torch.Tensor`):
1342
+ Batch size.
1343
+ config (`MotifConfig`):
1344
+ The model's configuration class
1345
+ past_key_values (`Cache`):
1346
+ The cache class that is being used currently to generate
1347
+ """
1348
+ if attention_mask is not None and attention_mask.dim() == 4:
1349
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
1350
+ causal_mask = attention_mask
1351
+ else:
1352
+ min_dtype = torch.finfo(dtype).min
1353
+ causal_mask = torch.full(
1354
+ (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=cache_position.device
1355
+ )
1356
+ diagonal_attend_mask = torch.arange(target_length, device=cache_position.device) > cache_position.reshape(
1357
+ -1, 1
1358
+ )
1359
+ if config.sliding_window is not None:
1360
+ # if we have sliding window, we should not attend to tokens beyond sliding window length, so we mask them out also
1361
+ # the check is needed to verify is current checkpoint was trained with sliding window or not
1362
+ if not isinstance(past_key_values, SlidingWindowCache) or sequence_length > target_length:
1363
+ sliding_attend_mask = torch.arange(target_length, device=device) <= (
1364
+ cache_position.reshape(-1, 1) - config.sliding_window
1365
+ )
1366
+ diagonal_attend_mask.bitwise_or_(sliding_attend_mask)
1367
+ causal_mask *= diagonal_attend_mask
1368
+ causal_mask = causal_mask[None, None, :, :].expand(batch_size, 1, -1, -1)
1369
+ if attention_mask is not None:
1370
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
1371
+ if attention_mask.shape[-1] > target_length:
1372
+ attention_mask = attention_mask[:, :target_length]
1373
+ mask_length = attention_mask.shape[-1]
1374
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
1375
+ padding_mask = padding_mask == 0
1376
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
1377
+ padding_mask, min_dtype
1378
+ )
1379
+ return causal_mask
1380
+
1381
+
1382
+ class MotifForCausalLM(MotifPreTrainedModel, GenerationMixin):
1383
+ _tied_weights_keys = ["lm_head.weight"]
1384
+
1385
+ def __init__(self, config):
1386
+ super().__init__(config)
1387
+ self.model = MotifModel(config)
1388
+ self.vocab_size = config.vocab_size
1389
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
1390
+
1391
+ # Initialize weights and apply final processing
1392
+ self.post_init()
1393
+
1394
+ if config.tie_word_embeddings:
1395
+ self.tie_weights()
1396
+
1397
+ def get_input_embeddings(self):
1398
+ return self.model.embed_tokens
1399
+
1400
+ def set_input_embeddings(self, value):
1401
+ self.model.embed_tokens = value
1402
+
1403
+ def get_output_embeddings(self):
1404
+ return self.lm_head
1405
+
1406
+ def set_output_embeddings(self, new_embeddings):
1407
+ self.lm_head = new_embeddings
1408
+
1409
+ def set_decoder(self, decoder):
1410
+ self.model = decoder
1411
+
1412
+ def get_decoder(self):
1413
+ return self.model
1414
+
1415
+ @add_start_docstrings_to_model_forward(MOTIF_INPUTS_DOCSTRING)
1416
+ @replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
1417
+ def forward(
1418
+ self,
1419
+ input_ids: torch.LongTensor = None,
1420
+ attention_mask: Optional[torch.Tensor] = None,
1421
+ position_ids: Optional[torch.LongTensor] = None,
1422
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1423
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1424
+ labels: Optional[torch.LongTensor] = None,
1425
+ use_cache: Optional[bool] = None,
1426
+ output_attentions: Optional[bool] = None,
1427
+ output_hidden_states: Optional[bool] = None,
1428
+ return_dict: Optional[bool] = None,
1429
+ cache_position: Optional[torch.LongTensor] = None,
1430
+ num_logits_to_keep: int = 0,
1431
+ **loss_kwargs,
1432
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1433
+ r"""
1434
+ Args:
1435
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1436
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1437
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1438
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1439
+
1440
+ num_logits_to_keep (`int`, *optional*):
1441
+ Calculate logits for the last `num_logits_to_keep` tokens. If `0`, calculate logits for all
1442
+ `input_ids` (special case). Only last token logits are needed for generation, and calculating them only for that
1443
+ token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
1444
+
1445
+ Returns:
1446
+
1447
+ Example:
1448
+
1449
+ ```python
1450
+ >>> from transformers import AutoTokenizer, MotifForCausalLM
1451
+
1452
+ >>> model = MotifForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
1453
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
1454
+
1455
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1456
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1457
+
1458
+ >>> # Generate
1459
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1460
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1461
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1462
+ ```"""
1463
+
1464
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1465
+ output_hidden_states = (
1466
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1467
+ )
1468
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1469
+
1470
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1471
+ outputs = self.model(
1472
+ input_ids=input_ids,
1473
+ attention_mask=attention_mask,
1474
+ position_ids=position_ids,
1475
+ past_key_values=past_key_values,
1476
+ inputs_embeds=inputs_embeds,
1477
+ use_cache=use_cache,
1478
+ output_attentions=output_attentions,
1479
+ output_hidden_states=output_hidden_states,
1480
+ return_dict=return_dict,
1481
+ cache_position=cache_position,
1482
+ )
1483
+
1484
+ hidden_states = outputs[0]
1485
+ hidden_states = hidden_states
1486
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
1487
+ logits = self.lm_head(hidden_states[:, -num_logits_to_keep:, :])
1488
+ logits = logits.float()
1489
+
1490
+ loss = None
1491
+ if labels is not None:
1492
+ # Shift so that tokens < n predict n
1493
+ shift_logits = logits[..., :-1, :].contiguous()
1494
+ shift_labels = labels[..., 1:].contiguous()
1495
+ # Flatten the tokens
1496
+ loss_fct = CrossEntropyLoss()
1497
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
1498
+ shift_labels = shift_labels.view(-1)
1499
+ # Enable model parallelism
1500
+ shift_labels = shift_labels.to(shift_logits.device)
1501
+ loss = loss_fct(shift_logits, shift_labels)
1502
+
1503
+ if not return_dict:
1504
+ output = (logits,) + outputs[1:]
1505
+ return (loss,) + output if loss is not None else output
1506
+
1507
+ return CausalLMOutputWithPast(
1508
+ loss=loss,
1509
+ logits=logits,
1510
+ past_key_values=outputs.past_key_values,
1511
+ hidden_states=outputs.hidden_states,
1512
+ attentions=outputs.attentions,
1513
+ )
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|beginoftext|>",
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
+ "unk_token": {
17
+ "content": "<|endoftext|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5b201f48223bd29392fa1317d1507e724356a9f85a9b4ad98529171fdd22bb5
3
+ size 17264886
tokenizer_config.json ADDED
@@ -0,0 +1,1026 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "219395": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "219396": {
13
+ "content": "<|beginoftext|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "219397": {
21
+ "content": "<|fim_prefix|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "219398": {
29
+ "content": "<|fim_middle|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "219399": {
37
+ "content": "<|fim_suffix|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "219400": {
45
+ "content": "<|system|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "219401": {
53
+ "content": "<|user|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "219402": {
61
+ "content": "<|assistant|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "219403": {
69
+ "content": "<|startofturn|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "219404": {
77
+ "content": "<|dummy_id_1|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "219405": {
85
+ "content": "<|endofturn|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "219406": {
93
+ "content": "<|dummy_id_2|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "219407": {
101
+ "content": "<|dummy_id_3|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "219408": {
109
+ "content": "<|dummy_id_4|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "219409": {
117
+ "content": "<|dummy_id_5|>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "219410": {
125
+ "content": "<|dummy_id_6|>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "219411": {
133
+ "content": "<|dummy_id_7|>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ },
140
+ "219412": {
141
+ "content": "<|dummy_id_8|>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": true
147
+ },
148
+ "219413": {
149
+ "content": "<|dummy_id_9|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": true
155
+ },
156
+ "219414": {
157
+ "content": "<|dummy_id_10|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": true
163
+ },
164
+ "219415": {
165
+ "content": "<|dummy_id_11|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": true
171
+ },
172
+ "219416": {
173
+ "content": "<|endofprompt|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": true
179
+ },
180
+ "219417": {
181
+ "content": "<|dummy_id_12|>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": true
187
+ },
188
+ "219418": {
189
+ "content": "<|dummy_id_13|>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": true
195
+ },
196
+ "219419": {
197
+ "content": "<|dummy_id_14|>",
198
+ "lstrip": false,
199
+ "normalized": false,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": true
203
+ },
204
+ "219420": {
205
+ "content": "<|dummy_id_15|>",
206
+ "lstrip": false,
207
+ "normalized": false,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": true
211
+ },
212
+ "219421": {
213
+ "content": "<|dummy_id_16|>",
214
+ "lstrip": false,
215
+ "normalized": false,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": true
219
+ },
220
+ "219422": {
221
+ "content": "<|dummy_id_17|>",
222
+ "lstrip": false,
223
+ "normalized": false,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": true
227
+ },
228
+ "219423": {
229
+ "content": "<|dummy_id_18|>",
230
+ "lstrip": false,
231
+ "normalized": false,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": true
235
+ },
236
+ "219424": {
237
+ "content": "<|dummy_id_19|>",
238
+ "lstrip": false,
239
+ "normalized": false,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": true
243
+ },
244
+ "219425": {
245
+ "content": "<|dummy_id_20|>",
246
+ "lstrip": false,
247
+ "normalized": false,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": true
251
+ },
252
+ "219426": {
253
+ "content": "<|dummy_id_21|>",
254
+ "lstrip": false,
255
+ "normalized": false,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": true
259
+ },
260
+ "219427": {
261
+ "content": "<|dummy_id_22|>",
262
+ "lstrip": false,
263
+ "normalized": false,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": true
267
+ },
268
+ "219428": {
269
+ "content": "<|dummy_id_23|>",
270
+ "lstrip": false,
271
+ "normalized": false,
272
+ "rstrip": false,
273
+ "single_word": false,
274
+ "special": true
275
+ },
276
+ "219429": {
277
+ "content": "<|dummy_id_24|>",
278
+ "lstrip": false,
279
+ "normalized": false,
280
+ "rstrip": false,
281
+ "single_word": false,
282
+ "special": true
283
+ },
284
+ "219430": {
285
+ "content": "<|dummy_id_25|>",
286
+ "lstrip": false,
287
+ "normalized": false,
288
+ "rstrip": false,
289
+ "single_word": false,
290
+ "special": true
291
+ },
292
+ "219431": {
293
+ "content": "<|dummy_id_26|>",
294
+ "lstrip": false,
295
+ "normalized": false,
296
+ "rstrip": false,
297
+ "single_word": false,
298
+ "special": true
299
+ },
300
+ "219432": {
301
+ "content": "<|dummy_id_27|>",
302
+ "lstrip": false,
303
+ "normalized": false,
304
+ "rstrip": false,
305
+ "single_word": false,
306
+ "special": true
307
+ },
308
+ "219433": {
309
+ "content": "<|dummy_id_28|>",
310
+ "lstrip": false,
311
+ "normalized": false,
312
+ "rstrip": false,
313
+ "single_word": false,
314
+ "special": true
315
+ },
316
+ "219434": {
317
+ "content": "<|dummy_id_29|>",
318
+ "lstrip": false,
319
+ "normalized": false,
320
+ "rstrip": false,
321
+ "single_word": false,
322
+ "special": true
323
+ },
324
+ "219435": {
325
+ "content": "<|dummy_id_30|>",
326
+ "lstrip": false,
327
+ "normalized": false,
328
+ "rstrip": false,
329
+ "single_word": false,
330
+ "special": true
331
+ },
332
+ "219436": {
333
+ "content": "<|dummy_id_31|>",
334
+ "lstrip": false,
335
+ "normalized": false,
336
+ "rstrip": false,
337
+ "single_word": false,
338
+ "special": true
339
+ },
340
+ "219437": {
341
+ "content": "<|dummy_id_32|>",
342
+ "lstrip": false,
343
+ "normalized": false,
344
+ "rstrip": false,
345
+ "single_word": false,
346
+ "special": true
347
+ },
348
+ "219438": {
349
+ "content": "<|dummy_id_33|>",
350
+ "lstrip": false,
351
+ "normalized": false,
352
+ "rstrip": false,
353
+ "single_word": false,
354
+ "special": true
355
+ },
356
+ "219439": {
357
+ "content": "<|dummy_id_34|>",
358
+ "lstrip": false,
359
+ "normalized": false,
360
+ "rstrip": false,
361
+ "single_word": false,
362
+ "special": true
363
+ },
364
+ "219440": {
365
+ "content": "<|dummy_id_35|>",
366
+ "lstrip": false,
367
+ "normalized": false,
368
+ "rstrip": false,
369
+ "single_word": false,
370
+ "special": true
371
+ },
372
+ "219441": {
373
+ "content": "<|dummy_id_36|>",
374
+ "lstrip": false,
375
+ "normalized": false,
376
+ "rstrip": false,
377
+ "single_word": false,
378
+ "special": true
379
+ },
380
+ "219442": {
381
+ "content": "<|dummy_id_37|>",
382
+ "lstrip": false,
383
+ "normalized": false,
384
+ "rstrip": false,
385
+ "single_word": false,
386
+ "special": true
387
+ },
388
+ "219443": {
389
+ "content": "<|dummy_id_38|>",
390
+ "lstrip": false,
391
+ "normalized": false,
392
+ "rstrip": false,
393
+ "single_word": false,
394
+ "special": true
395
+ },
396
+ "219444": {
397
+ "content": "<|dummy_id_39|>",
398
+ "lstrip": false,
399
+ "normalized": false,
400
+ "rstrip": false,
401
+ "single_word": false,
402
+ "special": true
403
+ },
404
+ "219445": {
405
+ "content": "<|dummy_id_40|>",
406
+ "lstrip": false,
407
+ "normalized": false,
408
+ "rstrip": false,
409
+ "single_word": false,
410
+ "special": true
411
+ },
412
+ "219446": {
413
+ "content": "<|dummy_id_41|>",
414
+ "lstrip": false,
415
+ "normalized": false,
416
+ "rstrip": false,
417
+ "single_word": false,
418
+ "special": true
419
+ },
420
+ "219447": {
421
+ "content": "<|dummy_id_42|>",
422
+ "lstrip": false,
423
+ "normalized": false,
424
+ "rstrip": false,
425
+ "single_word": false,
426
+ "special": true
427
+ },
428
+ "219448": {
429
+ "content": "<|dummy_id_43|>",
430
+ "lstrip": false,
431
+ "normalized": false,
432
+ "rstrip": false,
433
+ "single_word": false,
434
+ "special": true
435
+ },
436
+ "219449": {
437
+ "content": "<|dummy_id_44|>",
438
+ "lstrip": false,
439
+ "normalized": false,
440
+ "rstrip": false,
441
+ "single_word": false,
442
+ "special": true
443
+ },
444
+ "219450": {
445
+ "content": "<|dummy_id_45|>",
446
+ "lstrip": false,
447
+ "normalized": false,
448
+ "rstrip": false,
449
+ "single_word": false,
450
+ "special": true
451
+ },
452
+ "219451": {
453
+ "content": "<|dummy_id_46|>",
454
+ "lstrip": false,
455
+ "normalized": false,
456
+ "rstrip": false,
457
+ "single_word": false,
458
+ "special": true
459
+ },
460
+ "219452": {
461
+ "content": "<|dummy_id_47|>",
462
+ "lstrip": false,
463
+ "normalized": false,
464
+ "rstrip": false,
465
+ "single_word": false,
466
+ "special": true
467
+ },
468
+ "219453": {
469
+ "content": "<|dummy_id_48|>",
470
+ "lstrip": false,
471
+ "normalized": false,
472
+ "rstrip": false,
473
+ "single_word": false,
474
+ "special": true
475
+ },
476
+ "219454": {
477
+ "content": "<|dummy_id_49|>",
478
+ "lstrip": false,
479
+ "normalized": false,
480
+ "rstrip": false,
481
+ "single_word": false,
482
+ "special": true
483
+ },
484
+ "219455": {
485
+ "content": "<|dummy_id_50|>",
486
+ "lstrip": false,
487
+ "normalized": false,
488
+ "rstrip": false,
489
+ "single_word": false,
490
+ "special": true
491
+ },
492
+ "219456": {
493
+ "content": "<|dummy_id_51|>",
494
+ "lstrip": false,
495
+ "normalized": false,
496
+ "rstrip": false,
497
+ "single_word": false,
498
+ "special": true
499
+ },
500
+ "219457": {
501
+ "content": "<|dummy_id_52|>",
502
+ "lstrip": false,
503
+ "normalized": false,
504
+ "rstrip": false,
505
+ "single_word": false,
506
+ "special": true
507
+ },
508
+ "219458": {
509
+ "content": "<|dummy_id_53|>",
510
+ "lstrip": false,
511
+ "normalized": false,
512
+ "rstrip": false,
513
+ "single_word": false,
514
+ "special": true
515
+ },
516
+ "219459": {
517
+ "content": "<|dummy_id_54|>",
518
+ "lstrip": false,
519
+ "normalized": false,
520
+ "rstrip": false,
521
+ "single_word": false,
522
+ "special": true
523
+ },
524
+ "219460": {
525
+ "content": "<|dummy_id_55|>",
526
+ "lstrip": false,
527
+ "normalized": false,
528
+ "rstrip": false,
529
+ "single_word": false,
530
+ "special": true
531
+ },
532
+ "219461": {
533
+ "content": "<|dummy_id_56|>",
534
+ "lstrip": false,
535
+ "normalized": false,
536
+ "rstrip": false,
537
+ "single_word": false,
538
+ "special": true
539
+ },
540
+ "219462": {
541
+ "content": "<|dummy_id_57|>",
542
+ "lstrip": false,
543
+ "normalized": false,
544
+ "rstrip": false,
545
+ "single_word": false,
546
+ "special": true
547
+ },
548
+ "219463": {
549
+ "content": "<|dummy_id_58|>",
550
+ "lstrip": false,
551
+ "normalized": false,
552
+ "rstrip": false,
553
+ "single_word": false,
554
+ "special": true
555
+ },
556
+ "219464": {
557
+ "content": "<|dummy_id_59|>",
558
+ "lstrip": false,
559
+ "normalized": false,
560
+ "rstrip": false,
561
+ "single_word": false,
562
+ "special": true
563
+ },
564
+ "219465": {
565
+ "content": "<|dummy_id_60|>",
566
+ "lstrip": false,
567
+ "normalized": false,
568
+ "rstrip": false,
569
+ "single_word": false,
570
+ "special": true
571
+ },
572
+ "219466": {
573
+ "content": "<|dummy_id_61|>",
574
+ "lstrip": false,
575
+ "normalized": false,
576
+ "rstrip": false,
577
+ "single_word": false,
578
+ "special": true
579
+ },
580
+ "219467": {
581
+ "content": "<|dummy_id_62|>",
582
+ "lstrip": false,
583
+ "normalized": false,
584
+ "rstrip": false,
585
+ "single_word": false,
586
+ "special": true
587
+ },
588
+ "219468": {
589
+ "content": "<|dummy_id_63|>",
590
+ "lstrip": false,
591
+ "normalized": false,
592
+ "rstrip": false,
593
+ "single_word": false,
594
+ "special": true
595
+ },
596
+ "219469": {
597
+ "content": "<|dummy_id_64|>",
598
+ "lstrip": false,
599
+ "normalized": false,
600
+ "rstrip": false,
601
+ "single_word": false,
602
+ "special": true
603
+ },
604
+ "219470": {
605
+ "content": "<|dummy_id_65|>",
606
+ "lstrip": false,
607
+ "normalized": false,
608
+ "rstrip": false,
609
+ "single_word": false,
610
+ "special": true
611
+ },
612
+ "219471": {
613
+ "content": "<|dummy_id_66|>",
614
+ "lstrip": false,
615
+ "normalized": false,
616
+ "rstrip": false,
617
+ "single_word": false,
618
+ "special": true
619
+ },
620
+ "219472": {
621
+ "content": "<|dummy_id_67|>",
622
+ "lstrip": false,
623
+ "normalized": false,
624
+ "rstrip": false,
625
+ "single_word": false,
626
+ "special": true
627
+ },
628
+ "219473": {
629
+ "content": "<|dummy_id_68|>",
630
+ "lstrip": false,
631
+ "normalized": false,
632
+ "rstrip": false,
633
+ "single_word": false,
634
+ "special": true
635
+ },
636
+ "219474": {
637
+ "content": "<|dummy_id_69|>",
638
+ "lstrip": false,
639
+ "normalized": false,
640
+ "rstrip": false,
641
+ "single_word": false,
642
+ "special": true
643
+ },
644
+ "219475": {
645
+ "content": "<|dummy_id_70|>",
646
+ "lstrip": false,
647
+ "normalized": false,
648
+ "rstrip": false,
649
+ "single_word": false,
650
+ "special": true
651
+ },
652
+ "219476": {
653
+ "content": "<|dummy_id_71|>",
654
+ "lstrip": false,
655
+ "normalized": false,
656
+ "rstrip": false,
657
+ "single_word": false,
658
+ "special": true
659
+ },
660
+ "219477": {
661
+ "content": "<|dummy_id_72|>",
662
+ "lstrip": false,
663
+ "normalized": false,
664
+ "rstrip": false,
665
+ "single_word": false,
666
+ "special": true
667
+ },
668
+ "219478": {
669
+ "content": "<|dummy_id_73|>",
670
+ "lstrip": false,
671
+ "normalized": false,
672
+ "rstrip": false,
673
+ "single_word": false,
674
+ "special": true
675
+ },
676
+ "219479": {
677
+ "content": "<|dummy_id_74|>",
678
+ "lstrip": false,
679
+ "normalized": false,
680
+ "rstrip": false,
681
+ "single_word": false,
682
+ "special": true
683
+ },
684
+ "219480": {
685
+ "content": "<|dummy_id_75|>",
686
+ "lstrip": false,
687
+ "normalized": false,
688
+ "rstrip": false,
689
+ "single_word": false,
690
+ "special": true
691
+ },
692
+ "219481": {
693
+ "content": "<|dummy_id_76|>",
694
+ "lstrip": false,
695
+ "normalized": false,
696
+ "rstrip": false,
697
+ "single_word": false,
698
+ "special": true
699
+ },
700
+ "219482": {
701
+ "content": "<|dummy_id_77|>",
702
+ "lstrip": false,
703
+ "normalized": false,
704
+ "rstrip": false,
705
+ "single_word": false,
706
+ "special": true
707
+ },
708
+ "219483": {
709
+ "content": "<|dummy_id_78|>",
710
+ "lstrip": false,
711
+ "normalized": false,
712
+ "rstrip": false,
713
+ "single_word": false,
714
+ "special": true
715
+ },
716
+ "219484": {
717
+ "content": "<|dummy_id_79|>",
718
+ "lstrip": false,
719
+ "normalized": false,
720
+ "rstrip": false,
721
+ "single_word": false,
722
+ "special": true
723
+ },
724
+ "219485": {
725
+ "content": "<|dummy_id_80|>",
726
+ "lstrip": false,
727
+ "normalized": false,
728
+ "rstrip": false,
729
+ "single_word": false,
730
+ "special": true
731
+ },
732
+ "219486": {
733
+ "content": "<|dummy_id_81|>",
734
+ "lstrip": false,
735
+ "normalized": false,
736
+ "rstrip": false,
737
+ "single_word": false,
738
+ "special": true
739
+ },
740
+ "219487": {
741
+ "content": "<|dummy_id_82|>",
742
+ "lstrip": false,
743
+ "normalized": false,
744
+ "rstrip": false,
745
+ "single_word": false,
746
+ "special": true
747
+ },
748
+ "219488": {
749
+ "content": "<|dummy_id_83|>",
750
+ "lstrip": false,
751
+ "normalized": false,
752
+ "rstrip": false,
753
+ "single_word": false,
754
+ "special": true
755
+ },
756
+ "219489": {
757
+ "content": "<|dummy_id_84|>",
758
+ "lstrip": false,
759
+ "normalized": false,
760
+ "rstrip": false,
761
+ "single_word": false,
762
+ "special": true
763
+ },
764
+ "219490": {
765
+ "content": "<|dummy_id_85|>",
766
+ "lstrip": false,
767
+ "normalized": false,
768
+ "rstrip": false,
769
+ "single_word": false,
770
+ "special": true
771
+ },
772
+ "219491": {
773
+ "content": "<|dummy_id_86|>",
774
+ "lstrip": false,
775
+ "normalized": false,
776
+ "rstrip": false,
777
+ "single_word": false,
778
+ "special": true
779
+ },
780
+ "219492": {
781
+ "content": "<|dummy_id_87|>",
782
+ "lstrip": false,
783
+ "normalized": false,
784
+ "rstrip": false,
785
+ "single_word": false,
786
+ "special": true
787
+ },
788
+ "219493": {
789
+ "content": "<|dummy_id_88|>",
790
+ "lstrip": false,
791
+ "normalized": false,
792
+ "rstrip": false,
793
+ "single_word": false,
794
+ "special": true
795
+ },
796
+ "219494": {
797
+ "content": "<|dummy_id_89|>",
798
+ "lstrip": false,
799
+ "normalized": false,
800
+ "rstrip": false,
801
+ "single_word": false,
802
+ "special": true
803
+ },
804
+ "219495": {
805
+ "content": "<|dummy_id_90|>",
806
+ "lstrip": false,
807
+ "normalized": false,
808
+ "rstrip": false,
809
+ "single_word": false,
810
+ "special": true
811
+ },
812
+ "219496": {
813
+ "content": "<|dummy_id_91|>",
814
+ "lstrip": false,
815
+ "normalized": false,
816
+ "rstrip": false,
817
+ "single_word": false,
818
+ "special": true
819
+ },
820
+ "219497": {
821
+ "content": "<|dummy_id_92|>",
822
+ "lstrip": false,
823
+ "normalized": false,
824
+ "rstrip": false,
825
+ "single_word": false,
826
+ "special": true
827
+ },
828
+ "219498": {
829
+ "content": "<|dummy_id_93|>",
830
+ "lstrip": false,
831
+ "normalized": false,
832
+ "rstrip": false,
833
+ "single_word": false,
834
+ "special": true
835
+ },
836
+ "219499": {
837
+ "content": "<|dummy_id_94|>",
838
+ "lstrip": false,
839
+ "normalized": false,
840
+ "rstrip": false,
841
+ "single_word": false,
842
+ "special": true
843
+ },
844
+ "219500": {
845
+ "content": "<|dummy_id_95|>",
846
+ "lstrip": false,
847
+ "normalized": false,
848
+ "rstrip": false,
849
+ "single_word": false,
850
+ "special": true
851
+ },
852
+ "219501": {
853
+ "content": "<|dummy_id_96|>",
854
+ "lstrip": false,
855
+ "normalized": false,
856
+ "rstrip": false,
857
+ "single_word": false,
858
+ "special": true
859
+ },
860
+ "219502": {
861
+ "content": "<|dummy_id_97|>",
862
+ "lstrip": false,
863
+ "normalized": false,
864
+ "rstrip": false,
865
+ "single_word": false,
866
+ "special": true
867
+ },
868
+ "219503": {
869
+ "content": "<|dummy_id_98|>",
870
+ "lstrip": false,
871
+ "normalized": false,
872
+ "rstrip": false,
873
+ "single_word": false,
874
+ "special": true
875
+ },
876
+ "219504": {
877
+ "content": "<|dummy_id_99|>",
878
+ "lstrip": false,
879
+ "normalized": false,
880
+ "rstrip": false,
881
+ "single_word": false,
882
+ "special": true
883
+ },
884
+ "219505": {
885
+ "content": "<|dummy_id_100|>",
886
+ "lstrip": false,
887
+ "normalized": false,
888
+ "rstrip": false,
889
+ "single_word": false,
890
+ "special": true
891
+ },
892
+ "219506": {
893
+ "content": "<|dummy_id_101|>",
894
+ "lstrip": false,
895
+ "normalized": false,
896
+ "rstrip": false,
897
+ "single_word": false,
898
+ "special": true
899
+ },
900
+ "219507": {
901
+ "content": "<|dummy_id_102|>",
902
+ "lstrip": false,
903
+ "normalized": false,
904
+ "rstrip": false,
905
+ "single_word": false,
906
+ "special": true
907
+ },
908
+ "219508": {
909
+ "content": "<|dummy_id_103|>",
910
+ "lstrip": false,
911
+ "normalized": false,
912
+ "rstrip": false,
913
+ "single_word": false,
914
+ "special": true
915
+ },
916
+ "219509": {
917
+ "content": "<|dummy_id_104|>",
918
+ "lstrip": false,
919
+ "normalized": false,
920
+ "rstrip": false,
921
+ "single_word": false,
922
+ "special": true
923
+ },
924
+ "219510": {
925
+ "content": "<|dummy_id_105|>",
926
+ "lstrip": false,
927
+ "normalized": false,
928
+ "rstrip": false,
929
+ "single_word": false,
930
+ "special": true
931
+ },
932
+ "219511": {
933
+ "content": "<|dummy_id_106|>",
934
+ "lstrip": false,
935
+ "normalized": false,
936
+ "rstrip": false,
937
+ "single_word": false,
938
+ "special": true
939
+ },
940
+ "219512": {
941
+ "content": "<|dummy_id_107|>",
942
+ "lstrip": false,
943
+ "normalized": false,
944
+ "rstrip": false,
945
+ "single_word": false,
946
+ "special": true
947
+ },
948
+ "219513": {
949
+ "content": "<|dummy_id_108|>",
950
+ "lstrip": false,
951
+ "normalized": false,
952
+ "rstrip": false,
953
+ "single_word": false,
954
+ "special": true
955
+ },
956
+ "219514": {
957
+ "content": "<|dummy_id_109|>",
958
+ "lstrip": false,
959
+ "normalized": false,
960
+ "rstrip": false,
961
+ "single_word": false,
962
+ "special": true
963
+ },
964
+ "219515": {
965
+ "content": "<|dummy_id_110|>",
966
+ "lstrip": false,
967
+ "normalized": false,
968
+ "rstrip": false,
969
+ "single_word": false,
970
+ "special": true
971
+ },
972
+ "219516": {
973
+ "content": "<|dummy_id_111|>",
974
+ "lstrip": false,
975
+ "normalized": false,
976
+ "rstrip": false,
977
+ "single_word": false,
978
+ "special": true
979
+ },
980
+ "219517": {
981
+ "content": "<|dummy_id_112|>",
982
+ "lstrip": false,
983
+ "normalized": false,
984
+ "rstrip": false,
985
+ "single_word": false,
986
+ "special": true
987
+ },
988
+ "219518": {
989
+ "content": "<|dummy_id_113|>",
990
+ "lstrip": false,
991
+ "normalized": false,
992
+ "rstrip": false,
993
+ "single_word": false,
994
+ "special": true
995
+ },
996
+ "219519": {
997
+ "content": "<|dummy_id_114|>",
998
+ "lstrip": false,
999
+ "normalized": false,
1000
+ "rstrip": false,
1001
+ "single_word": false,
1002
+ "special": true
1003
+ }
1004
+ },
1005
+ "block_size": 2048,
1006
+ "bos_token": "<|beginoftext|>",
1007
+ "chat_template": "",
1008
+ "clean_up_tokenization_spaces": false,
1009
+ "corruption_rate": 0.15,
1010
+ "default_system_prompt": "",
1011
+ "eos_token": "<|endoftext|>",
1012
+ "extra_ids": 0,
1013
+ "fixed_vocab": true,
1014
+ "merges_file_path": "./data/merges.txt",
1015
+ "model_max_length": 1000000000000000019884624838656,
1016
+ "padding_side": "left",
1017
+ "seq_length": 4096,
1018
+ "tokenizer_class": "GPT2Tokenizer",
1019
+ "tokenizer_name": "./_motif_scripts/motif_tokenizer",
1020
+ "tokens": -1,
1021
+ "unk_token": "<|endoftext|>",
1022
+ "update_tokenizer": true,
1023
+ "use_moreh_tokenizer": false,
1024
+ "vocab_file_path": "./data/vocab.json",
1025
+ "vocab_size": 219395
1026
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff