leejunhyeok commited on
Commit
5bc087c
·
verified ·
1 Parent(s): 459d2c1

Upload folder using huggingface_hub

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