xihc-ucb commited on
Commit
b461a5e
·
verified ·
1 Parent(s): b7bc5f8

Upload FP8Qwen3ForCausalLM

Browse files
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags: []
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+ This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
config.json ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "FP8Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_fp8_qwen3.FP8Qwen3Config",
9
+ "AutoModel": "modeling_fp8_qwen3.FP8Qwen3Model",
10
+ "AutoModelForCausalLM": "modeling_fp8_qwen3.FP8Qwen3ForCausalLM",
11
+ "AutoModelForQuestionAnswering": "modeling_fp8_qwen3.FP8Qwen3ForQuestionAnswering",
12
+ "AutoModelForSequenceClassification": "modeling_fp8_qwen3.FP8Qwen3ForSequenceClassification",
13
+ "AutoModelForTokenClassification": "modeling_fp8_qwen3.FP8Qwen3ForTokenClassification"
14
+ },
15
+ "bos_token_id": 151643,
16
+ "dtype": "float8_e4m3fn",
17
+ "eos_token_id": 151645,
18
+ "fp8_config": {
19
+ "act_block_size": 16,
20
+ "float8_dtype": "torch.float8_e4m3fn",
21
+ "layer_name": "",
22
+ "mm_block_size": 128,
23
+ "quant_type": "DIV",
24
+ "training_mode": false
25
+ },
26
+ "head_dim": 128,
27
+ "hidden_act": "silu",
28
+ "hidden_size": 4096,
29
+ "initializer_range": 0.02,
30
+ "intermediate_size": 12288,
31
+ "layer_types": [
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention",
56
+ "full_attention",
57
+ "full_attention",
58
+ "full_attention",
59
+ "full_attention",
60
+ "full_attention",
61
+ "full_attention",
62
+ "full_attention",
63
+ "full_attention",
64
+ "full_attention",
65
+ "full_attention",
66
+ "full_attention",
67
+ "full_attention"
68
+ ],
69
+ "max_position_embeddings": 40960,
70
+ "max_window_layers": 36,
71
+ "model_name_orig": "Qwen/Qwen3-8B",
72
+ "model_name_quant": null,
73
+ "model_type": "fp8_qwen3",
74
+ "num_attention_heads": 32,
75
+ "num_hidden_layers": 36,
76
+ "num_key_value_heads": 8,
77
+ "rms_norm_eps": 1e-06,
78
+ "rope_scaling": null,
79
+ "rope_theta": 1000000,
80
+ "sliding_window": null,
81
+ "tie_word_embeddings": false,
82
+ "transformers_version": "4.57.0",
83
+ "use_cache": true,
84
+ "use_sliding_window": false,
85
+ "vocab_size": 151936
86
+ }
configuration_fp8_qwen3.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Qwen3 model configuration"""
16
+
17
+ import torch
18
+ from typing import Optional
19
+ from dataclasses import dataclass, asdict
20
+ from enum import Enum
21
+
22
+ from transformers.configuration_utils import PretrainedConfig
23
+ from transformers.utils import logging
24
+ from transformers.models.qwen3.configuration_qwen3 import Qwen3Config
25
+
26
+ from quasar.kernel.configs import QuantType
27
+
28
+ logger = logging.get_logger(__name__)
29
+
30
+
31
+ @dataclass
32
+ class FP8Config:
33
+ """
34
+ Configuration for FP8 quantization.
35
+ """
36
+
37
+ float8_dtype: torch.dtype = torch.float8_e4m3fn
38
+ quant_type: QuantType = QuantType.DIV
39
+ layer_name: str = ""
40
+
41
+ act_block_size: int = 16
42
+ mm_block_size: int = 128
43
+
44
+ training_mode: bool = True
45
+ """
46
+ If True, the linear layer will use high-precision weight.
47
+ If False, the linear layer will use per-block quantized weight.
48
+ """
49
+
50
+
51
+ class FP8Qwen3Config(Qwen3Config):
52
+ model_type = "fp8_qwen3"
53
+ fp8_config: FP8Config = FP8Config()
54
+ model_name_orig: str = ""
55
+ model_name_quant: str = ""
56
+ """Pass the name of the BF16 model"""
57
+
58
+ def __init__(
59
+ self,
60
+ vocab_size=151936,
61
+ hidden_size=4096,
62
+ intermediate_size=22016,
63
+ num_hidden_layers=32,
64
+ num_attention_heads=32,
65
+ num_key_value_heads=32,
66
+ head_dim=128,
67
+ hidden_act="silu",
68
+ max_position_embeddings=32768,
69
+ initializer_range=0.02,
70
+ rms_norm_eps=1e-6,
71
+ use_cache=True,
72
+ tie_word_embeddings=False,
73
+ rope_theta=10000.0,
74
+ rope_scaling=None,
75
+ attention_bias=False,
76
+ use_sliding_window=False,
77
+ sliding_window=4096,
78
+ max_window_layers=28,
79
+ layer_types=None,
80
+ attention_dropout=0.0,
81
+ # Customized configs begins here
82
+ fp8_config=None,
83
+ model_name_orig="",
84
+ model_name_quant="",
85
+ **kwargs,
86
+ ):
87
+ super().__init__(
88
+ vocab_size=vocab_size,
89
+ hidden_size=hidden_size,
90
+ intermediate_size=intermediate_size,
91
+ num_hidden_layers=num_hidden_layers,
92
+ num_attention_heads=num_attention_heads,
93
+ num_key_value_heads=num_key_value_heads,
94
+ head_dim=head_dim,
95
+ hidden_act=hidden_act,
96
+ max_position_embeddings=max_position_embeddings,
97
+ initializer_range=initializer_range,
98
+ rms_norm_eps=rms_norm_eps,
99
+ use_cache=use_cache,
100
+ tie_word_embeddings=tie_word_embeddings,
101
+ rope_theta=rope_theta,
102
+ rope_scaling=rope_scaling,
103
+ attention_bias=attention_bias,
104
+ use_sliding_window=use_sliding_window,
105
+ sliding_window=sliding_window,
106
+ max_window_layers=max_window_layers,
107
+ layer_types=layer_types,
108
+ attention_dropout=attention_dropout,
109
+ **kwargs,
110
+ )
111
+
112
+ # Convert it from dict to FP8Config (dataclass)
113
+ if fp8_config is not None:
114
+ self.fp8_config = fp8_config if isinstance(fp8_config, FP8Config) else FP8Config(**fp8_config)
115
+ else:
116
+ self.fp8_config = FP8Config()
117
+
118
+ self.model_name_orig = model_name_orig
119
+ self.model_name_quant = model_name_quant
120
+
121
+
122
+ def to_dict(self):
123
+ output = super().to_dict()
124
+ if hasattr(self.fp8_config, "__dataclass_fields__"):
125
+ cfg_dict = asdict(self.fp8_config)
126
+ for k, v in cfg_dict.items():
127
+ if isinstance(v, torch.dtype): # float8_dtype
128
+ cfg_dict[k] = str(v) # save as 'torch.float8_e4m3fn'
129
+ elif isinstance(v, Enum): # quant_type
130
+ cfg_dict[k] = v.name # save as 'DIV'
131
+ output["fp8_config"] = cfg_dict
132
+ else:
133
+ output["fp8_config"] = self.fp8_config
134
+ return output
135
+
136
+
137
+ @classmethod
138
+ def from_dict(cls, config_dict, **kwargs):
139
+ config = super().from_dict(config_dict, **kwargs)
140
+
141
+ fp8_config = config_dict.get("fp8_config", {})
142
+ for k, v in fp8_config.items():
143
+ if k == "float8_dtype":
144
+ assert v.startswith("torch."), f"Invalid float8_dtype: {v}"
145
+ fp8_config[k] = getattr(torch, v[len("torch."):]) #
146
+ elif k == "quant_type":
147
+ fp8_config[k] = getattr(QuantType, v)
148
+ config.fp8_config = FP8Config(**fp8_config)
149
+ return config
150
+
151
+
152
+ __all__ = ["FP8Qwen3Config"]
153
+
154
+ FP8Qwen3Config.register_for_auto_class()
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "transformers_version": "4.57.0"
6
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1108f22b4218aa531975c5aaaaaf66fcd34121cc7633ee9ed8fb5e68426fdb4
3
+ size 4968167136
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec64b885c65202b773fdd91b533270e52d02c1494d5bb3b1f3aca861665df198
3
+ size 4469923408
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9108ac78362e4b2f53ec98ed190a2f03d618e11ec60257528131c0a5df5be465
3
+ size 2489319552
model.safetensors.index.json ADDED
@@ -0,0 +1,659 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 8191159296,
4
+ "total_size": 11927334912
5
+ },
6
+ "weight_map": {
7
+ "lm_head.weight": "model-00003-of-00003.safetensors",
8
+ "model.embed_tokens.weight": "model-00002-of-00003.safetensors",
9
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
10
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
11
+ "model.layers.0.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
12
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
13
+ "model.layers.0.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
14
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
15
+ "model.layers.0.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
16
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
17
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
18
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
19
+ "model.layers.0.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
20
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
21
+ "model.layers.0.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
22
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
23
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
24
+ "model.layers.0.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
25
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
26
+ "model.layers.0.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
27
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
28
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
29
+ "model.layers.1.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
30
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
31
+ "model.layers.1.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
32
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
33
+ "model.layers.1.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
34
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
35
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
36
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
37
+ "model.layers.1.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
38
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
39
+ "model.layers.1.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
40
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
41
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
42
+ "model.layers.1.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
43
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
44
+ "model.layers.1.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
45
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00003.safetensors",
46
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
47
+ "model.layers.10.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
48
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
49
+ "model.layers.10.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
50
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
51
+ "model.layers.10.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
52
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
53
+ "model.layers.10.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
54
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
55
+ "model.layers.10.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
56
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
57
+ "model.layers.10.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
58
+ "model.layers.10.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
59
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
60
+ "model.layers.10.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
61
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
62
+ "model.layers.10.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
63
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00003.safetensors",
64
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
65
+ "model.layers.11.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
66
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
67
+ "model.layers.11.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
68
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
69
+ "model.layers.11.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
70
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
71
+ "model.layers.11.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
72
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
73
+ "model.layers.11.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
74
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
75
+ "model.layers.11.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
76
+ "model.layers.11.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
77
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
78
+ "model.layers.11.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
79
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
80
+ "model.layers.11.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
81
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00003.safetensors",
82
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
83
+ "model.layers.12.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
84
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
85
+ "model.layers.12.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
86
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
87
+ "model.layers.12.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
88
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
89
+ "model.layers.12.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
90
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
91
+ "model.layers.12.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
92
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
93
+ "model.layers.12.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
94
+ "model.layers.12.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
95
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
96
+ "model.layers.12.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
97
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
98
+ "model.layers.12.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
99
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00003.safetensors",
100
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
101
+ "model.layers.13.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
102
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
103
+ "model.layers.13.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
104
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
105
+ "model.layers.13.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
106
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
107
+ "model.layers.13.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
108
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
109
+ "model.layers.13.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
110
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
111
+ "model.layers.13.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
112
+ "model.layers.13.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
113
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
114
+ "model.layers.13.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
115
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
116
+ "model.layers.13.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
117
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00003.safetensors",
118
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
119
+ "model.layers.14.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
120
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
121
+ "model.layers.14.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
122
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
123
+ "model.layers.14.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
124
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
125
+ "model.layers.14.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
126
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
127
+ "model.layers.14.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
128
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
129
+ "model.layers.14.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
130
+ "model.layers.14.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
131
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
132
+ "model.layers.14.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
133
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
134
+ "model.layers.14.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
135
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00003.safetensors",
136
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
137
+ "model.layers.15.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
138
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
139
+ "model.layers.15.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
140
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
141
+ "model.layers.15.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
142
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
143
+ "model.layers.15.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
144
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
145
+ "model.layers.15.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
146
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
147
+ "model.layers.15.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
148
+ "model.layers.15.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
149
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
150
+ "model.layers.15.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
151
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
152
+ "model.layers.15.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
153
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00003.safetensors",
154
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
155
+ "model.layers.16.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
156
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
157
+ "model.layers.16.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
158
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
159
+ "model.layers.16.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
160
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
161
+ "model.layers.16.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
162
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
163
+ "model.layers.16.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
164
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
165
+ "model.layers.16.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
166
+ "model.layers.16.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
167
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
168
+ "model.layers.16.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
169
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
170
+ "model.layers.16.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
171
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00003.safetensors",
172
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
173
+ "model.layers.17.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
174
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
175
+ "model.layers.17.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
176
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
177
+ "model.layers.17.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
178
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
179
+ "model.layers.17.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
180
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
181
+ "model.layers.17.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
182
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
183
+ "model.layers.17.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
184
+ "model.layers.17.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
185
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
186
+ "model.layers.17.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
187
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
188
+ "model.layers.17.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
189
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00003.safetensors",
190
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
191
+ "model.layers.18.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
192
+ "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
193
+ "model.layers.18.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
194
+ "model.layers.18.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
195
+ "model.layers.18.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
196
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
197
+ "model.layers.18.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
198
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
199
+ "model.layers.18.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
200
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
201
+ "model.layers.18.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
202
+ "model.layers.18.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
203
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
204
+ "model.layers.18.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
205
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
206
+ "model.layers.18.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
207
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00003.safetensors",
208
+ "model.layers.19.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
209
+ "model.layers.19.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
210
+ "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
211
+ "model.layers.19.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
212
+ "model.layers.19.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
213
+ "model.layers.19.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
214
+ "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
215
+ "model.layers.19.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
216
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
217
+ "model.layers.19.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
218
+ "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
219
+ "model.layers.19.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
220
+ "model.layers.19.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
221
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
222
+ "model.layers.19.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
223
+ "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
224
+ "model.layers.19.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
225
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00003.safetensors",
226
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
227
+ "model.layers.2.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
228
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
229
+ "model.layers.2.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
230
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
231
+ "model.layers.2.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
232
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
233
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
234
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
235
+ "model.layers.2.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
236
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
237
+ "model.layers.2.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
238
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
239
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
240
+ "model.layers.2.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
241
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
242
+ "model.layers.2.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
243
+ "model.layers.20.input_layernorm.weight": "model-00001-of-00003.safetensors",
244
+ "model.layers.20.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
245
+ "model.layers.20.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
246
+ "model.layers.20.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
247
+ "model.layers.20.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
248
+ "model.layers.20.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
249
+ "model.layers.20.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
250
+ "model.layers.20.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
251
+ "model.layers.20.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
252
+ "model.layers.20.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
253
+ "model.layers.20.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
254
+ "model.layers.20.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
255
+ "model.layers.20.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
256
+ "model.layers.20.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
257
+ "model.layers.20.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
258
+ "model.layers.20.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
259
+ "model.layers.20.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
260
+ "model.layers.20.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
261
+ "model.layers.21.input_layernorm.weight": "model-00001-of-00003.safetensors",
262
+ "model.layers.21.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
263
+ "model.layers.21.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
264
+ "model.layers.21.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
265
+ "model.layers.21.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
266
+ "model.layers.21.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
267
+ "model.layers.21.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
268
+ "model.layers.21.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
269
+ "model.layers.21.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
270
+ "model.layers.21.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
271
+ "model.layers.21.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
272
+ "model.layers.21.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
273
+ "model.layers.21.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
274
+ "model.layers.21.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
275
+ "model.layers.21.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
276
+ "model.layers.21.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
277
+ "model.layers.21.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
278
+ "model.layers.21.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
279
+ "model.layers.22.input_layernorm.weight": "model-00001-of-00003.safetensors",
280
+ "model.layers.22.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
281
+ "model.layers.22.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
282
+ "model.layers.22.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
283
+ "model.layers.22.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
284
+ "model.layers.22.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
285
+ "model.layers.22.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
286
+ "model.layers.22.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
287
+ "model.layers.22.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
288
+ "model.layers.22.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
289
+ "model.layers.22.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
290
+ "model.layers.22.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
291
+ "model.layers.22.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
292
+ "model.layers.22.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
293
+ "model.layers.22.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
294
+ "model.layers.22.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
295
+ "model.layers.22.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
296
+ "model.layers.22.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
297
+ "model.layers.23.input_layernorm.weight": "model-00001-of-00003.safetensors",
298
+ "model.layers.23.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
299
+ "model.layers.23.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
300
+ "model.layers.23.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
301
+ "model.layers.23.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
302
+ "model.layers.23.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
303
+ "model.layers.23.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
304
+ "model.layers.23.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
305
+ "model.layers.23.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
306
+ "model.layers.23.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
307
+ "model.layers.23.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
308
+ "model.layers.23.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
309
+ "model.layers.23.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
310
+ "model.layers.23.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
311
+ "model.layers.23.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
312
+ "model.layers.23.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
313
+ "model.layers.23.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
314
+ "model.layers.23.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
315
+ "model.layers.24.input_layernorm.weight": "model-00001-of-00003.safetensors",
316
+ "model.layers.24.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
317
+ "model.layers.24.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
318
+ "model.layers.24.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
319
+ "model.layers.24.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
320
+ "model.layers.24.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
321
+ "model.layers.24.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
322
+ "model.layers.24.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
323
+ "model.layers.24.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
324
+ "model.layers.24.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
325
+ "model.layers.24.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
326
+ "model.layers.24.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
327
+ "model.layers.24.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
328
+ "model.layers.24.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
329
+ "model.layers.24.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
330
+ "model.layers.24.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
331
+ "model.layers.24.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
332
+ "model.layers.24.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
333
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00003.safetensors",
334
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
335
+ "model.layers.25.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
336
+ "model.layers.25.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
337
+ "model.layers.25.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
338
+ "model.layers.25.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
339
+ "model.layers.25.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
340
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
341
+ "model.layers.25.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
342
+ "model.layers.25.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
343
+ "model.layers.25.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
344
+ "model.layers.25.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
345
+ "model.layers.25.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
346
+ "model.layers.25.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
347
+ "model.layers.25.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
348
+ "model.layers.25.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
349
+ "model.layers.25.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
350
+ "model.layers.25.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
351
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00003.safetensors",
352
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
353
+ "model.layers.26.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
354
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
355
+ "model.layers.26.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
356
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
357
+ "model.layers.26.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
358
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
359
+ "model.layers.26.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
360
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
361
+ "model.layers.26.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
362
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
363
+ "model.layers.26.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
364
+ "model.layers.26.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
365
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
366
+ "model.layers.26.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
367
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
368
+ "model.layers.26.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
369
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00003.safetensors",
370
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
371
+ "model.layers.27.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
372
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
373
+ "model.layers.27.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
374
+ "model.layers.27.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
375
+ "model.layers.27.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
376
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
377
+ "model.layers.27.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
378
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
379
+ "model.layers.27.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
380
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
381
+ "model.layers.27.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
382
+ "model.layers.27.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
383
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
384
+ "model.layers.27.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
385
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
386
+ "model.layers.27.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
387
+ "model.layers.28.input_layernorm.weight": "model-00002-of-00003.safetensors",
388
+ "model.layers.28.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
389
+ "model.layers.28.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
390
+ "model.layers.28.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
391
+ "model.layers.28.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
392
+ "model.layers.28.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
393
+ "model.layers.28.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
394
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
395
+ "model.layers.28.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
396
+ "model.layers.28.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
397
+ "model.layers.28.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
398
+ "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
399
+ "model.layers.28.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
400
+ "model.layers.28.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
401
+ "model.layers.28.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
402
+ "model.layers.28.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
403
+ "model.layers.28.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
404
+ "model.layers.28.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
405
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00003.safetensors",
406
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
407
+ "model.layers.29.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
408
+ "model.layers.29.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
409
+ "model.layers.29.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
410
+ "model.layers.29.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
411
+ "model.layers.29.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
412
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
413
+ "model.layers.29.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
414
+ "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
415
+ "model.layers.29.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
416
+ "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
417
+ "model.layers.29.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
418
+ "model.layers.29.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
419
+ "model.layers.29.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
420
+ "model.layers.29.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
421
+ "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
422
+ "model.layers.29.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
423
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00003.safetensors",
424
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
425
+ "model.layers.3.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
426
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
427
+ "model.layers.3.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
428
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
429
+ "model.layers.3.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
430
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
431
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
432
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
433
+ "model.layers.3.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
434
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
435
+ "model.layers.3.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
436
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
437
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
438
+ "model.layers.3.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
439
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
440
+ "model.layers.3.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
441
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00003.safetensors",
442
+ "model.layers.30.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
443
+ "model.layers.30.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
444
+ "model.layers.30.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
445
+ "model.layers.30.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
446
+ "model.layers.30.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
447
+ "model.layers.30.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
448
+ "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
449
+ "model.layers.30.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
450
+ "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
451
+ "model.layers.30.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
452
+ "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
453
+ "model.layers.30.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
454
+ "model.layers.30.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
455
+ "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
456
+ "model.layers.30.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
457
+ "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
458
+ "model.layers.30.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
459
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00003.safetensors",
460
+ "model.layers.31.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
461
+ "model.layers.31.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
462
+ "model.layers.31.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
463
+ "model.layers.31.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
464
+ "model.layers.31.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
465
+ "model.layers.31.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
466
+ "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
467
+ "model.layers.31.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
468
+ "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
469
+ "model.layers.31.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
470
+ "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
471
+ "model.layers.31.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
472
+ "model.layers.31.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
473
+ "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
474
+ "model.layers.31.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
475
+ "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
476
+ "model.layers.31.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
477
+ "model.layers.32.input_layernorm.weight": "model-00002-of-00003.safetensors",
478
+ "model.layers.32.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
479
+ "model.layers.32.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
480
+ "model.layers.32.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
481
+ "model.layers.32.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
482
+ "model.layers.32.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
483
+ "model.layers.32.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
484
+ "model.layers.32.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
485
+ "model.layers.32.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
486
+ "model.layers.32.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
487
+ "model.layers.32.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
488
+ "model.layers.32.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
489
+ "model.layers.32.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
490
+ "model.layers.32.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
491
+ "model.layers.32.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
492
+ "model.layers.32.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
493
+ "model.layers.32.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
494
+ "model.layers.32.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
495
+ "model.layers.33.input_layernorm.weight": "model-00002-of-00003.safetensors",
496
+ "model.layers.33.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
497
+ "model.layers.33.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
498
+ "model.layers.33.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
499
+ "model.layers.33.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
500
+ "model.layers.33.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
501
+ "model.layers.33.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
502
+ "model.layers.33.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
503
+ "model.layers.33.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
504
+ "model.layers.33.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
505
+ "model.layers.33.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
506
+ "model.layers.33.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
507
+ "model.layers.33.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
508
+ "model.layers.33.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
509
+ "model.layers.33.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
510
+ "model.layers.33.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
511
+ "model.layers.33.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
512
+ "model.layers.33.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
513
+ "model.layers.34.input_layernorm.weight": "model-00002-of-00003.safetensors",
514
+ "model.layers.34.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
515
+ "model.layers.34.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
516
+ "model.layers.34.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
517
+ "model.layers.34.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
518
+ "model.layers.34.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
519
+ "model.layers.34.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
520
+ "model.layers.34.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
521
+ "model.layers.34.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
522
+ "model.layers.34.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
523
+ "model.layers.34.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
524
+ "model.layers.34.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
525
+ "model.layers.34.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
526
+ "model.layers.34.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
527
+ "model.layers.34.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
528
+ "model.layers.34.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
529
+ "model.layers.34.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
530
+ "model.layers.34.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
531
+ "model.layers.35.input_layernorm.weight": "model-00002-of-00003.safetensors",
532
+ "model.layers.35.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
533
+ "model.layers.35.mlp.down_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
534
+ "model.layers.35.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
535
+ "model.layers.35.mlp.gate_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
536
+ "model.layers.35.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
537
+ "model.layers.35.mlp.up_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
538
+ "model.layers.35.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
539
+ "model.layers.35.self_attn.k_norm.weight": "model-00002-of-00003.safetensors",
540
+ "model.layers.35.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
541
+ "model.layers.35.self_attn.k_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
542
+ "model.layers.35.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
543
+ "model.layers.35.self_attn.o_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
544
+ "model.layers.35.self_attn.q_norm.weight": "model-00002-of-00003.safetensors",
545
+ "model.layers.35.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
546
+ "model.layers.35.self_attn.q_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
547
+ "model.layers.35.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
548
+ "model.layers.35.self_attn.v_proj.weight_scale_inv": "model-00002-of-00003.safetensors",
549
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00003.safetensors",
550
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
551
+ "model.layers.4.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
552
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
553
+ "model.layers.4.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
554
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
555
+ "model.layers.4.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
556
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
557
+ "model.layers.4.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
558
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
559
+ "model.layers.4.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
560
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
561
+ "model.layers.4.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
562
+ "model.layers.4.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
563
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
564
+ "model.layers.4.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
565
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
566
+ "model.layers.4.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
567
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00003.safetensors",
568
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
569
+ "model.layers.5.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
570
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
571
+ "model.layers.5.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
572
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
573
+ "model.layers.5.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
574
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
575
+ "model.layers.5.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
576
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
577
+ "model.layers.5.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
578
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
579
+ "model.layers.5.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
580
+ "model.layers.5.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
581
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
582
+ "model.layers.5.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
583
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
584
+ "model.layers.5.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
585
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00003.safetensors",
586
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
587
+ "model.layers.6.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
588
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
589
+ "model.layers.6.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
590
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
591
+ "model.layers.6.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
592
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
593
+ "model.layers.6.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
594
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
595
+ "model.layers.6.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
596
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
597
+ "model.layers.6.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
598
+ "model.layers.6.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
599
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
600
+ "model.layers.6.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
601
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
602
+ "model.layers.6.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
603
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00003.safetensors",
604
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
605
+ "model.layers.7.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
606
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
607
+ "model.layers.7.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
608
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
609
+ "model.layers.7.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
610
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
611
+ "model.layers.7.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
612
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
613
+ "model.layers.7.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
614
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
615
+ "model.layers.7.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
616
+ "model.layers.7.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
617
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
618
+ "model.layers.7.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
619
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
620
+ "model.layers.7.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
621
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00003.safetensors",
622
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
623
+ "model.layers.8.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
624
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
625
+ "model.layers.8.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
626
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
627
+ "model.layers.8.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
628
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
629
+ "model.layers.8.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
630
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
631
+ "model.layers.8.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
632
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
633
+ "model.layers.8.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
634
+ "model.layers.8.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
635
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
636
+ "model.layers.8.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
637
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
638
+ "model.layers.8.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
639
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00003.safetensors",
640
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
641
+ "model.layers.9.mlp.down_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
642
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
643
+ "model.layers.9.mlp.gate_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
644
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
645
+ "model.layers.9.mlp.up_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
646
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
647
+ "model.layers.9.self_attn.k_norm.weight": "model-00001-of-00003.safetensors",
648
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
649
+ "model.layers.9.self_attn.k_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
650
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
651
+ "model.layers.9.self_attn.o_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
652
+ "model.layers.9.self_attn.q_norm.weight": "model-00001-of-00003.safetensors",
653
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
654
+ "model.layers.9.self_attn.q_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
655
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
656
+ "model.layers.9.self_attn.v_proj.weight_scale_inv": "model-00001-of-00003.safetensors",
657
+ "model.norm.weight": "model-00002-of-00003.safetensors"
658
+ }
659
+ }
modeling_fp8_qwen3.py ADDED
@@ -0,0 +1,518 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """
16
+ Tutorial: https://huggingface.co/docs/transformers/en/custom_models
17
+ """
18
+
19
+ from typing import Callable, Optional, Union
20
+
21
+ import torch
22
+ from torch import nn
23
+ from transformers.generation import GenerationMixin
24
+
25
+ from transformers.cache_utils import Cache
26
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
27
+ from transformers.modeling_layers import GradientCheckpointingLayer
28
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
29
+ from transformers.utils import TransformersKwargs, can_return_tuple
30
+ from transformers.processing_utils import Unpack
31
+ from transformers.utils import auto_docstring, logging
32
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
33
+
34
+ from transformers.models.qwen3.modeling_qwen3 import (
35
+ Qwen3MLP,
36
+ Qwen3Attention,
37
+ apply_rotary_pos_emb,
38
+ eager_attention_forward,
39
+ Qwen3RMSNorm,
40
+ Qwen3RotaryEmbedding,
41
+ Qwen3Model,
42
+ Qwen3ForCausalLM,
43
+ )
44
+ from transformers.modeling_layers import (
45
+ GenericForQuestionAnswering,
46
+ GenericForSequenceClassification,
47
+ GenericForTokenClassification,
48
+ GradientCheckpointingLayer,
49
+ )
50
+
51
+ from .configuration_fp8_qwen3 import FP8Qwen3Config
52
+
53
+ from torchao.float8.float8_training_tensor import Float8TrainingTensor
54
+
55
+ from quasar.module import (
56
+ FP8Quant,
57
+ FP8RMSNorm,
58
+ FP8DSLinearWithCoat,
59
+ FP8DSLinearWithCoatWeightBlock,
60
+ FP8FusedSiLUMul,
61
+ FP8Identity,
62
+ )
63
+
64
+ from quasar.kernel.configs import FP8RMSNormConfig, QuantType, FP8MulConfig, FP8DSLinearWithCoatConfig, FP8QuantConfig
65
+ from quasar.kernel.quant.quantize_hp2pb import fp8_quantize_hp2pb
66
+ from quasar.kernel.quant.dequantize_pb2hp import fp8_dequantize_pb2hp
67
+
68
+ logger = logging.get_logger(__name__)
69
+
70
+
71
+ class FP8Qwen3MLP(Qwen3MLP):
72
+ def __init__(self, config: FP8Qwen3Config):
73
+ super().__init__(config)
74
+ linear_module = FP8DSLinearWithCoat if config.fp8_config.training_mode else FP8DSLinearWithCoatWeightBlock
75
+ self.gate_proj = linear_module(
76
+ self.hidden_size, self.intermediate_size, bias=False,
77
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"gate_proj", scale_dtype=torch.float32)
78
+ )
79
+ self.up_proj = linear_module(
80
+ self.hidden_size, self.intermediate_size, bias=False,
81
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"up_proj", scale_dtype=torch.float32)
82
+ )
83
+ self.down_proj = linear_module(
84
+ self.intermediate_size, self.hidden_size, bias=False,
85
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"down_proj", scale_dtype=torch.float32)
86
+ )
87
+
88
+ if config.hidden_act == "silu":
89
+ mul_config = FP8MulConfig(
90
+ quant_type=QuantType.MUL,
91
+ scale_dtype=torch.float32,
92
+ )
93
+ self.act_fn = FP8FusedSiLUMul(mul_config)
94
+ else:
95
+ raise ValueError(f"Unsupported activation function: {config.hidden_act}")
96
+
97
+ def forward(self, x):
98
+ gate_x = self.gate_proj(x)
99
+ up_x = self.up_proj(x)
100
+
101
+ mul_x = self.act_fn(gate_x, up_x)
102
+ down_proj = self.down_proj(mul_x)
103
+
104
+ return down_proj
105
+
106
+
107
+ class FP8Qwen3Attention(Qwen3Attention):
108
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
109
+
110
+ def __init__(self, config: FP8Qwen3Config, layer_idx: int):
111
+ super().__init__(config, layer_idx)
112
+ linear_module = FP8DSLinearWithCoat if config.fp8_config.training_mode else FP8DSLinearWithCoatWeightBlock
113
+ self.q_proj = linear_module(
114
+ config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias,
115
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"q_proj", scale_dtype=torch.float32)
116
+ )
117
+ self.k_proj = linear_module(
118
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias,
119
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"k_proj", scale_dtype=torch.float32)
120
+ )
121
+ self.v_proj = linear_module(
122
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias,
123
+ dsgemm_config=FP8DSLinearWithCoatConfig(layer_name=f"v_proj", scale_dtype=torch.float32)
124
+ )
125
+
126
+
127
+ # In both training and inference, we quantize the output of the attention layer.
128
+ self.o_proj_quant = FP8Quant(
129
+ quant_config=FP8QuantConfig(
130
+ float8_dtype=config.fp8_config.float8_dtype,
131
+ quant_type=QuantType.DIV,
132
+ fwd_block_size=config.fp8_config.mm_block_size,
133
+ layer_name=f"o_proj_quant",
134
+ scale_dtype=torch.float32,
135
+ )
136
+ )
137
+
138
+ self.o_proj = linear_module(
139
+ config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias,
140
+ dsgemm_config=FP8DSLinearWithCoatConfig(
141
+ fwd_input_quant_type=QuantType.DIV,
142
+ layer_name=f"o_proj",
143
+ scale_dtype=torch.float32,
144
+ )
145
+ )
146
+
147
+ def forward(
148
+ self,
149
+ hidden_states: torch.Tensor,
150
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
151
+ attention_mask: Optional[torch.Tensor],
152
+ past_key_value: Optional[Cache] = None,
153
+ cache_position: Optional[torch.LongTensor] = None,
154
+ **kwargs: Unpack[FlashAttentionKwargs],
155
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor], Optional[tuple[torch.Tensor]]]:
156
+ if isinstance(hidden_states, Float8TrainingTensor):
157
+ # Float8Tensor's last dim is quantize group size, not hidden size.
158
+ input_shape = hidden_states.shape[:-2]
159
+ else:
160
+ input_shape = hidden_states.shape[:-1]
161
+ hidden_shape = (*input_shape, -1, self.head_dim)
162
+
163
+ # QKV-Proj
164
+ query_states = self.q_proj(hidden_states).view(hidden_shape)
165
+ key_states = self.k_proj(hidden_states).view(hidden_shape)
166
+ value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
167
+
168
+ # QK-Norm
169
+ query_states = self.q_norm(query_states).transpose(1, 2)
170
+ key_states = self.k_norm(key_states).transpose(1, 2)
171
+
172
+ # RoPE
173
+ cos, sin = position_embeddings
174
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
175
+
176
+ # TODO: Add quantization
177
+
178
+ # Past-KV
179
+ if past_key_value is not None:
180
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
181
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
182
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
183
+
184
+ attention_interface: Callable = eager_attention_forward
185
+ if self.config._attn_implementation != "eager":
186
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
187
+
188
+ attn_output, attn_weights = attention_interface(
189
+ self,
190
+ query_states,
191
+ key_states,
192
+ value_states,
193
+ attention_mask,
194
+ dropout=0.0 if not self.training else self.attention_dropout,
195
+ scaling=self.scaling,
196
+ sliding_window=self.sliding_window, # diff with Llama
197
+ **kwargs,
198
+ )
199
+
200
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
201
+
202
+ # Quantize the output of the attention layer.
203
+ attn_output = self.o_proj_quant(attn_output)
204
+ attn_output = self.o_proj(attn_output)
205
+ return attn_output, attn_weights
206
+
207
+
208
+ class FP8Qwen3DecoderLayer(GradientCheckpointingLayer):
209
+ def __init__(self, config: FP8Qwen3Config, layer_idx: int):
210
+ super().__init__()
211
+ self.hidden_size = config.hidden_size
212
+
213
+ self.self_attn = FP8Qwen3Attention(config=config, layer_idx=layer_idx)
214
+
215
+ self.mlp = FP8Qwen3MLP(config)
216
+ self.input_layernorm = FP8RMSNorm(
217
+ config.hidden_size,
218
+ eps=config.rms_norm_eps,
219
+ norm_config=FP8RMSNormConfig(
220
+ mm_block_size=config.fp8_config.mm_block_size,
221
+ quant_type=QuantType.MUL,
222
+ scale_dtype=torch.float32,
223
+ save_fp8_input=True,
224
+ ),
225
+ )
226
+ self.post_attention_layernorm = FP8RMSNorm(
227
+ config.hidden_size,
228
+ eps=config.rms_norm_eps,
229
+ norm_config=FP8RMSNormConfig(
230
+ mm_block_size=config.fp8_config.mm_block_size,
231
+ quant_type=QuantType.MUL,
232
+ scale_dtype=torch.float32,
233
+ save_fp8_input=True,
234
+ ),
235
+ )
236
+ self.attention_type = config.layer_types[layer_idx]
237
+
238
+ def forward(
239
+ self,
240
+ hidden_states: torch.Tensor,
241
+ attention_mask: Optional[torch.Tensor] = None,
242
+ position_ids: Optional[torch.LongTensor] = None,
243
+ past_key_value: Optional[Cache] = None,
244
+ use_cache: Optional[bool] = False,
245
+ cache_position: Optional[torch.LongTensor] = None,
246
+ position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
247
+ **kwargs: Unpack[FlashAttentionKwargs],
248
+ ) -> tuple[torch.FloatTensor, Optional[tuple[torch.FloatTensor, torch.FloatTensor]]]:
249
+ residual = hidden_states
250
+ hidden_states = self.input_layernorm(hidden_states)
251
+
252
+ # Self Attention
253
+ hidden_states, self_attn_weights = self.self_attn(
254
+ hidden_states=hidden_states,
255
+ attention_mask=attention_mask,
256
+ position_ids=position_ids,
257
+ past_key_value=past_key_value,
258
+ use_cache=use_cache,
259
+ cache_position=cache_position,
260
+ position_embeddings=position_embeddings,
261
+ **kwargs,
262
+ )
263
+ hidden_states = residual + hidden_states
264
+
265
+ # Fully Connected
266
+ residual = hidden_states
267
+ hidden_states = self.post_attention_layernorm(hidden_states)
268
+
269
+ hidden_states = self.mlp(hidden_states)
270
+ hidden_states = residual + hidden_states
271
+
272
+ return hidden_states
273
+
274
+
275
+ @auto_docstring
276
+ class FP8Qwen3PreTrainedModel(PreTrainedModel):
277
+ config_class = FP8Qwen3Config
278
+ config: FP8Qwen3Config
279
+ base_model_prefix = "model"
280
+ supports_gradient_checkpointing = True
281
+ _no_split_modules = ["FP8Qwen3DecoderLayer"]
282
+ _skip_keys_device_placement = ["past_key_values"]
283
+ _supports_flash_attn = True
284
+ _supports_sdpa = True
285
+ _supports_flex_attn = True
286
+
287
+ _can_compile_fullgraph = True
288
+ _supports_attention_backend = True
289
+ _can_record_outputs = {
290
+ "hidden_states": FP8Qwen3DecoderLayer,
291
+ "attentions": FP8Qwen3Attention,
292
+ }
293
+
294
+
295
+ def _init_weights(self, module):
296
+ std = self.config.initializer_range
297
+ if isinstance(module, nn.Linear):
298
+ module.weight.data.normal_(mean=0.0, std=std)
299
+ if module.bias is not None:
300
+ module.bias.data.zero_()
301
+ elif isinstance(module, nn.Embedding):
302
+ module.weight.data.normal_(mean=0.0, std=std)
303
+ if module.padding_idx is not None:
304
+ module.weight.data[module.padding_idx].zero_()
305
+ elif isinstance(module, FP8RMSNorm):
306
+ module.weight.data.fill_(1.0)
307
+
308
+
309
+ @auto_docstring
310
+ class FP8Qwen3Model(FP8Qwen3PreTrainedModel):
311
+ config_class = FP8Qwen3Config
312
+
313
+ def __init__(self, config: FP8Qwen3Config):
314
+ super().__init__(config)
315
+
316
+ self.layers = nn.ModuleList(
317
+ [FP8Qwen3DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
318
+ )
319
+
320
+ self.padding_idx = config.pad_token_id
321
+ self.vocab_size = config.vocab_size
322
+
323
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
324
+ self.norm = Qwen3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
325
+ self.rotary_emb = Qwen3RotaryEmbedding(config=config)
326
+ self.gradient_checkpointing = False
327
+ self.has_sliding_layers = "sliding_attention" in self.config.layer_types
328
+
329
+ # Initialize weights and apply final processing
330
+ self.post_init()
331
+
332
+ forward = Qwen3Model.forward
333
+
334
+
335
+ @auto_docstring
336
+ class FP8Qwen3ForCausalLM(FP8Qwen3PreTrainedModel, GenerationMixin):
337
+ config_class = FP8Qwen3Config
338
+ _tied_weights_keys = ["lm_head.weight"]
339
+ _tp_plan = {"lm_head": "colwise_rep"}
340
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
341
+
342
+ def __init__(self, config):
343
+ super().__init__(config)
344
+ self.model = FP8Qwen3Model(config)
345
+
346
+ self.vocab_size = config.vocab_size
347
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
348
+
349
+ # Initialize weights and apply final processing
350
+ self.post_init()
351
+
352
+ set_decoder = Qwen3ForCausalLM.set_decoder
353
+ get_decoder = Qwen3ForCausalLM.get_decoder
354
+ # forward = Qwen3ForCausalLM.forward
355
+
356
+ def forward(
357
+ self,
358
+ input_ids: Optional[torch.LongTensor] = None,
359
+ attention_mask: Optional[torch.Tensor] = None,
360
+ position_ids: Optional[torch.LongTensor] = None,
361
+ past_key_values: Optional[Cache] = None,
362
+ inputs_embeds: Optional[torch.FloatTensor] = None,
363
+ labels: Optional[torch.LongTensor] = None,
364
+ use_cache: Optional[bool] = None,
365
+ cache_position: Optional[torch.LongTensor] = None,
366
+ logits_to_keep: Union[int, torch.Tensor] = 0,
367
+ **kwargs: Unpack[TransformersKwargs],
368
+ ) -> CausalLMOutputWithPast:
369
+ r"""
370
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
371
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
372
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
373
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
374
+
375
+ Example:
376
+
377
+ ```python
378
+ >>> from transformers import AutoTokenizer, Qwen3ForCausalLM
379
+
380
+ >>> model = Qwen3ForCausalLM.from_pretrained("Qwen/Qwen3-8B")
381
+ >>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
382
+
383
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
384
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
385
+
386
+ >>> # Generate
387
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
388
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
389
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
390
+ ```"""
391
+ outputs: BaseModelOutputWithPast = self.model(
392
+ input_ids=input_ids,
393
+ attention_mask=attention_mask,
394
+ position_ids=position_ids,
395
+ past_key_values=past_key_values,
396
+ inputs_embeds=inputs_embeds,
397
+ use_cache=use_cache,
398
+ cache_position=cache_position,
399
+ **kwargs,
400
+ )
401
+
402
+ hidden_states = outputs.last_hidden_state
403
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
404
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
405
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
406
+
407
+ loss = None
408
+ if labels is not None:
409
+ loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
410
+
411
+ return CausalLMOutputWithPast(
412
+ loss=loss,
413
+ logits=logits,
414
+ past_key_values=outputs.past_key_values,
415
+ hidden_states=outputs.hidden_states,
416
+ attentions=outputs.attentions,
417
+ )
418
+
419
+
420
+ class FP8Qwen3ForSequenceClassification(GenericForSequenceClassification, FP8Qwen3PreTrainedModel):
421
+ pass
422
+
423
+
424
+ class FP8Qwen3ForTokenClassification(GenericForTokenClassification, FP8Qwen3PreTrainedModel):
425
+ pass
426
+
427
+
428
+ class FP8Qwen3ForQuestionAnswering(GenericForQuestionAnswering, FP8Qwen3PreTrainedModel):
429
+ base_model_prefix = "transformer" # For BC, where `transformer` was used instead of `model`
430
+
431
+
432
+ __all__ = [
433
+ "FP8Qwen3Model",
434
+ "FP8Qwen3PreTrainedModel",
435
+ "FP8Qwen3ForCausalLM",
436
+ "FP8Qwen3ForSequenceClassification",
437
+ "FP8Qwen3ForTokenClassification",
438
+ "FP8Qwen3ForQuestionAnswering",
439
+ ]
440
+
441
+ FP8Qwen3Model.register_for_auto_class("AutoModel")
442
+ FP8Qwen3ForCausalLM.register_for_auto_class("AutoModelForCausalLM")
443
+
444
+
445
+ def make_state_dict_compatible_with_hf(
446
+ state_dict: dict[str, torch.Tensor],
447
+ linear_keys: list[str],
448
+ undesired_linear_keys: list[str],
449
+ config: FP8Qwen3Config = FP8Qwen3Config(),
450
+ already_fp8: bool = False,
451
+ ) -> dict[str, torch.Tensor]:
452
+ """
453
+ Make the state dict compatible with HuggingFace.
454
+ """
455
+ # Assert linear keys and undesired linear keys are non-overlapping
456
+ assert set(linear_keys).isdisjoint(set(undesired_linear_keys))
457
+
458
+ compatible_state_dict = {}
459
+
460
+ for key in state_dict.keys():
461
+ if any(k in key for k in linear_keys):
462
+ weight = state_dict[key]
463
+
464
+ if already_fp8:
465
+ # The name (either weight or weight_scale_inv) is the same as the original key.
466
+ compatible_state_dict[key] = weight
467
+ else:
468
+ # We need to use float32 for the scale, since we are using DeepGEMM.
469
+ tmp_quant_cfg = FP8QuantConfig(
470
+ float8_dtype=config.fp8_config.float8_dtype,
471
+ quant_type=config.fp8_config.quant_type,
472
+ fwd_block_size=config.fp8_config.mm_block_size,
473
+ scale_dtype=torch.float32,
474
+ )
475
+ quant_weight, scale_weight = fp8_quantize_hp2pb(
476
+ weight, tmp_quant_cfg, block_size=config.fp8_config.mm_block_size
477
+ )
478
+
479
+ name_quant = key.replace("weight", "weight")
480
+ name_scale = key.replace("weight", "weight_scale_inv")
481
+ compatible_state_dict[name_quant] = quant_weight
482
+ compatible_state_dict[name_scale] = scale_weight
483
+
484
+ elif any(k in key for k in undesired_linear_keys):
485
+ # Dequantize the weight
486
+ if already_fp8:
487
+ # We only do the dequantization once. When encountering the weight, we skip it.
488
+ if "weight_scale_inv" in key:
489
+ name_quant = key.replace("weight_scale_inv", "weight")
490
+ quant_weight = state_dict[name_quant]
491
+ scale_weight = state_dict[key]
492
+ weight = fp8_dequantize_pb2hp(quant_weight, scale_weight, config.fp8_config, block_size=config.fp8_config.mm_block_size)
493
+ compatible_state_dict[name_quant] = weight
494
+ else:
495
+ # Do not quantize the weight.
496
+ compatible_state_dict[key] = state_dict[key]
497
+
498
+ else:
499
+ compatible_state_dict[key] = state_dict[key]
500
+ return compatible_state_dict
501
+
502
+
503
+ def set_named_weight_to_fp8(
504
+ model: Qwen3ForCausalLM,
505
+ linear_keys: list[str] = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
506
+ ):
507
+ """
508
+ Set the dtype of the weight of the linear layers to FP8.
509
+ Also set layer name for debugging.
510
+ """
511
+ for name, module in model.named_modules():
512
+ # Match the name of the last module.
513
+ if name.split(".")[-1] in linear_keys:
514
+ module.weight.data = module.weight.data.to(torch.float8_e4m3fn)
515
+ module.weight_scale_inv.data = module.weight_scale_inv.data.to(torch.float32)
516
+ module.layer_name = name
517
+
518
+ return model