add model file
Browse files- config.json +3 -3
- configuration_qwen.py +71 -0
- model.safetensors.index.json +874 -0
- modeling_qwen.py +1367 -0
config.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "
|
3 |
"architectures": [
|
4 |
"QWenLMHeadModel"
|
5 |
],
|
6 |
"attn_dropout_prob": 0.0,
|
7 |
"auto_map": {
|
8 |
-
"AutoConfig": "
|
9 |
-
"AutoModelForCausalLM": "
|
10 |
},
|
11 |
"bf16": true,
|
12 |
"emb_dropout_prob": 0.0,
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "yzsydlc/qwen-primeai-gptq-wiki-4bit",
|
3 |
"architectures": [
|
4 |
"QWenLMHeadModel"
|
5 |
],
|
6 |
"attn_dropout_prob": 0.0,
|
7 |
"auto_map": {
|
8 |
+
"AutoConfig": "yzsydlc/qwen-primeai-gptq-wiki-4bit--configuration_qwen.QWenConfig",
|
9 |
+
"AutoModelForCausalLM": "yzsydlc/qwen-primeai-gptq-wiki-4bit--modeling_qwen.QWenLMHeadModel"
|
10 |
},
|
11 |
"bf16": true,
|
12 |
"emb_dropout_prob": 0.0,
|
configuration_qwen.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
from transformers import PretrainedConfig
|
7 |
+
|
8 |
+
|
9 |
+
class QWenConfig(PretrainedConfig):
|
10 |
+
model_type = "qwen"
|
11 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
12 |
+
|
13 |
+
def __init__(
|
14 |
+
self,
|
15 |
+
vocab_size=151936,
|
16 |
+
hidden_size=4096,
|
17 |
+
num_hidden_layers=32,
|
18 |
+
num_attention_heads=32,
|
19 |
+
emb_dropout_prob=0.0,
|
20 |
+
attn_dropout_prob=0.0,
|
21 |
+
layer_norm_epsilon=1e-6,
|
22 |
+
initializer_range=0.02,
|
23 |
+
max_position_embeddings=8192,
|
24 |
+
scale_attn_weights=True,
|
25 |
+
use_cache=True,
|
26 |
+
bf16=False,
|
27 |
+
fp16=False,
|
28 |
+
fp32=False,
|
29 |
+
kv_channels=128,
|
30 |
+
rotary_pct=1.0,
|
31 |
+
rotary_emb_base=10000,
|
32 |
+
use_dynamic_ntk=True,
|
33 |
+
use_logn_attn=True,
|
34 |
+
use_flash_attn="auto",
|
35 |
+
intermediate_size=22016,
|
36 |
+
no_bias=True,
|
37 |
+
tie_word_embeddings=False,
|
38 |
+
use_cache_quantization=False,
|
39 |
+
use_cache_kernel=False,
|
40 |
+
softmax_in_fp32=False,
|
41 |
+
**kwargs,
|
42 |
+
):
|
43 |
+
self.vocab_size = vocab_size
|
44 |
+
self.hidden_size = hidden_size
|
45 |
+
self.intermediate_size = intermediate_size
|
46 |
+
self.num_hidden_layers = num_hidden_layers
|
47 |
+
self.num_attention_heads = num_attention_heads
|
48 |
+
self.emb_dropout_prob = emb_dropout_prob
|
49 |
+
self.attn_dropout_prob = attn_dropout_prob
|
50 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
51 |
+
self.initializer_range = initializer_range
|
52 |
+
self.scale_attn_weights = scale_attn_weights
|
53 |
+
self.use_cache = use_cache
|
54 |
+
self.max_position_embeddings = max_position_embeddings
|
55 |
+
self.bf16 = bf16
|
56 |
+
self.fp16 = fp16
|
57 |
+
self.fp32 = fp32
|
58 |
+
self.kv_channels = kv_channels
|
59 |
+
self.rotary_pct = rotary_pct
|
60 |
+
self.rotary_emb_base = rotary_emb_base
|
61 |
+
self.use_dynamic_ntk = use_dynamic_ntk
|
62 |
+
self.use_logn_attn = use_logn_attn
|
63 |
+
self.use_flash_attn = use_flash_attn
|
64 |
+
self.no_bias = no_bias
|
65 |
+
self.use_cache_quantization = use_cache_quantization
|
66 |
+
self.use_cache_kernel = use_cache_kernel
|
67 |
+
self.softmax_in_fp32 = softmax_in_fp32
|
68 |
+
super().__init__(
|
69 |
+
tie_word_embeddings=tie_word_embeddings,
|
70 |
+
**kwargs
|
71 |
+
)
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,874 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 5860564992
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "gptq_model-4bit-128g.safetensors",
|
7 |
+
"transformer.h.0.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
8 |
+
"transformer.h.0.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
9 |
+
"transformer.h.0.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
10 |
+
"transformer.h.0.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
11 |
+
"transformer.h.0.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
12 |
+
"transformer.h.0.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
13 |
+
"transformer.h.0.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
14 |
+
"transformer.h.0.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
15 |
+
"transformer.h.0.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
16 |
+
"transformer.h.0.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
17 |
+
"transformer.h.0.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
18 |
+
"transformer.h.0.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
19 |
+
"transformer.h.0.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
20 |
+
"transformer.h.0.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
21 |
+
"transformer.h.0.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
22 |
+
"transformer.h.0.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
23 |
+
"transformer.h.0.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
24 |
+
"transformer.h.0.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
25 |
+
"transformer.h.0.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
26 |
+
"transformer.h.0.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
27 |
+
"transformer.h.0.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
28 |
+
"transformer.h.0.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
29 |
+
"transformer.h.0.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
30 |
+
"transformer.h.0.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
31 |
+
"transformer.h.0.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
32 |
+
"transformer.h.0.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
33 |
+
"transformer.h.0.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
34 |
+
"transformer.h.1.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
35 |
+
"transformer.h.1.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
36 |
+
"transformer.h.1.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
37 |
+
"transformer.h.1.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
38 |
+
"transformer.h.1.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
39 |
+
"transformer.h.1.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
40 |
+
"transformer.h.1.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
41 |
+
"transformer.h.1.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
42 |
+
"transformer.h.1.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
43 |
+
"transformer.h.1.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
44 |
+
"transformer.h.1.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
45 |
+
"transformer.h.1.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
46 |
+
"transformer.h.1.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
47 |
+
"transformer.h.1.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
48 |
+
"transformer.h.1.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
49 |
+
"transformer.h.1.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
50 |
+
"transformer.h.1.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
51 |
+
"transformer.h.1.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
52 |
+
"transformer.h.1.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
53 |
+
"transformer.h.1.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
54 |
+
"transformer.h.1.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
55 |
+
"transformer.h.1.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
56 |
+
"transformer.h.1.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
57 |
+
"transformer.h.1.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
58 |
+
"transformer.h.1.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
59 |
+
"transformer.h.1.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
60 |
+
"transformer.h.1.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
61 |
+
"transformer.h.10.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
62 |
+
"transformer.h.10.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
63 |
+
"transformer.h.10.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
64 |
+
"transformer.h.10.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
65 |
+
"transformer.h.10.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
66 |
+
"transformer.h.10.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
67 |
+
"transformer.h.10.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
68 |
+
"transformer.h.10.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
69 |
+
"transformer.h.10.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
70 |
+
"transformer.h.10.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
71 |
+
"transformer.h.10.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
72 |
+
"transformer.h.10.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
73 |
+
"transformer.h.10.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
74 |
+
"transformer.h.10.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
75 |
+
"transformer.h.10.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
76 |
+
"transformer.h.10.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
77 |
+
"transformer.h.10.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
78 |
+
"transformer.h.10.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
79 |
+
"transformer.h.10.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
80 |
+
"transformer.h.10.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
81 |
+
"transformer.h.10.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
82 |
+
"transformer.h.10.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
83 |
+
"transformer.h.10.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
84 |
+
"transformer.h.10.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
85 |
+
"transformer.h.10.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
86 |
+
"transformer.h.10.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
87 |
+
"transformer.h.10.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
88 |
+
"transformer.h.11.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
89 |
+
"transformer.h.11.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
90 |
+
"transformer.h.11.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
91 |
+
"transformer.h.11.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
92 |
+
"transformer.h.11.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
93 |
+
"transformer.h.11.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
94 |
+
"transformer.h.11.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
95 |
+
"transformer.h.11.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
96 |
+
"transformer.h.11.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
97 |
+
"transformer.h.11.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
98 |
+
"transformer.h.11.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
99 |
+
"transformer.h.11.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
100 |
+
"transformer.h.11.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
101 |
+
"transformer.h.11.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
102 |
+
"transformer.h.11.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
103 |
+
"transformer.h.11.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
104 |
+
"transformer.h.11.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
105 |
+
"transformer.h.11.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
106 |
+
"transformer.h.11.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
107 |
+
"transformer.h.11.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
108 |
+
"transformer.h.11.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
109 |
+
"transformer.h.11.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
110 |
+
"transformer.h.11.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
111 |
+
"transformer.h.11.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
112 |
+
"transformer.h.11.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
113 |
+
"transformer.h.11.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
114 |
+
"transformer.h.11.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
115 |
+
"transformer.h.12.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
116 |
+
"transformer.h.12.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
117 |
+
"transformer.h.12.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
118 |
+
"transformer.h.12.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
119 |
+
"transformer.h.12.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
120 |
+
"transformer.h.12.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
121 |
+
"transformer.h.12.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
122 |
+
"transformer.h.12.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
123 |
+
"transformer.h.12.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
124 |
+
"transformer.h.12.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
125 |
+
"transformer.h.12.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
126 |
+
"transformer.h.12.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
127 |
+
"transformer.h.12.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
128 |
+
"transformer.h.12.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
129 |
+
"transformer.h.12.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
130 |
+
"transformer.h.12.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
131 |
+
"transformer.h.12.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
132 |
+
"transformer.h.12.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
133 |
+
"transformer.h.12.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
134 |
+
"transformer.h.12.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
135 |
+
"transformer.h.12.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
136 |
+
"transformer.h.12.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
137 |
+
"transformer.h.12.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
138 |
+
"transformer.h.12.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
139 |
+
"transformer.h.12.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
140 |
+
"transformer.h.12.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
141 |
+
"transformer.h.12.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
142 |
+
"transformer.h.13.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
143 |
+
"transformer.h.13.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
144 |
+
"transformer.h.13.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
145 |
+
"transformer.h.13.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
146 |
+
"transformer.h.13.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
147 |
+
"transformer.h.13.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
148 |
+
"transformer.h.13.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
149 |
+
"transformer.h.13.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
150 |
+
"transformer.h.13.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
151 |
+
"transformer.h.13.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
152 |
+
"transformer.h.13.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
153 |
+
"transformer.h.13.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
154 |
+
"transformer.h.13.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
155 |
+
"transformer.h.13.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
156 |
+
"transformer.h.13.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
157 |
+
"transformer.h.13.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
158 |
+
"transformer.h.13.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
159 |
+
"transformer.h.13.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
160 |
+
"transformer.h.13.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
161 |
+
"transformer.h.13.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
162 |
+
"transformer.h.13.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
163 |
+
"transformer.h.13.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
164 |
+
"transformer.h.13.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
165 |
+
"transformer.h.13.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
166 |
+
"transformer.h.13.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
167 |
+
"transformer.h.13.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
168 |
+
"transformer.h.13.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
169 |
+
"transformer.h.14.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
170 |
+
"transformer.h.14.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
171 |
+
"transformer.h.14.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
172 |
+
"transformer.h.14.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
173 |
+
"transformer.h.14.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
174 |
+
"transformer.h.14.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
175 |
+
"transformer.h.14.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
176 |
+
"transformer.h.14.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
177 |
+
"transformer.h.14.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
178 |
+
"transformer.h.14.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
179 |
+
"transformer.h.14.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
180 |
+
"transformer.h.14.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
181 |
+
"transformer.h.14.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
182 |
+
"transformer.h.14.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
183 |
+
"transformer.h.14.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
184 |
+
"transformer.h.14.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
185 |
+
"transformer.h.14.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
186 |
+
"transformer.h.14.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
187 |
+
"transformer.h.14.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
188 |
+
"transformer.h.14.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
189 |
+
"transformer.h.14.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
190 |
+
"transformer.h.14.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
191 |
+
"transformer.h.14.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
192 |
+
"transformer.h.14.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
193 |
+
"transformer.h.14.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
194 |
+
"transformer.h.14.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
195 |
+
"transformer.h.14.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
196 |
+
"transformer.h.15.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
197 |
+
"transformer.h.15.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
198 |
+
"transformer.h.15.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
199 |
+
"transformer.h.15.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
200 |
+
"transformer.h.15.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
201 |
+
"transformer.h.15.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
202 |
+
"transformer.h.15.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
203 |
+
"transformer.h.15.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
204 |
+
"transformer.h.15.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
205 |
+
"transformer.h.15.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
206 |
+
"transformer.h.15.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
207 |
+
"transformer.h.15.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
208 |
+
"transformer.h.15.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
209 |
+
"transformer.h.15.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
210 |
+
"transformer.h.15.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
211 |
+
"transformer.h.15.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
212 |
+
"transformer.h.15.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
213 |
+
"transformer.h.15.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
214 |
+
"transformer.h.15.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
215 |
+
"transformer.h.15.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
216 |
+
"transformer.h.15.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
217 |
+
"transformer.h.15.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
218 |
+
"transformer.h.15.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
219 |
+
"transformer.h.15.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
220 |
+
"transformer.h.15.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
221 |
+
"transformer.h.15.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
222 |
+
"transformer.h.15.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
223 |
+
"transformer.h.16.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
224 |
+
"transformer.h.16.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
225 |
+
"transformer.h.16.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
226 |
+
"transformer.h.16.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
227 |
+
"transformer.h.16.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
228 |
+
"transformer.h.16.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
229 |
+
"transformer.h.16.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
230 |
+
"transformer.h.16.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
231 |
+
"transformer.h.16.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
232 |
+
"transformer.h.16.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
233 |
+
"transformer.h.16.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
234 |
+
"transformer.h.16.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
235 |
+
"transformer.h.16.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
236 |
+
"transformer.h.16.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
237 |
+
"transformer.h.16.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
238 |
+
"transformer.h.16.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
239 |
+
"transformer.h.16.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
240 |
+
"transformer.h.16.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
241 |
+
"transformer.h.16.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
242 |
+
"transformer.h.16.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
243 |
+
"transformer.h.16.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
244 |
+
"transformer.h.16.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
245 |
+
"transformer.h.16.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
246 |
+
"transformer.h.16.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
247 |
+
"transformer.h.16.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
248 |
+
"transformer.h.16.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
249 |
+
"transformer.h.16.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
250 |
+
"transformer.h.17.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
251 |
+
"transformer.h.17.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
252 |
+
"transformer.h.17.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
253 |
+
"transformer.h.17.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
254 |
+
"transformer.h.17.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
255 |
+
"transformer.h.17.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
256 |
+
"transformer.h.17.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
257 |
+
"transformer.h.17.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
258 |
+
"transformer.h.17.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
259 |
+
"transformer.h.17.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
260 |
+
"transformer.h.17.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
261 |
+
"transformer.h.17.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
262 |
+
"transformer.h.17.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
263 |
+
"transformer.h.17.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
264 |
+
"transformer.h.17.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
265 |
+
"transformer.h.17.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
266 |
+
"transformer.h.17.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
267 |
+
"transformer.h.17.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
268 |
+
"transformer.h.17.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
269 |
+
"transformer.h.17.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
270 |
+
"transformer.h.17.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
271 |
+
"transformer.h.17.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
272 |
+
"transformer.h.17.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
273 |
+
"transformer.h.17.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
274 |
+
"transformer.h.17.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
275 |
+
"transformer.h.17.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
276 |
+
"transformer.h.17.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
277 |
+
"transformer.h.18.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
278 |
+
"transformer.h.18.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
279 |
+
"transformer.h.18.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
280 |
+
"transformer.h.18.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
281 |
+
"transformer.h.18.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
282 |
+
"transformer.h.18.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
283 |
+
"transformer.h.18.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
284 |
+
"transformer.h.18.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
285 |
+
"transformer.h.18.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
286 |
+
"transformer.h.18.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
287 |
+
"transformer.h.18.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
288 |
+
"transformer.h.18.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
289 |
+
"transformer.h.18.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
290 |
+
"transformer.h.18.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
291 |
+
"transformer.h.18.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
292 |
+
"transformer.h.18.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
293 |
+
"transformer.h.18.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
294 |
+
"transformer.h.18.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
295 |
+
"transformer.h.18.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
296 |
+
"transformer.h.18.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
297 |
+
"transformer.h.18.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
298 |
+
"transformer.h.18.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
299 |
+
"transformer.h.18.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
300 |
+
"transformer.h.18.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
301 |
+
"transformer.h.18.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
302 |
+
"transformer.h.18.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
303 |
+
"transformer.h.18.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
304 |
+
"transformer.h.19.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
305 |
+
"transformer.h.19.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
306 |
+
"transformer.h.19.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
307 |
+
"transformer.h.19.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
308 |
+
"transformer.h.19.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
309 |
+
"transformer.h.19.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
310 |
+
"transformer.h.19.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
311 |
+
"transformer.h.19.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
312 |
+
"transformer.h.19.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
313 |
+
"transformer.h.19.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
314 |
+
"transformer.h.19.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
315 |
+
"transformer.h.19.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
316 |
+
"transformer.h.19.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
317 |
+
"transformer.h.19.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
318 |
+
"transformer.h.19.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
319 |
+
"transformer.h.19.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
320 |
+
"transformer.h.19.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
321 |
+
"transformer.h.19.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
322 |
+
"transformer.h.19.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
323 |
+
"transformer.h.19.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
324 |
+
"transformer.h.19.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
325 |
+
"transformer.h.19.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
326 |
+
"transformer.h.19.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
327 |
+
"transformer.h.19.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
328 |
+
"transformer.h.19.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
329 |
+
"transformer.h.19.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
330 |
+
"transformer.h.19.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
331 |
+
"transformer.h.2.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
332 |
+
"transformer.h.2.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
333 |
+
"transformer.h.2.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
334 |
+
"transformer.h.2.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
335 |
+
"transformer.h.2.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
336 |
+
"transformer.h.2.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
337 |
+
"transformer.h.2.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
338 |
+
"transformer.h.2.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
339 |
+
"transformer.h.2.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
340 |
+
"transformer.h.2.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
341 |
+
"transformer.h.2.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
342 |
+
"transformer.h.2.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
343 |
+
"transformer.h.2.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
344 |
+
"transformer.h.2.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
345 |
+
"transformer.h.2.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
346 |
+
"transformer.h.2.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
347 |
+
"transformer.h.2.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
348 |
+
"transformer.h.2.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
349 |
+
"transformer.h.2.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
350 |
+
"transformer.h.2.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
351 |
+
"transformer.h.2.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
352 |
+
"transformer.h.2.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
353 |
+
"transformer.h.2.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
354 |
+
"transformer.h.2.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
355 |
+
"transformer.h.2.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
356 |
+
"transformer.h.2.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
357 |
+
"transformer.h.2.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
358 |
+
"transformer.h.20.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
359 |
+
"transformer.h.20.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
360 |
+
"transformer.h.20.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
361 |
+
"transformer.h.20.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
362 |
+
"transformer.h.20.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
363 |
+
"transformer.h.20.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
364 |
+
"transformer.h.20.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
365 |
+
"transformer.h.20.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
366 |
+
"transformer.h.20.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
367 |
+
"transformer.h.20.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
368 |
+
"transformer.h.20.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
369 |
+
"transformer.h.20.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
370 |
+
"transformer.h.20.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
371 |
+
"transformer.h.20.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
372 |
+
"transformer.h.20.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
373 |
+
"transformer.h.20.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
374 |
+
"transformer.h.20.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
375 |
+
"transformer.h.20.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
376 |
+
"transformer.h.20.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
377 |
+
"transformer.h.20.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
378 |
+
"transformer.h.20.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
379 |
+
"transformer.h.20.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
380 |
+
"transformer.h.20.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
381 |
+
"transformer.h.20.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
382 |
+
"transformer.h.20.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
383 |
+
"transformer.h.20.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
384 |
+
"transformer.h.20.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
385 |
+
"transformer.h.21.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
386 |
+
"transformer.h.21.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
387 |
+
"transformer.h.21.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
388 |
+
"transformer.h.21.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
389 |
+
"transformer.h.21.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
390 |
+
"transformer.h.21.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
391 |
+
"transformer.h.21.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
392 |
+
"transformer.h.21.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
393 |
+
"transformer.h.21.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
394 |
+
"transformer.h.21.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
395 |
+
"transformer.h.21.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
396 |
+
"transformer.h.21.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
397 |
+
"transformer.h.21.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
398 |
+
"transformer.h.21.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
399 |
+
"transformer.h.21.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
400 |
+
"transformer.h.21.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
401 |
+
"transformer.h.21.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
402 |
+
"transformer.h.21.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
403 |
+
"transformer.h.21.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
404 |
+
"transformer.h.21.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
405 |
+
"transformer.h.21.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
406 |
+
"transformer.h.21.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
407 |
+
"transformer.h.21.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
408 |
+
"transformer.h.21.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
409 |
+
"transformer.h.21.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
410 |
+
"transformer.h.21.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
411 |
+
"transformer.h.21.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
412 |
+
"transformer.h.22.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
413 |
+
"transformer.h.22.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
414 |
+
"transformer.h.22.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
415 |
+
"transformer.h.22.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
416 |
+
"transformer.h.22.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
417 |
+
"transformer.h.22.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
418 |
+
"transformer.h.22.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
419 |
+
"transformer.h.22.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
420 |
+
"transformer.h.22.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
421 |
+
"transformer.h.22.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
422 |
+
"transformer.h.22.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
423 |
+
"transformer.h.22.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
424 |
+
"transformer.h.22.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
425 |
+
"transformer.h.22.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
426 |
+
"transformer.h.22.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
427 |
+
"transformer.h.22.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
428 |
+
"transformer.h.22.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
429 |
+
"transformer.h.22.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
430 |
+
"transformer.h.22.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
431 |
+
"transformer.h.22.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
432 |
+
"transformer.h.22.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
433 |
+
"transformer.h.22.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
434 |
+
"transformer.h.22.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
435 |
+
"transformer.h.22.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
436 |
+
"transformer.h.22.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
437 |
+
"transformer.h.22.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
438 |
+
"transformer.h.22.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
439 |
+
"transformer.h.23.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
440 |
+
"transformer.h.23.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
441 |
+
"transformer.h.23.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
442 |
+
"transformer.h.23.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
443 |
+
"transformer.h.23.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
444 |
+
"transformer.h.23.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
445 |
+
"transformer.h.23.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
446 |
+
"transformer.h.23.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
447 |
+
"transformer.h.23.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
448 |
+
"transformer.h.23.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
449 |
+
"transformer.h.23.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
450 |
+
"transformer.h.23.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
451 |
+
"transformer.h.23.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
452 |
+
"transformer.h.23.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
453 |
+
"transformer.h.23.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
454 |
+
"transformer.h.23.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
455 |
+
"transformer.h.23.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
456 |
+
"transformer.h.23.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
457 |
+
"transformer.h.23.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
458 |
+
"transformer.h.23.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
459 |
+
"transformer.h.23.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
460 |
+
"transformer.h.23.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
461 |
+
"transformer.h.23.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
462 |
+
"transformer.h.23.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
463 |
+
"transformer.h.23.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
464 |
+
"transformer.h.23.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
465 |
+
"transformer.h.23.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
466 |
+
"transformer.h.24.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
467 |
+
"transformer.h.24.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
468 |
+
"transformer.h.24.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
469 |
+
"transformer.h.24.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
470 |
+
"transformer.h.24.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
471 |
+
"transformer.h.24.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
472 |
+
"transformer.h.24.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
473 |
+
"transformer.h.24.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
474 |
+
"transformer.h.24.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
475 |
+
"transformer.h.24.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
476 |
+
"transformer.h.24.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
477 |
+
"transformer.h.24.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
478 |
+
"transformer.h.24.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
479 |
+
"transformer.h.24.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
480 |
+
"transformer.h.24.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
481 |
+
"transformer.h.24.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
482 |
+
"transformer.h.24.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
483 |
+
"transformer.h.24.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
484 |
+
"transformer.h.24.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
485 |
+
"transformer.h.24.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
486 |
+
"transformer.h.24.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
487 |
+
"transformer.h.24.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
488 |
+
"transformer.h.24.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
489 |
+
"transformer.h.24.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
490 |
+
"transformer.h.24.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
491 |
+
"transformer.h.24.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
492 |
+
"transformer.h.24.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
493 |
+
"transformer.h.25.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
494 |
+
"transformer.h.25.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
495 |
+
"transformer.h.25.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
496 |
+
"transformer.h.25.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
497 |
+
"transformer.h.25.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
498 |
+
"transformer.h.25.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
499 |
+
"transformer.h.25.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
500 |
+
"transformer.h.25.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
501 |
+
"transformer.h.25.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
502 |
+
"transformer.h.25.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
503 |
+
"transformer.h.25.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
504 |
+
"transformer.h.25.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
505 |
+
"transformer.h.25.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
506 |
+
"transformer.h.25.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
507 |
+
"transformer.h.25.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
508 |
+
"transformer.h.25.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
509 |
+
"transformer.h.25.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
510 |
+
"transformer.h.25.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
511 |
+
"transformer.h.25.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
512 |
+
"transformer.h.25.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
513 |
+
"transformer.h.25.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
514 |
+
"transformer.h.25.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
515 |
+
"transformer.h.25.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
516 |
+
"transformer.h.25.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
517 |
+
"transformer.h.25.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
518 |
+
"transformer.h.25.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
519 |
+
"transformer.h.25.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
520 |
+
"transformer.h.26.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
521 |
+
"transformer.h.26.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
522 |
+
"transformer.h.26.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
523 |
+
"transformer.h.26.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
524 |
+
"transformer.h.26.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
525 |
+
"transformer.h.26.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
526 |
+
"transformer.h.26.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
527 |
+
"transformer.h.26.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
528 |
+
"transformer.h.26.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
529 |
+
"transformer.h.26.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
530 |
+
"transformer.h.26.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
531 |
+
"transformer.h.26.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
532 |
+
"transformer.h.26.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
533 |
+
"transformer.h.26.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
534 |
+
"transformer.h.26.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
535 |
+
"transformer.h.26.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
536 |
+
"transformer.h.26.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
537 |
+
"transformer.h.26.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
538 |
+
"transformer.h.26.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
539 |
+
"transformer.h.26.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
540 |
+
"transformer.h.26.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
541 |
+
"transformer.h.26.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
542 |
+
"transformer.h.26.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
543 |
+
"transformer.h.26.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
544 |
+
"transformer.h.26.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
545 |
+
"transformer.h.26.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
546 |
+
"transformer.h.26.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
547 |
+
"transformer.h.27.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
548 |
+
"transformer.h.27.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
549 |
+
"transformer.h.27.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
550 |
+
"transformer.h.27.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
551 |
+
"transformer.h.27.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
552 |
+
"transformer.h.27.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
553 |
+
"transformer.h.27.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
554 |
+
"transformer.h.27.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
555 |
+
"transformer.h.27.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
556 |
+
"transformer.h.27.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
557 |
+
"transformer.h.27.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
558 |
+
"transformer.h.27.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
559 |
+
"transformer.h.27.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
560 |
+
"transformer.h.27.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
561 |
+
"transformer.h.27.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
562 |
+
"transformer.h.27.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
563 |
+
"transformer.h.27.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
564 |
+
"transformer.h.27.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
565 |
+
"transformer.h.27.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
566 |
+
"transformer.h.27.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
567 |
+
"transformer.h.27.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
568 |
+
"transformer.h.27.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
569 |
+
"transformer.h.27.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
570 |
+
"transformer.h.27.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
571 |
+
"transformer.h.27.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
572 |
+
"transformer.h.27.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
573 |
+
"transformer.h.27.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
574 |
+
"transformer.h.28.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
575 |
+
"transformer.h.28.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
576 |
+
"transformer.h.28.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
577 |
+
"transformer.h.28.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
578 |
+
"transformer.h.28.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
579 |
+
"transformer.h.28.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
580 |
+
"transformer.h.28.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
581 |
+
"transformer.h.28.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
582 |
+
"transformer.h.28.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
583 |
+
"transformer.h.28.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
584 |
+
"transformer.h.28.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
585 |
+
"transformer.h.28.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
586 |
+
"transformer.h.28.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
587 |
+
"transformer.h.28.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
588 |
+
"transformer.h.28.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
589 |
+
"transformer.h.28.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
590 |
+
"transformer.h.28.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
591 |
+
"transformer.h.28.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
592 |
+
"transformer.h.28.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
593 |
+
"transformer.h.28.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
594 |
+
"transformer.h.28.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
595 |
+
"transformer.h.28.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
596 |
+
"transformer.h.28.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
597 |
+
"transformer.h.28.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
598 |
+
"transformer.h.28.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
599 |
+
"transformer.h.28.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
600 |
+
"transformer.h.28.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
601 |
+
"transformer.h.29.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
602 |
+
"transformer.h.29.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
603 |
+
"transformer.h.29.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
604 |
+
"transformer.h.29.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
605 |
+
"transformer.h.29.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
606 |
+
"transformer.h.29.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
607 |
+
"transformer.h.29.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
608 |
+
"transformer.h.29.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
609 |
+
"transformer.h.29.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
610 |
+
"transformer.h.29.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
611 |
+
"transformer.h.29.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
612 |
+
"transformer.h.29.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
613 |
+
"transformer.h.29.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
614 |
+
"transformer.h.29.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
615 |
+
"transformer.h.29.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
616 |
+
"transformer.h.29.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
617 |
+
"transformer.h.29.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
618 |
+
"transformer.h.29.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
619 |
+
"transformer.h.29.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
620 |
+
"transformer.h.29.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
621 |
+
"transformer.h.29.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
622 |
+
"transformer.h.29.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
623 |
+
"transformer.h.29.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
624 |
+
"transformer.h.29.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
625 |
+
"transformer.h.29.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
626 |
+
"transformer.h.29.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
627 |
+
"transformer.h.29.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
628 |
+
"transformer.h.3.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
629 |
+
"transformer.h.3.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
630 |
+
"transformer.h.3.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
631 |
+
"transformer.h.3.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
632 |
+
"transformer.h.3.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
633 |
+
"transformer.h.3.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
634 |
+
"transformer.h.3.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
635 |
+
"transformer.h.3.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
636 |
+
"transformer.h.3.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
637 |
+
"transformer.h.3.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
638 |
+
"transformer.h.3.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
639 |
+
"transformer.h.3.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
640 |
+
"transformer.h.3.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
641 |
+
"transformer.h.3.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
642 |
+
"transformer.h.3.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
643 |
+
"transformer.h.3.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
644 |
+
"transformer.h.3.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
645 |
+
"transformer.h.3.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
646 |
+
"transformer.h.3.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
647 |
+
"transformer.h.3.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
648 |
+
"transformer.h.3.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
649 |
+
"transformer.h.3.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
650 |
+
"transformer.h.3.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
651 |
+
"transformer.h.3.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
652 |
+
"transformer.h.3.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
653 |
+
"transformer.h.3.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
654 |
+
"transformer.h.3.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
655 |
+
"transformer.h.30.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
656 |
+
"transformer.h.30.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
657 |
+
"transformer.h.30.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
658 |
+
"transformer.h.30.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
659 |
+
"transformer.h.30.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
660 |
+
"transformer.h.30.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
661 |
+
"transformer.h.30.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
662 |
+
"transformer.h.30.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
663 |
+
"transformer.h.30.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
664 |
+
"transformer.h.30.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
665 |
+
"transformer.h.30.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
666 |
+
"transformer.h.30.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
667 |
+
"transformer.h.30.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
668 |
+
"transformer.h.30.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
669 |
+
"transformer.h.30.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
670 |
+
"transformer.h.30.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
671 |
+
"transformer.h.30.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
672 |
+
"transformer.h.30.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
673 |
+
"transformer.h.30.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
674 |
+
"transformer.h.30.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
675 |
+
"transformer.h.30.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
676 |
+
"transformer.h.30.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
677 |
+
"transformer.h.30.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
678 |
+
"transformer.h.30.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
679 |
+
"transformer.h.30.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
680 |
+
"transformer.h.30.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
681 |
+
"transformer.h.30.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
682 |
+
"transformer.h.31.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
683 |
+
"transformer.h.31.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
684 |
+
"transformer.h.31.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
685 |
+
"transformer.h.31.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
686 |
+
"transformer.h.31.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
687 |
+
"transformer.h.31.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
688 |
+
"transformer.h.31.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
689 |
+
"transformer.h.31.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
690 |
+
"transformer.h.31.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
691 |
+
"transformer.h.31.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
692 |
+
"transformer.h.31.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
693 |
+
"transformer.h.31.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
694 |
+
"transformer.h.31.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
695 |
+
"transformer.h.31.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
696 |
+
"transformer.h.31.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
697 |
+
"transformer.h.31.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
698 |
+
"transformer.h.31.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
699 |
+
"transformer.h.31.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
700 |
+
"transformer.h.31.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
701 |
+
"transformer.h.31.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
702 |
+
"transformer.h.31.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
703 |
+
"transformer.h.31.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
704 |
+
"transformer.h.31.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
705 |
+
"transformer.h.31.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
706 |
+
"transformer.h.31.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
707 |
+
"transformer.h.31.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
708 |
+
"transformer.h.31.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
709 |
+
"transformer.h.4.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
710 |
+
"transformer.h.4.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
711 |
+
"transformer.h.4.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
712 |
+
"transformer.h.4.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
713 |
+
"transformer.h.4.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
714 |
+
"transformer.h.4.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
715 |
+
"transformer.h.4.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
716 |
+
"transformer.h.4.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
717 |
+
"transformer.h.4.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
718 |
+
"transformer.h.4.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
719 |
+
"transformer.h.4.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
720 |
+
"transformer.h.4.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
721 |
+
"transformer.h.4.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
722 |
+
"transformer.h.4.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
723 |
+
"transformer.h.4.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
724 |
+
"transformer.h.4.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
725 |
+
"transformer.h.4.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
726 |
+
"transformer.h.4.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
727 |
+
"transformer.h.4.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
728 |
+
"transformer.h.4.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
729 |
+
"transformer.h.4.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
730 |
+
"transformer.h.4.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
731 |
+
"transformer.h.4.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
732 |
+
"transformer.h.4.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
733 |
+
"transformer.h.4.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
734 |
+
"transformer.h.4.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
735 |
+
"transformer.h.4.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
736 |
+
"transformer.h.5.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
737 |
+
"transformer.h.5.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
738 |
+
"transformer.h.5.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
739 |
+
"transformer.h.5.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
740 |
+
"transformer.h.5.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
741 |
+
"transformer.h.5.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
742 |
+
"transformer.h.5.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
743 |
+
"transformer.h.5.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
744 |
+
"transformer.h.5.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
745 |
+
"transformer.h.5.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
746 |
+
"transformer.h.5.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
747 |
+
"transformer.h.5.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
748 |
+
"transformer.h.5.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
749 |
+
"transformer.h.5.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
750 |
+
"transformer.h.5.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
751 |
+
"transformer.h.5.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
752 |
+
"transformer.h.5.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
753 |
+
"transformer.h.5.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
754 |
+
"transformer.h.5.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
755 |
+
"transformer.h.5.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
756 |
+
"transformer.h.5.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
757 |
+
"transformer.h.5.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
758 |
+
"transformer.h.5.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
759 |
+
"transformer.h.5.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
760 |
+
"transformer.h.5.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
761 |
+
"transformer.h.5.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
762 |
+
"transformer.h.5.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
763 |
+
"transformer.h.6.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
764 |
+
"transformer.h.6.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
765 |
+
"transformer.h.6.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
766 |
+
"transformer.h.6.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
767 |
+
"transformer.h.6.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
768 |
+
"transformer.h.6.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
769 |
+
"transformer.h.6.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
770 |
+
"transformer.h.6.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
771 |
+
"transformer.h.6.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
772 |
+
"transformer.h.6.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
773 |
+
"transformer.h.6.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
774 |
+
"transformer.h.6.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
775 |
+
"transformer.h.6.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
776 |
+
"transformer.h.6.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
777 |
+
"transformer.h.6.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
778 |
+
"transformer.h.6.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
779 |
+
"transformer.h.6.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
780 |
+
"transformer.h.6.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
781 |
+
"transformer.h.6.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
782 |
+
"transformer.h.6.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
783 |
+
"transformer.h.6.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
784 |
+
"transformer.h.6.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
785 |
+
"transformer.h.6.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
786 |
+
"transformer.h.6.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
787 |
+
"transformer.h.6.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
788 |
+
"transformer.h.6.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
789 |
+
"transformer.h.6.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
790 |
+
"transformer.h.7.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
791 |
+
"transformer.h.7.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
792 |
+
"transformer.h.7.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
793 |
+
"transformer.h.7.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
794 |
+
"transformer.h.7.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
795 |
+
"transformer.h.7.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
796 |
+
"transformer.h.7.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
797 |
+
"transformer.h.7.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
798 |
+
"transformer.h.7.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
799 |
+
"transformer.h.7.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
800 |
+
"transformer.h.7.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
801 |
+
"transformer.h.7.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
802 |
+
"transformer.h.7.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
803 |
+
"transformer.h.7.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
804 |
+
"transformer.h.7.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
805 |
+
"transformer.h.7.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
806 |
+
"transformer.h.7.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
807 |
+
"transformer.h.7.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
808 |
+
"transformer.h.7.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
809 |
+
"transformer.h.7.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
810 |
+
"transformer.h.7.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
811 |
+
"transformer.h.7.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
812 |
+
"transformer.h.7.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
813 |
+
"transformer.h.7.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
814 |
+
"transformer.h.7.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
815 |
+
"transformer.h.7.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
816 |
+
"transformer.h.7.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
817 |
+
"transformer.h.8.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
818 |
+
"transformer.h.8.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
819 |
+
"transformer.h.8.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
820 |
+
"transformer.h.8.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
821 |
+
"transformer.h.8.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
822 |
+
"transformer.h.8.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
823 |
+
"transformer.h.8.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
824 |
+
"transformer.h.8.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
825 |
+
"transformer.h.8.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
826 |
+
"transformer.h.8.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
827 |
+
"transformer.h.8.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
828 |
+
"transformer.h.8.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
829 |
+
"transformer.h.8.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
830 |
+
"transformer.h.8.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
831 |
+
"transformer.h.8.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
832 |
+
"transformer.h.8.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
833 |
+
"transformer.h.8.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
834 |
+
"transformer.h.8.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
835 |
+
"transformer.h.8.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
836 |
+
"transformer.h.8.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
837 |
+
"transformer.h.8.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
838 |
+
"transformer.h.8.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
839 |
+
"transformer.h.8.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
840 |
+
"transformer.h.8.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
841 |
+
"transformer.h.8.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
842 |
+
"transformer.h.8.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
843 |
+
"transformer.h.8.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
844 |
+
"transformer.h.9.attn.c_attn.bias": "gptq_model-4bit-128g.safetensors",
|
845 |
+
"transformer.h.9.attn.c_attn.g_idx": "gptq_model-4bit-128g.safetensors",
|
846 |
+
"transformer.h.9.attn.c_attn.qweight": "gptq_model-4bit-128g.safetensors",
|
847 |
+
"transformer.h.9.attn.c_attn.qzeros": "gptq_model-4bit-128g.safetensors",
|
848 |
+
"transformer.h.9.attn.c_attn.scales": "gptq_model-4bit-128g.safetensors",
|
849 |
+
"transformer.h.9.attn.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
850 |
+
"transformer.h.9.attn.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
851 |
+
"transformer.h.9.attn.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
852 |
+
"transformer.h.9.attn.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
853 |
+
"transformer.h.9.attn.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
854 |
+
"transformer.h.9.ln_1.weight": "gptq_model-4bit-128g.safetensors",
|
855 |
+
"transformer.h.9.ln_2.weight": "gptq_model-4bit-128g.safetensors",
|
856 |
+
"transformer.h.9.mlp.c_proj.bias": "gptq_model-4bit-128g.safetensors",
|
857 |
+
"transformer.h.9.mlp.c_proj.g_idx": "gptq_model-4bit-128g.safetensors",
|
858 |
+
"transformer.h.9.mlp.c_proj.qweight": "gptq_model-4bit-128g.safetensors",
|
859 |
+
"transformer.h.9.mlp.c_proj.qzeros": "gptq_model-4bit-128g.safetensors",
|
860 |
+
"transformer.h.9.mlp.c_proj.scales": "gptq_model-4bit-128g.safetensors",
|
861 |
+
"transformer.h.9.mlp.w1.bias": "gptq_model-4bit-128g.safetensors",
|
862 |
+
"transformer.h.9.mlp.w1.g_idx": "gptq_model-4bit-128g.safetensors",
|
863 |
+
"transformer.h.9.mlp.w1.qweight": "gptq_model-4bit-128g.safetensors",
|
864 |
+
"transformer.h.9.mlp.w1.qzeros": "gptq_model-4bit-128g.safetensors",
|
865 |
+
"transformer.h.9.mlp.w1.scales": "gptq_model-4bit-128g.safetensors",
|
866 |
+
"transformer.h.9.mlp.w2.bias": "gptq_model-4bit-128g.safetensors",
|
867 |
+
"transformer.h.9.mlp.w2.g_idx": "gptq_model-4bit-128g.safetensors",
|
868 |
+
"transformer.h.9.mlp.w2.qweight": "gptq_model-4bit-128g.safetensors",
|
869 |
+
"transformer.h.9.mlp.w2.qzeros": "gptq_model-4bit-128g.safetensors",
|
870 |
+
"transformer.h.9.mlp.w2.scales": "gptq_model-4bit-128g.safetensors",
|
871 |
+
"transformer.ln_f.weight": "gptq_model-4bit-128g.safetensors",
|
872 |
+
"transformer.wte.weight": "gptq_model-4bit-128g.safetensors"
|
873 |
+
}
|
874 |
+
}
|
modeling_qwen.py
ADDED
@@ -0,0 +1,1367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
import copy
|
7 |
+
import importlib
|
8 |
+
import math
|
9 |
+
import pathlib
|
10 |
+
from typing import TYPE_CHECKING, Optional, Tuple, Union, Callable, List, Any, Generator
|
11 |
+
|
12 |
+
import torch
|
13 |
+
import torch.nn.functional as F
|
14 |
+
import torch.utils.checkpoint
|
15 |
+
import warnings
|
16 |
+
|
17 |
+
from torch.nn import CrossEntropyLoss
|
18 |
+
from transformers import PreTrainedTokenizer, GenerationConfig, StoppingCriteriaList
|
19 |
+
from transformers.generation.logits_process import LogitsProcessorList
|
20 |
+
|
21 |
+
if TYPE_CHECKING:
|
22 |
+
from transformers.generation.streamers import BaseStreamer
|
23 |
+
from transformers.generation.utils import GenerateOutput
|
24 |
+
from transformers.modeling_outputs import (
|
25 |
+
BaseModelOutputWithPast,
|
26 |
+
CausalLMOutputWithPast,
|
27 |
+
)
|
28 |
+
from transformers.modeling_utils import PreTrainedModel
|
29 |
+
from transformers.utils import logging
|
30 |
+
|
31 |
+
try:
|
32 |
+
from einops import rearrange
|
33 |
+
except ImportError:
|
34 |
+
rearrange = None
|
35 |
+
from torch import nn
|
36 |
+
|
37 |
+
SUPPORT_CUDA = torch.cuda.is_available()
|
38 |
+
SUPPORT_BF16 = SUPPORT_CUDA and torch.cuda.is_bf16_supported()
|
39 |
+
SUPPORT_FP16 = SUPPORT_CUDA and torch.cuda.get_device_capability(0)[0] >= 7
|
40 |
+
SUPPORT_TORCH2 = hasattr(torch, '__version__') and int(torch.__version__.split(".")[0]) >= 2
|
41 |
+
|
42 |
+
|
43 |
+
from .configuration_qwen import QWenConfig
|
44 |
+
from .qwen_generation_utils import (
|
45 |
+
HistoryType,
|
46 |
+
make_context,
|
47 |
+
decode_tokens,
|
48 |
+
get_stop_words_ids,
|
49 |
+
StopWordsLogitsProcessor,
|
50 |
+
)
|
51 |
+
|
52 |
+
|
53 |
+
logger = logging.get_logger(__name__)
|
54 |
+
|
55 |
+
_CHECKPOINT_FOR_DOC = "qwen"
|
56 |
+
_CONFIG_FOR_DOC = "QWenConfig"
|
57 |
+
|
58 |
+
QWen_PRETRAINED_MODEL_ARCHIVE_LIST = ["qwen-7b"]
|
59 |
+
|
60 |
+
_ERROR_BAD_CHAT_FORMAT = """\
|
61 |
+
We detect you are probably using the pretrained model (rather than chat model) for chatting, since the chat_format in generation_config is not "chatml".
|
62 |
+
If you are directly using the model downloaded from Huggingface, please make sure you are using our "Qwen/Qwen-7B-Chat" Huggingface model (rather than "Qwen/Qwen-7B") when you call model.chat().
|
63 |
+
我们检测到您可能在使用预训练模型(而非chat模型)进行多轮chat,因为您当前在generation_config指定的chat_format,并未设置为我们在对话中所支持的"chatml"格式。
|
64 |
+
如果您在直接使用我们从Huggingface提供的模型,请确保您在调用model.chat()时,使用的是"Qwen/Qwen-7B-Chat"模型(而非"Qwen/Qwen-7B"预训练模型)。
|
65 |
+
"""
|
66 |
+
|
67 |
+
_SENTINEL = object()
|
68 |
+
_ERROR_STREAM_IN_CHAT = """\
|
69 |
+
Pass argument `stream` to model.chat() is buggy, deprecated, and marked for removal. Please use model.chat_stream(...) instead of model.chat(..., stream=True).
|
70 |
+
向model.chat()传入参数stream的用法可能存在Bug,该用法已被废弃,将在未来被移除。请使用model.chat_stream(...)代替model.chat(..., stream=True)。
|
71 |
+
"""
|
72 |
+
|
73 |
+
_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED = """\
|
74 |
+
We detect you have activated flash attention support, but running model computation on CPU. Please make sure that your input data has been placed on GPU. If you actually want to run CPU computation, please following the readme and set device_map="cpu" to disable flash attention when loading the model (calling AutoModelForCausalLM.from_pretrained).
|
75 |
+
检测到您的模型已激活了flash attention支持,但正在执行CPU运算任务。如使用flash attention,请您确认模型输入已经传到GPU上。如果您确认要执行CPU运算,请您在载入模型(调用AutoModelForCausalLM.from_pretrained)时,按照readme说法,指定device_map="cpu"以禁用flash attention。
|
76 |
+
"""
|
77 |
+
|
78 |
+
apply_rotary_emb_func = None
|
79 |
+
rms_norm = None
|
80 |
+
flash_attn_unpadded_func = None
|
81 |
+
flash_attn_func = None
|
82 |
+
|
83 |
+
def _import_flash_attn():
|
84 |
+
global apply_rotary_emb_func, rms_norm, flash_attn_unpadded_func, flash_attn_func
|
85 |
+
try:
|
86 |
+
from flash_attn.layers.rotary import apply_rotary_emb_func as __apply_rotary_emb_func
|
87 |
+
apply_rotary_emb_func = __apply_rotary_emb_func
|
88 |
+
except ImportError:
|
89 |
+
logger.warn(
|
90 |
+
"Warning: import flash_attn rotary fail, please install FlashAttention rotary to get higher efficiency "
|
91 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/rotary"
|
92 |
+
)
|
93 |
+
|
94 |
+
try:
|
95 |
+
from flash_attn.ops.rms_norm import rms_norm as __rms_norm
|
96 |
+
rms_norm = __rms_norm
|
97 |
+
except ImportError:
|
98 |
+
logger.warn(
|
99 |
+
"Warning: import flash_attn rms_norm fail, please install FlashAttention layer_norm to get higher efficiency "
|
100 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/layer_norm"
|
101 |
+
)
|
102 |
+
|
103 |
+
try:
|
104 |
+
import flash_attn
|
105 |
+
_flash_attn_func = None
|
106 |
+
if not hasattr(flash_attn, '__version__'):
|
107 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
108 |
+
else:
|
109 |
+
if int(flash_attn.__version__.split(".")[0]) >= 2:
|
110 |
+
if int(flash_attn.__version__.split(".")[1]) >= 1:
|
111 |
+
from flash_attn.flash_attn_interface import flash_attn_func as _flash_attn_func
|
112 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func as __flash_attn_unpadded_func
|
113 |
+
else:
|
114 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
115 |
+
flash_attn_unpadded_func = __flash_attn_unpadded_func
|
116 |
+
flash_attn_func = _flash_attn_func
|
117 |
+
except ImportError:
|
118 |
+
logger.warn(
|
119 |
+
"Warning: import flash_attn fail, please install FlashAttention to get higher efficiency "
|
120 |
+
"https://github.com/Dao-AILab/flash-attention"
|
121 |
+
)
|
122 |
+
|
123 |
+
def quantize_cache_v(fdata, bits, qmax, qmin):
|
124 |
+
# b, s, head, h-dim->b, head, s, h-dim
|
125 |
+
qtype = torch.uint8
|
126 |
+
device = fdata.device
|
127 |
+
shape = fdata.shape
|
128 |
+
|
129 |
+
fdata_cal = torch.flatten(fdata, 2)
|
130 |
+
fmax = torch.amax(fdata_cal, dim=-1, keepdim=True)
|
131 |
+
fmin = torch.amin(fdata_cal, dim=-1, keepdim=True)
|
132 |
+
# Compute params
|
133 |
+
if qmax.device != fmax.device:
|
134 |
+
qmax = qmax.to(device)
|
135 |
+
qmin = qmin.to(device)
|
136 |
+
scale = (fmax - fmin) / (qmax - qmin)
|
137 |
+
zero = qmin - fmin / scale
|
138 |
+
scale = scale.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
139 |
+
zero = zero.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
140 |
+
# Quantize
|
141 |
+
res_data = fdata / scale + zero
|
142 |
+
qdata = torch.clamp(res_data, qmin, qmax).to(qtype)
|
143 |
+
return qdata.contiguous(), scale, zero
|
144 |
+
|
145 |
+
def dequantize_cache_torch(qdata, scale, zero):
|
146 |
+
data = scale * (qdata - zero)
|
147 |
+
return data
|
148 |
+
|
149 |
+
class FlashSelfAttention(torch.nn.Module):
|
150 |
+
def __init__(
|
151 |
+
self,
|
152 |
+
causal=False,
|
153 |
+
softmax_scale=None,
|
154 |
+
attention_dropout=0.0,
|
155 |
+
):
|
156 |
+
super().__init__()
|
157 |
+
assert flash_attn_unpadded_func is not None, (
|
158 |
+
"Please install FlashAttention first, " "e.g., with pip install flash-attn"
|
159 |
+
)
|
160 |
+
assert (
|
161 |
+
rearrange is not None
|
162 |
+
), "Please install einops first, e.g., with pip install einops"
|
163 |
+
self.causal = causal
|
164 |
+
self.softmax_scale = softmax_scale
|
165 |
+
self.dropout_p = attention_dropout
|
166 |
+
|
167 |
+
def unpad_input(self, hidden_states, attention_mask):
|
168 |
+
valid_mask = attention_mask.squeeze(1).squeeze(1).eq(0)
|
169 |
+
seqlens_in_batch = valid_mask.sum(dim=-1, dtype=torch.int32)
|
170 |
+
indices = torch.nonzero(valid_mask.flatten(), as_tuple=False).flatten()
|
171 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
172 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
|
173 |
+
hidden_states = hidden_states[indices]
|
174 |
+
return hidden_states, indices, cu_seqlens, max_seqlen_in_batch
|
175 |
+
|
176 |
+
def pad_input(self, hidden_states, indices, batch, seqlen):
|
177 |
+
output = torch.zeros(batch * seqlen, *hidden_states.shape[1:], device=hidden_states.device,
|
178 |
+
dtype=hidden_states.dtype)
|
179 |
+
output[indices] = hidden_states
|
180 |
+
return rearrange(output, '(b s) ... -> b s ...', b=batch)
|
181 |
+
|
182 |
+
def forward(self, q, k, v, attention_mask=None):
|
183 |
+
assert all((i.dtype in [torch.float16, torch.bfloat16] for i in (q, k, v)))
|
184 |
+
assert all((i.is_cuda for i in (q, k, v)))
|
185 |
+
batch_size, seqlen_q = q.shape[0], q.shape[1]
|
186 |
+
seqlen_k = k.shape[1]
|
187 |
+
seqlen_out = seqlen_q
|
188 |
+
|
189 |
+
if flash_attn_func is not None and batch_size == 1:
|
190 |
+
dropout_p = self.dropout_p if self.training else 0
|
191 |
+
output = flash_attn_func(q, k, v, dropout_p, softmax_scale=self.softmax_scale, causal=self.causal)
|
192 |
+
return output
|
193 |
+
|
194 |
+
q, k, v = [rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v]]
|
195 |
+
cu_seqlens_q = torch.arange(
|
196 |
+
0,
|
197 |
+
(batch_size + 1) * seqlen_q,
|
198 |
+
step=seqlen_q,
|
199 |
+
dtype=torch.int32,
|
200 |
+
device=q.device,
|
201 |
+
)
|
202 |
+
|
203 |
+
if batch_size > 1 and attention_mask is not None:
|
204 |
+
k, indices_k, cu_seqlens_k, seqlen_k = self.unpad_input(k, attention_mask)
|
205 |
+
if q.size(0) == v.size(0):
|
206 |
+
q = q[indices_k]
|
207 |
+
cu_seqlens_q = cu_seqlens_k
|
208 |
+
seqlen_q = seqlen_k
|
209 |
+
v = v[indices_k]
|
210 |
+
else:
|
211 |
+
cu_seqlens_k = torch.arange(
|
212 |
+
0,
|
213 |
+
(batch_size + 1) * seqlen_k,
|
214 |
+
step=seqlen_k,
|
215 |
+
dtype=torch.int32,
|
216 |
+
device=q.device,
|
217 |
+
)
|
218 |
+
|
219 |
+
if self.training:
|
220 |
+
assert seqlen_k == seqlen_q
|
221 |
+
is_causal = self.causal
|
222 |
+
dropout_p = self.dropout_p
|
223 |
+
else:
|
224 |
+
is_causal = seqlen_q == seqlen_k
|
225 |
+
dropout_p = 0
|
226 |
+
|
227 |
+
output = flash_attn_unpadded_func(
|
228 |
+
q,
|
229 |
+
k,
|
230 |
+
v,
|
231 |
+
cu_seqlens_q,
|
232 |
+
cu_seqlens_k,
|
233 |
+
seqlen_q,
|
234 |
+
seqlen_k,
|
235 |
+
dropout_p,
|
236 |
+
softmax_scale=self.softmax_scale,
|
237 |
+
causal=is_causal,
|
238 |
+
)
|
239 |
+
if batch_size > 1 and attention_mask is not None and seqlen_q == seqlen_k:
|
240 |
+
output = self.pad_input(output, indices_k, batch_size, seqlen_out)
|
241 |
+
else:
|
242 |
+
new_shape = (batch_size, output.shape[0] // batch_size) + output.shape[1:]
|
243 |
+
output = output.view(new_shape)
|
244 |
+
return output
|
245 |
+
|
246 |
+
|
247 |
+
class QWenAttention(nn.Module):
|
248 |
+
def __init__(self, config):
|
249 |
+
super().__init__()
|
250 |
+
|
251 |
+
self.register_buffer("masked_bias", torch.tensor(-1e4), persistent=False)
|
252 |
+
self.seq_length = config.seq_length
|
253 |
+
|
254 |
+
self.hidden_size = config.hidden_size
|
255 |
+
self.split_size = config.hidden_size
|
256 |
+
self.num_heads = config.num_attention_heads
|
257 |
+
self.head_dim = self.hidden_size // self.num_heads
|
258 |
+
|
259 |
+
self.use_flash_attn = config.use_flash_attn
|
260 |
+
self.scale_attn_weights = True
|
261 |
+
|
262 |
+
self.projection_size = config.kv_channels * config.num_attention_heads
|
263 |
+
|
264 |
+
assert self.projection_size % config.num_attention_heads == 0
|
265 |
+
self.hidden_size_per_attention_head = (
|
266 |
+
self.projection_size // config.num_attention_heads
|
267 |
+
)
|
268 |
+
|
269 |
+
self.c_attn = nn.Linear(config.hidden_size, 3 * self.projection_size)
|
270 |
+
|
271 |
+
self.c_proj = nn.Linear(
|
272 |
+
config.hidden_size, self.projection_size, bias=not config.no_bias
|
273 |
+
)
|
274 |
+
|
275 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
276 |
+
if (
|
277 |
+
self.use_flash_attn
|
278 |
+
and flash_attn_unpadded_func is not None
|
279 |
+
and not self.is_fp32
|
280 |
+
):
|
281 |
+
self.core_attention_flash = FlashSelfAttention(
|
282 |
+
causal=True, attention_dropout=config.attn_dropout_prob
|
283 |
+
)
|
284 |
+
self.bf16 = config.bf16
|
285 |
+
|
286 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
287 |
+
self.use_logn_attn = config.use_logn_attn
|
288 |
+
|
289 |
+
logn_list = [
|
290 |
+
math.log(i, self.seq_length) if i > self.seq_length else 1
|
291 |
+
for i in range(1, 32768)
|
292 |
+
]
|
293 |
+
logn_tensor = torch.tensor(logn_list)[None, :, None, None]
|
294 |
+
self.register_buffer("logn_tensor", logn_tensor, persistent=False)
|
295 |
+
|
296 |
+
self.attn_dropout = nn.Dropout(config.attn_dropout_prob)
|
297 |
+
self.softmax_in_fp32 = config.softmax_in_fp32 if hasattr(config, 'softmax_in_fp32') else False
|
298 |
+
self.use_cache_quantization = config.use_cache_quantization if hasattr(config, 'use_cache_quantization') else False
|
299 |
+
self.use_cache_kernel = config.use_cache_kernel if hasattr(config,'use_cache_kernel') else False
|
300 |
+
cache_dtype = torch.float
|
301 |
+
if self.bf16:
|
302 |
+
cache_dtype=torch.bfloat16
|
303 |
+
elif config.fp16:
|
304 |
+
cache_dtype = torch.float16
|
305 |
+
self.cache_qmax = torch.tensor(torch.iinfo(torch.uint8).max, dtype=cache_dtype)
|
306 |
+
self.cache_qmin = torch.tensor(torch.iinfo(torch.uint8).min, dtype=cache_dtype)
|
307 |
+
|
308 |
+
if config.use_cache_quantization and config.use_cache_kernel:
|
309 |
+
# pre check if the support files existing
|
310 |
+
module_root = pathlib.Path(__file__).parent
|
311 |
+
src_files = ("cache_autogptq_cuda_256.cpp", "cache_autogptq_cuda_kernel_256.cu")
|
312 |
+
if any(not (module_root/src).is_file() for src in src_files):
|
313 |
+
warnings.warn("KV cache kernel source files (.cpp and .cu) not found.")
|
314 |
+
self.cache_kernels = None
|
315 |
+
else:
|
316 |
+
try:
|
317 |
+
from .cpp_kernels import cache_autogptq_cuda_256
|
318 |
+
self.cache_kernels = cache_autogptq_cuda_256
|
319 |
+
except ImportError:
|
320 |
+
warnings.warn("Failed to import KV cache kernels.")
|
321 |
+
self.cache_kernels = None
|
322 |
+
|
323 |
+
def _attn(self, query, key, value, causal_mask=None, attention_mask=None, head_mask=None):
|
324 |
+
device = query.device
|
325 |
+
if self.use_cache_quantization:
|
326 |
+
qk, qk_scale, qk_zero = key
|
327 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
328 |
+
shape = query.shape[:-1] + (qk.shape[-2],)
|
329 |
+
attn_weights = torch.zeros(shape, dtype=torch.float16, device=device)
|
330 |
+
self.cache_kernels.vecquant8matmul_batched_faster_old(
|
331 |
+
query.contiguous() if query.dtype == torch.float16 else query.to(torch.float16).contiguous(),
|
332 |
+
qk.transpose(-1, -2).contiguous(),
|
333 |
+
attn_weights,
|
334 |
+
qk_scale.contiguous() if qk_scale.dtype == torch.float16 else qk_scale.to(torch.float16).contiguous(),
|
335 |
+
qk_zero.contiguous()if qk_zero.dtype == torch.float16 else qk_zero.to(torch.float16).contiguous())
|
336 |
+
# attn_weights = attn_weights.to(query.dtype).contiguous()
|
337 |
+
else:
|
338 |
+
key = dequantize_cache_torch(qk, qk_scale, qk_zero)
|
339 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
340 |
+
else:
|
341 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
342 |
+
|
343 |
+
if self.scale_attn_weights:
|
344 |
+
if self.use_cache_quantization:
|
345 |
+
size_temp = value[0].size(-1)
|
346 |
+
else:
|
347 |
+
size_temp = value.size(-1)
|
348 |
+
attn_weights = attn_weights / (size_temp ** 0.5)
|
349 |
+
|
350 |
+
mask_value = torch.finfo(attn_weights.dtype).min
|
351 |
+
if causal_mask is not None:
|
352 |
+
attn_weights = torch.where(
|
353 |
+
causal_mask, attn_weights.to(attn_weights.dtype), mask_value
|
354 |
+
)
|
355 |
+
|
356 |
+
if attention_mask is not None:
|
357 |
+
attn_weights = attn_weights + attention_mask
|
358 |
+
|
359 |
+
if self.softmax_in_fp32:
|
360 |
+
attn_weights = nn.functional.softmax(attn_weights.float(), dim=-1)
|
361 |
+
else:
|
362 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1)
|
363 |
+
|
364 |
+
attn_weights = attn_weights.type(query.dtype)
|
365 |
+
attn_weights = self.attn_dropout(attn_weights)
|
366 |
+
|
367 |
+
if head_mask is not None:
|
368 |
+
attn_weights = attn_weights * head_mask
|
369 |
+
|
370 |
+
if self.use_cache_quantization:
|
371 |
+
qv, qv_scale, qv_zero = value
|
372 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
373 |
+
shape = attn_weights.shape[:-1] + (query.shape[-1],)
|
374 |
+
attn_output = torch.zeros(shape, dtype=torch.float16, device=device)
|
375 |
+
self.cache_kernels.vecquant8matmul_batched_column_compression_faster_old(
|
376 |
+
attn_weights.contiguous() if attn_weights.dtype == torch.float16 else attn_weights.to(torch.float16).contiguous(),
|
377 |
+
qv.contiguous(), # dtype: int32
|
378 |
+
attn_output,
|
379 |
+
qv_scale.contiguous() if qv_scale.dtype == torch.float16 else qv_scale.to(torch.float16).contiguous(),
|
380 |
+
qv_zero.contiguous() if qv_zero.dtype == torch.float16 else qv_zero.to(torch.float16).contiguous())
|
381 |
+
if attn_output.dtype != query.dtype:
|
382 |
+
attn_output = attn_output.to(query.dtype)
|
383 |
+
attn_weights = attn_weights.to(query.dtype)
|
384 |
+
else:
|
385 |
+
value = dequantize_cache_torch(qv, qv_scale, qv_zero)
|
386 |
+
attn_output = torch.matmul(attn_weights, value)
|
387 |
+
else:
|
388 |
+
attn_output = torch.matmul(attn_weights, value)
|
389 |
+
|
390 |
+
attn_output = attn_output.transpose(1, 2)
|
391 |
+
|
392 |
+
return attn_output, attn_weights
|
393 |
+
|
394 |
+
def _split_heads(self, tensor, num_heads, attn_head_size):
|
395 |
+
new_shape = tensor.size()[:-1] + (num_heads, attn_head_size)
|
396 |
+
tensor = tensor.view(new_shape)
|
397 |
+
return tensor
|
398 |
+
|
399 |
+
def _merge_heads(self, tensor, num_heads, attn_head_size):
|
400 |
+
tensor = tensor.contiguous()
|
401 |
+
new_shape = tensor.size()[:-2] + (num_heads * attn_head_size,)
|
402 |
+
return tensor.view(new_shape)
|
403 |
+
|
404 |
+
def forward(
|
405 |
+
self,
|
406 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
407 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
408 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
409 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
410 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
411 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
412 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
413 |
+
output_attentions: Optional[bool] = False,
|
414 |
+
use_cache: Optional[bool] = False,
|
415 |
+
):
|
416 |
+
mixed_x_layer = self.c_attn(hidden_states)
|
417 |
+
|
418 |
+
query, key, value = mixed_x_layer.split(self.split_size, dim=2)
|
419 |
+
|
420 |
+
query = self._split_heads(query, self.num_heads, self.head_dim)
|
421 |
+
key = self._split_heads(key, self.num_heads, self.head_dim)
|
422 |
+
value = self._split_heads(value, self.num_heads, self.head_dim)
|
423 |
+
|
424 |
+
if rotary_pos_emb_list is not None:
|
425 |
+
cur_len = query.shape[1]
|
426 |
+
if len(rotary_pos_emb_list) == 1:
|
427 |
+
rotary_pos_emb = rotary_pos_emb_list[0]
|
428 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
429 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
430 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
431 |
+
# Slice the pos emb for current inference
|
432 |
+
query = apply_rotary_pos_emb(query, q_pos_emb)
|
433 |
+
key = apply_rotary_pos_emb(key, k_pos_emb)
|
434 |
+
else:
|
435 |
+
query_list = []
|
436 |
+
key_list = []
|
437 |
+
for i, rotary_pos_emb in enumerate(rotary_pos_emb_list):
|
438 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
439 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
440 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
441 |
+
# Slice the pos emb for current inference
|
442 |
+
query_list += [apply_rotary_pos_emb(query[i:i+1, :, :], q_pos_emb)]
|
443 |
+
key_list += [apply_rotary_pos_emb(key[i:i+1, :, :], k_pos_emb)]
|
444 |
+
query = torch.cat(query_list, dim=0)
|
445 |
+
key = torch.cat(key_list, dim=0)
|
446 |
+
|
447 |
+
if self.use_cache_quantization:
|
448 |
+
key = quantize_cache_v(key.permute(0, 2, 1, 3),
|
449 |
+
bits=8,
|
450 |
+
qmin=self.cache_qmin,
|
451 |
+
qmax=self.cache_qmax)
|
452 |
+
value = quantize_cache_v(value.permute(0, 2, 1, 3),
|
453 |
+
bits=8,
|
454 |
+
qmin=self.cache_qmin,
|
455 |
+
qmax=self.cache_qmax)
|
456 |
+
|
457 |
+
|
458 |
+
if layer_past is not None:
|
459 |
+
past_key, past_value = layer_past[0], layer_past[1]
|
460 |
+
if self.use_cache_quantization:
|
461 |
+
# use_cache_quantization:
|
462 |
+
# present=((q_key,key_scale,key_zero_point),
|
463 |
+
# (q_value,value_scale,value_zero_point))
|
464 |
+
key = (torch.cat((past_key[0], key[0]), dim=2),
|
465 |
+
torch.cat((past_key[1], key[1]), dim=2),
|
466 |
+
torch.cat((past_key[2], key[2]), dim=2))
|
467 |
+
value = (torch.cat((past_value[0], value[0]), dim=2),
|
468 |
+
torch.cat((past_value[1], value[1]), dim=2),
|
469 |
+
torch.cat((past_value[2], value[2]), dim=2))
|
470 |
+
else:
|
471 |
+
# not use_cache_quantization:
|
472 |
+
# present=(key,value)
|
473 |
+
key = torch.cat((past_key, key), dim=1)
|
474 |
+
value = torch.cat((past_value, value), dim=1)
|
475 |
+
|
476 |
+
if use_cache:
|
477 |
+
present = (key, value)
|
478 |
+
else:
|
479 |
+
present = None
|
480 |
+
|
481 |
+
key_size = key[0].size(2) if self.use_cache_quantization else key.size(1)
|
482 |
+
if key_size > self.seq_length and self.use_logn_attn and not self.training:
|
483 |
+
if self.use_cache_quantization:
|
484 |
+
seq_start = key[0].size(2) - query.size(1)
|
485 |
+
seq_end = key[0].size(2)
|
486 |
+
else:
|
487 |
+
seq_start = key.size(1) - query.size(1)
|
488 |
+
seq_end = key.size(1)
|
489 |
+
logn_tensor = self.logn_tensor[:, seq_start:seq_end, :, :].type_as(query)
|
490 |
+
query = query * logn_tensor.expand_as(query)
|
491 |
+
|
492 |
+
if (
|
493 |
+
self.use_flash_attn
|
494 |
+
and flash_attn_unpadded_func is not None
|
495 |
+
and not self.is_fp32
|
496 |
+
and query.is_cuda
|
497 |
+
):
|
498 |
+
q, k, v = query, key, value
|
499 |
+
attn_output = self.core_attention_flash(q, k, v, attention_mask=attention_mask)
|
500 |
+
else:
|
501 |
+
key_size = key[0].size(2) if self.use_cache_quantization else key.size(1)
|
502 |
+
if query.size(1) == key_size:
|
503 |
+
causal_mask = torch.tril(
|
504 |
+
torch.ones((key_size, key_size), dtype=torch.bool, device=query.device)
|
505 |
+
).view(1, 1, key_size, key_size)
|
506 |
+
else:
|
507 |
+
causal_mask = None
|
508 |
+
query = query.permute(0, 2, 1, 3)
|
509 |
+
if not self.use_cache_quantization:
|
510 |
+
key = key.permute(0, 2, 1, 3)
|
511 |
+
value = value.permute(0, 2, 1, 3)
|
512 |
+
if (
|
513 |
+
causal_mask is None
|
514 |
+
and self.use_flash_attn
|
515 |
+
and flash_attn_unpadded_func is not None
|
516 |
+
and not self.is_fp32
|
517 |
+
and not query.is_cuda
|
518 |
+
):
|
519 |
+
raise Exception(_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED)
|
520 |
+
|
521 |
+
if not self.use_cache_quantization and SUPPORT_TORCH2:
|
522 |
+
if attention_mask is not None:
|
523 |
+
attention_mask = attention_mask.expand(-1, -1, query.size(2), -1)
|
524 |
+
if causal_mask is not None:
|
525 |
+
attention_mask = attention_mask.masked_fill(~causal_mask, torch.finfo(query.dtype).min)
|
526 |
+
else:
|
527 |
+
attention_mask = causal_mask
|
528 |
+
attn_output = F.scaled_dot_product_attention(
|
529 |
+
query, key, value, attn_mask=attention_mask
|
530 |
+
).transpose(1, 2)
|
531 |
+
attn_weight = None
|
532 |
+
else:
|
533 |
+
attn_output, attn_weight = self._attn(
|
534 |
+
query, key, value, causal_mask, attention_mask, head_mask
|
535 |
+
)
|
536 |
+
context_layer = self._merge_heads(
|
537 |
+
attn_output, self.num_heads, self.head_dim
|
538 |
+
)
|
539 |
+
|
540 |
+
attn_output = self.c_proj(context_layer)
|
541 |
+
|
542 |
+
outputs = (attn_output, present)
|
543 |
+
if output_attentions:
|
544 |
+
if (
|
545 |
+
self.use_flash_attn
|
546 |
+
and flash_attn_unpadded_func is not None
|
547 |
+
and not self.is_fp32
|
548 |
+
):
|
549 |
+
raise ValueError("Cannot output attentions while using flash-attn")
|
550 |
+
elif not self.use_cache_quantization and SUPPORT_TORCH2:
|
551 |
+
raise ValueError("Cannot output attentions while using scaled_dot_product_attention")
|
552 |
+
else:
|
553 |
+
outputs += (attn_weight,)
|
554 |
+
|
555 |
+
return outputs
|
556 |
+
|
557 |
+
|
558 |
+
class QWenMLP(nn.Module):
|
559 |
+
def __init__(self, config):
|
560 |
+
super().__init__()
|
561 |
+
self.w1 = nn.Linear(
|
562 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
563 |
+
)
|
564 |
+
self.w2 = nn.Linear(
|
565 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
566 |
+
)
|
567 |
+
ff_dim_in = config.intermediate_size // 2
|
568 |
+
self.c_proj = nn.Linear(ff_dim_in, config.hidden_size, bias=not config.no_bias)
|
569 |
+
|
570 |
+
def forward(self, hidden_states):
|
571 |
+
a1 = self.w1(hidden_states)
|
572 |
+
a2 = self.w2(hidden_states)
|
573 |
+
intermediate_parallel = a1 * F.silu(a2)
|
574 |
+
output = self.c_proj(intermediate_parallel)
|
575 |
+
return output
|
576 |
+
|
577 |
+
|
578 |
+
class QWenBlock(nn.Module):
|
579 |
+
def __init__(self, config):
|
580 |
+
super().__init__()
|
581 |
+
hidden_size = config.hidden_size
|
582 |
+
self.bf16 = config.bf16
|
583 |
+
|
584 |
+
self.ln_1 = RMSNorm(
|
585 |
+
hidden_size,
|
586 |
+
eps=config.layer_norm_epsilon,
|
587 |
+
)
|
588 |
+
self.attn = QWenAttention(config)
|
589 |
+
self.ln_2 = RMSNorm(
|
590 |
+
hidden_size,
|
591 |
+
eps=config.layer_norm_epsilon,
|
592 |
+
)
|
593 |
+
|
594 |
+
self.mlp = QWenMLP(config)
|
595 |
+
|
596 |
+
def forward(
|
597 |
+
self,
|
598 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
599 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
600 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
601 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
602 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
603 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
604 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
605 |
+
use_cache: Optional[bool] = False,
|
606 |
+
output_attentions: Optional[bool] = False,
|
607 |
+
):
|
608 |
+
layernorm_output = self.ln_1(hidden_states)
|
609 |
+
|
610 |
+
attn_outputs = self.attn(
|
611 |
+
layernorm_output,
|
612 |
+
rotary_pos_emb_list,
|
613 |
+
layer_past=layer_past,
|
614 |
+
attention_mask=attention_mask,
|
615 |
+
head_mask=head_mask,
|
616 |
+
use_cache=use_cache,
|
617 |
+
output_attentions=output_attentions,
|
618 |
+
)
|
619 |
+
attn_output = attn_outputs[0]
|
620 |
+
|
621 |
+
outputs = attn_outputs[1:]
|
622 |
+
|
623 |
+
residual = hidden_states
|
624 |
+
layernorm_input = attn_output + residual
|
625 |
+
|
626 |
+
layernorm_output = self.ln_2(layernorm_input)
|
627 |
+
|
628 |
+
residual = layernorm_input
|
629 |
+
mlp_output = self.mlp(layernorm_output)
|
630 |
+
hidden_states = residual + mlp_output
|
631 |
+
|
632 |
+
if use_cache:
|
633 |
+
outputs = (hidden_states,) + outputs
|
634 |
+
else:
|
635 |
+
outputs = (hidden_states,) + outputs[1:]
|
636 |
+
|
637 |
+
return outputs
|
638 |
+
|
639 |
+
|
640 |
+
class QWenPreTrainedModel(PreTrainedModel):
|
641 |
+
config_class = QWenConfig
|
642 |
+
base_model_prefix = "transformer"
|
643 |
+
is_parallelizable = False
|
644 |
+
supports_gradient_checkpointing = True
|
645 |
+
_no_split_modules = ["QWenBlock"]
|
646 |
+
_skip_keys_device_placement = "past_key_values"
|
647 |
+
|
648 |
+
def __init__(self, *inputs, **kwargs):
|
649 |
+
super().__init__(*inputs, **kwargs)
|
650 |
+
|
651 |
+
def _init_weights(self, module):
|
652 |
+
"""Initialize the weights."""
|
653 |
+
if isinstance(module, nn.Linear):
|
654 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
655 |
+
if module.bias is not None:
|
656 |
+
module.bias.data.zero_()
|
657 |
+
elif isinstance(module, nn.Embedding):
|
658 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
659 |
+
if module.padding_idx is not None:
|
660 |
+
module.weight.data[module.padding_idx].zero_()
|
661 |
+
elif isinstance(module, RMSNorm):
|
662 |
+
module.weight.data.fill_(1.0)
|
663 |
+
|
664 |
+
for name, p in module.named_parameters():
|
665 |
+
if name == "c_proj.weight":
|
666 |
+
p.data.normal_(
|
667 |
+
mean=0.0,
|
668 |
+
std=(
|
669 |
+
self.config.initializer_range
|
670 |
+
/ math.sqrt(2 * self.config.num_hidden_layers)
|
671 |
+
),
|
672 |
+
)
|
673 |
+
|
674 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
675 |
+
if isinstance(module, QWenModel):
|
676 |
+
module.gradient_checkpointing = value
|
677 |
+
|
678 |
+
|
679 |
+
class QWenModel(QWenPreTrainedModel):
|
680 |
+
_keys_to_ignore_on_load_missing = ["attn.masked_bias"]
|
681 |
+
|
682 |
+
def __init__(self, config):
|
683 |
+
super().__init__(config)
|
684 |
+
self.vocab_size = config.vocab_size
|
685 |
+
self.num_hidden_layers = config.num_hidden_layers
|
686 |
+
self.embed_dim = config.hidden_size
|
687 |
+
self.use_cache_quantization = self.config.use_cache_quantization if hasattr(self.config, 'use_cache_quantization') else False
|
688 |
+
|
689 |
+
self.gradient_checkpointing = False
|
690 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
691 |
+
self.seq_length = config.seq_length
|
692 |
+
|
693 |
+
self.wte = nn.Embedding(self.vocab_size, self.embed_dim)
|
694 |
+
|
695 |
+
self.drop = nn.Dropout(config.emb_dropout_prob)
|
696 |
+
|
697 |
+
if config.rotary_pct == 1.0:
|
698 |
+
self.rotary_ndims = None
|
699 |
+
else:
|
700 |
+
assert config.rotary_pct < 1
|
701 |
+
self.rotary_ndims = int(
|
702 |
+
config.kv_channels * config.rotary_pct
|
703 |
+
)
|
704 |
+
dim = (
|
705 |
+
self.rotary_ndims
|
706 |
+
if self.rotary_ndims is not None
|
707 |
+
else config.kv_channels
|
708 |
+
)
|
709 |
+
self.rotary_emb = RotaryEmbedding(dim, base=config.rotary_emb_base)
|
710 |
+
|
711 |
+
self.use_flash_attn = config.use_flash_attn
|
712 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
713 |
+
|
714 |
+
self.h = nn.ModuleList(
|
715 |
+
[
|
716 |
+
QWenBlock(
|
717 |
+
config
|
718 |
+
)
|
719 |
+
for i in range(config.num_hidden_layers)
|
720 |
+
]
|
721 |
+
)
|
722 |
+
self.ln_f = RMSNorm(
|
723 |
+
self.embed_dim,
|
724 |
+
eps=config.layer_norm_epsilon,
|
725 |
+
)
|
726 |
+
|
727 |
+
self.post_init()
|
728 |
+
|
729 |
+
def get_input_embeddings(self):
|
730 |
+
return self.wte
|
731 |
+
|
732 |
+
def set_input_embeddings(self, new_embeddings):
|
733 |
+
self.wte = new_embeddings
|
734 |
+
|
735 |
+
def get_ntk_alpha(self, true_seq_len):
|
736 |
+
context_value = math.log(true_seq_len / self.seq_length, 2) + 1
|
737 |
+
ntk_alpha = 2 ** math.ceil(context_value) - 1
|
738 |
+
ntk_alpha = max(ntk_alpha, 1)
|
739 |
+
return ntk_alpha
|
740 |
+
|
741 |
+
def forward(
|
742 |
+
self,
|
743 |
+
input_ids: Optional[torch.LongTensor] = None,
|
744 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
745 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
746 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
747 |
+
position_ids: Optional[torch.LongTensor] = None,
|
748 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
749 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
750 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
751 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
752 |
+
use_cache: Optional[bool] = None,
|
753 |
+
output_attentions: Optional[bool] = None,
|
754 |
+
output_hidden_states: Optional[bool] = None,
|
755 |
+
return_dict: Optional[bool] = None,
|
756 |
+
):
|
757 |
+
output_attentions = (
|
758 |
+
output_attentions
|
759 |
+
if output_attentions is not None
|
760 |
+
else self.config.output_attentions
|
761 |
+
)
|
762 |
+
output_hidden_states = (
|
763 |
+
output_hidden_states
|
764 |
+
if output_hidden_states is not None
|
765 |
+
else self.config.output_hidden_states
|
766 |
+
)
|
767 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
768 |
+
return_dict = (
|
769 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
770 |
+
)
|
771 |
+
|
772 |
+
if input_ids is not None and inputs_embeds is not None:
|
773 |
+
raise ValueError(
|
774 |
+
"You cannot specify both input_ids and inputs_embeds at the same time"
|
775 |
+
)
|
776 |
+
elif input_ids is not None:
|
777 |
+
input_shape = input_ids.size()
|
778 |
+
input_ids = input_ids.view(-1, input_shape[-1])
|
779 |
+
batch_size = input_ids.shape[0]
|
780 |
+
elif inputs_embeds is not None:
|
781 |
+
input_shape = inputs_embeds.size()[:-1]
|
782 |
+
batch_size = inputs_embeds.shape[0]
|
783 |
+
else:
|
784 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
785 |
+
|
786 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
787 |
+
|
788 |
+
if token_type_ids is not None:
|
789 |
+
token_type_ids = token_type_ids.view(-1, input_shape[-1])
|
790 |
+
if position_ids is not None:
|
791 |
+
position_ids = position_ids.view(-1, input_shape[-1])
|
792 |
+
|
793 |
+
if past_key_values is None:
|
794 |
+
past_length = 0
|
795 |
+
past_key_values = tuple([None] * len(self.h))
|
796 |
+
else:
|
797 |
+
if self.use_cache_quantization:
|
798 |
+
past_length = past_key_values[0][0][0].size(2)
|
799 |
+
else:
|
800 |
+
past_length = past_key_values[0][0].size(-2)
|
801 |
+
if position_ids is None:
|
802 |
+
position_ids = torch.arange(
|
803 |
+
past_length,
|
804 |
+
input_shape[-1] + past_length,
|
805 |
+
dtype=torch.long,
|
806 |
+
device=device,
|
807 |
+
)
|
808 |
+
position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
|
809 |
+
|
810 |
+
if attention_mask is not None:
|
811 |
+
if batch_size <= 0:
|
812 |
+
raise ValueError("batch_size has to be defined and > 0")
|
813 |
+
attention_mask = attention_mask.view(batch_size, -1)
|
814 |
+
attention_mask = attention_mask[:, None, None, :]
|
815 |
+
attention_mask = attention_mask.to(dtype=self.dtype)
|
816 |
+
attention_mask = (1.0 - attention_mask) * torch.finfo(self.dtype).min
|
817 |
+
|
818 |
+
encoder_attention_mask = None
|
819 |
+
head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
|
820 |
+
|
821 |
+
if inputs_embeds is None:
|
822 |
+
inputs_embeds = self.wte(input_ids)
|
823 |
+
hidden_states = inputs_embeds
|
824 |
+
|
825 |
+
kv_seq_len = hidden_states.size()[1]
|
826 |
+
if past_key_values[0] is not None:
|
827 |
+
# past key values[0][0] shape: bs * seq_len * head_num * dim
|
828 |
+
if self.use_cache_quantization:
|
829 |
+
kv_seq_len += past_key_values[0][0][0].shape[2]
|
830 |
+
else:
|
831 |
+
kv_seq_len += past_key_values[0][0].shape[1]
|
832 |
+
|
833 |
+
if self.training or not self.use_dynamic_ntk:
|
834 |
+
ntk_alpha_list = [1.0]
|
835 |
+
elif kv_seq_len != hidden_states.size()[1]:
|
836 |
+
ntk_alpha_list = self.rotary_emb._ntk_alpha_cached_list
|
837 |
+
else:
|
838 |
+
ntk_alpha_list = []
|
839 |
+
if attention_mask is not None and kv_seq_len > self.seq_length:
|
840 |
+
true_seq_lens = attention_mask.squeeze(1).squeeze(1).eq(0).sum(dim=-1, dtype=torch.int32)
|
841 |
+
for i in range(hidden_states.size()[0]):
|
842 |
+
true_seq_len = true_seq_lens[i].item()
|
843 |
+
ntk_alpha = self.get_ntk_alpha(true_seq_len)
|
844 |
+
ntk_alpha_list.append(ntk_alpha)
|
845 |
+
else:
|
846 |
+
ntk_alpha = self.get_ntk_alpha(kv_seq_len)
|
847 |
+
ntk_alpha_list.append(ntk_alpha)
|
848 |
+
self.rotary_emb._ntk_alpha_cached_list = ntk_alpha_list
|
849 |
+
rotary_pos_emb_list = [
|
850 |
+
self.rotary_emb(kv_seq_len, ntk_alpha=ntk_alpha) for ntk_alpha in ntk_alpha_list
|
851 |
+
]
|
852 |
+
|
853 |
+
hidden_states = self.drop(hidden_states)
|
854 |
+
output_shape = input_shape + (hidden_states.size(-1),)
|
855 |
+
|
856 |
+
if self.gradient_checkpointing and self.training:
|
857 |
+
if use_cache:
|
858 |
+
logger.warning_once(
|
859 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
860 |
+
)
|
861 |
+
use_cache = False
|
862 |
+
|
863 |
+
presents = () if use_cache else None
|
864 |
+
all_self_attentions = () if output_attentions else None
|
865 |
+
all_hidden_states = () if output_hidden_states else None
|
866 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
867 |
+
|
868 |
+
if output_hidden_states:
|
869 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
870 |
+
|
871 |
+
if self.gradient_checkpointing and self.training:
|
872 |
+
|
873 |
+
def create_custom_forward(module):
|
874 |
+
def custom_forward(*inputs):
|
875 |
+
# None for past_key_value
|
876 |
+
return module(*inputs, use_cache, output_attentions)
|
877 |
+
|
878 |
+
return custom_forward
|
879 |
+
|
880 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
881 |
+
create_custom_forward(block),
|
882 |
+
hidden_states,
|
883 |
+
rotary_pos_emb_list,
|
884 |
+
None,
|
885 |
+
attention_mask,
|
886 |
+
head_mask[i],
|
887 |
+
encoder_hidden_states,
|
888 |
+
encoder_attention_mask,
|
889 |
+
)
|
890 |
+
else:
|
891 |
+
outputs = block(
|
892 |
+
hidden_states,
|
893 |
+
layer_past=layer_past,
|
894 |
+
rotary_pos_emb_list=rotary_pos_emb_list,
|
895 |
+
attention_mask=attention_mask,
|
896 |
+
head_mask=head_mask[i],
|
897 |
+
encoder_hidden_states=encoder_hidden_states,
|
898 |
+
encoder_attention_mask=encoder_attention_mask,
|
899 |
+
use_cache=use_cache,
|
900 |
+
output_attentions=output_attentions,
|
901 |
+
)
|
902 |
+
|
903 |
+
hidden_states = outputs[0]
|
904 |
+
if use_cache is True:
|
905 |
+
presents = presents + (outputs[1],)
|
906 |
+
|
907 |
+
if output_attentions:
|
908 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
909 |
+
|
910 |
+
hidden_states = self.ln_f(hidden_states)
|
911 |
+
hidden_states = hidden_states.view(output_shape)
|
912 |
+
# Add last hidden state
|
913 |
+
if output_hidden_states:
|
914 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
915 |
+
|
916 |
+
if not return_dict:
|
917 |
+
return tuple(
|
918 |
+
v for v in [hidden_states, presents, all_hidden_states] if v is not None
|
919 |
+
)
|
920 |
+
|
921 |
+
return BaseModelOutputWithPast(
|
922 |
+
last_hidden_state=hidden_states,
|
923 |
+
past_key_values=presents,
|
924 |
+
hidden_states=all_hidden_states,
|
925 |
+
attentions=all_self_attentions,
|
926 |
+
)
|
927 |
+
|
928 |
+
|
929 |
+
class QWenLMHeadModel(QWenPreTrainedModel):
|
930 |
+
_keys_to_ignore_on_load_missing = [r"h\.\d+\.attn\.rotary_emb\.inv_freq"]
|
931 |
+
_keys_to_ignore_on_load_unexpected = [r"h\.\d+\.attn\.masked_bias"]
|
932 |
+
|
933 |
+
def __init__(self, config):
|
934 |
+
super().__init__(config)
|
935 |
+
assert (
|
936 |
+
config.bf16 + config.fp16 + config.fp32 <= 1
|
937 |
+
), "Only one of \"bf16\", \"fp16\", \"fp32\" can be true"
|
938 |
+
|
939 |
+
autoset_precision = config.bf16 + config.fp16 + config.fp32 == 0
|
940 |
+
|
941 |
+
if autoset_precision:
|
942 |
+
if SUPPORT_BF16:
|
943 |
+
logger.warn(
|
944 |
+
"The model is automatically converting to bf16 for faster inference. "
|
945 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
946 |
+
)
|
947 |
+
config.bf16 = True
|
948 |
+
elif SUPPORT_FP16:
|
949 |
+
logger.warn(
|
950 |
+
"The model is automatically converting to fp16 for faster inference. "
|
951 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
952 |
+
)
|
953 |
+
config.fp16 = True
|
954 |
+
else:
|
955 |
+
config.fp32 = True
|
956 |
+
|
957 |
+
if config.bf16 and SUPPORT_CUDA and not SUPPORT_BF16:
|
958 |
+
logger.warn("Your device does NOT seem to support bf16, you can switch to fp16 or fp32 by by passing fp16/fp32=True in \"AutoModelForCausalLM.from_pretrained\".")
|
959 |
+
if config.fp16 and SUPPORT_CUDA and not SUPPORT_FP16:
|
960 |
+
logger.warn("Your device does NOT support faster inference with fp16, please switch to fp32 which is likely to be faster")
|
961 |
+
if config.fp32:
|
962 |
+
if SUPPORT_BF16:
|
963 |
+
logger.warn("Your device support faster inference by passing bf16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
964 |
+
elif SUPPORT_FP16:
|
965 |
+
logger.warn("Your device support faster inference by passing fp16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
966 |
+
|
967 |
+
if config.use_flash_attn == "auto":
|
968 |
+
if config.bf16 or config.fp16:
|
969 |
+
logger.warn("Try importing flash-attention for faster inference...")
|
970 |
+
config.use_flash_attn = True
|
971 |
+
else:
|
972 |
+
config.use_flash_attn = False
|
973 |
+
if config.use_flash_attn and config.fp32:
|
974 |
+
logger.warn("Flash attention will be disabled because it does NOT support fp32.")
|
975 |
+
|
976 |
+
if config.use_flash_attn:
|
977 |
+
_import_flash_attn()
|
978 |
+
|
979 |
+
self.transformer = QWenModel(config)
|
980 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
981 |
+
|
982 |
+
if config.bf16:
|
983 |
+
self.transformer.bfloat16()
|
984 |
+
self.lm_head.bfloat16()
|
985 |
+
if config.fp16:
|
986 |
+
self.transformer.half()
|
987 |
+
self.lm_head.half()
|
988 |
+
self.post_init()
|
989 |
+
|
990 |
+
def get_output_embeddings(self):
|
991 |
+
return self.lm_head
|
992 |
+
|
993 |
+
def set_output_embeddings(self, new_embeddings):
|
994 |
+
self.lm_head = new_embeddings
|
995 |
+
|
996 |
+
def prepare_inputs_for_generation(
|
997 |
+
self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs
|
998 |
+
):
|
999 |
+
if past_key_values:
|
1000 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
1001 |
+
|
1002 |
+
if input_ids.size(0) == 1:
|
1003 |
+
attention_mask = None
|
1004 |
+
else:
|
1005 |
+
attention_mask = kwargs.get("attention_mask", None)
|
1006 |
+
|
1007 |
+
if inputs_embeds is not None and past_key_values is None:
|
1008 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
1009 |
+
else:
|
1010 |
+
model_inputs = {"input_ids": input_ids}
|
1011 |
+
|
1012 |
+
model_inputs.update(
|
1013 |
+
{
|
1014 |
+
"past_key_values": past_key_values,
|
1015 |
+
"use_cache": kwargs.get("use_cache"),
|
1016 |
+
"attention_mask": attention_mask,
|
1017 |
+
}
|
1018 |
+
)
|
1019 |
+
return model_inputs
|
1020 |
+
|
1021 |
+
def forward(
|
1022 |
+
self,
|
1023 |
+
input_ids: Optional[torch.LongTensor] = None,
|
1024 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
1025 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
1026 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
1027 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1028 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
1029 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1030 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
1031 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
1032 |
+
labels: Optional[torch.LongTensor] = None,
|
1033 |
+
use_cache: Optional[bool] = None,
|
1034 |
+
output_attentions: Optional[bool] = None,
|
1035 |
+
output_hidden_states: Optional[bool] = None,
|
1036 |
+
return_dict: Optional[bool] = None,
|
1037 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
1038 |
+
|
1039 |
+
return_dict = (
|
1040 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
1041 |
+
)
|
1042 |
+
|
1043 |
+
transformer_outputs = self.transformer(
|
1044 |
+
input_ids,
|
1045 |
+
past_key_values=past_key_values,
|
1046 |
+
attention_mask=attention_mask,
|
1047 |
+
token_type_ids=token_type_ids,
|
1048 |
+
position_ids=position_ids,
|
1049 |
+
head_mask=head_mask,
|
1050 |
+
inputs_embeds=inputs_embeds,
|
1051 |
+
encoder_hidden_states=encoder_hidden_states,
|
1052 |
+
encoder_attention_mask=encoder_attention_mask,
|
1053 |
+
use_cache=use_cache,
|
1054 |
+
output_attentions=output_attentions,
|
1055 |
+
output_hidden_states=output_hidden_states,
|
1056 |
+
return_dict=return_dict,
|
1057 |
+
)
|
1058 |
+
hidden_states = transformer_outputs[0]
|
1059 |
+
|
1060 |
+
hidden_states = hidden_states.to(torch.bfloat16)
|
1061 |
+
|
1062 |
+
#解决self和mat2数据类型不一致的bug
|
1063 |
+
|
1064 |
+
lm_logits = self.lm_head(hidden_states)
|
1065 |
+
|
1066 |
+
loss = None
|
1067 |
+
if labels is not None:
|
1068 |
+
labels = labels.to(lm_logits.device)
|
1069 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
1070 |
+
shift_labels = labels[..., 1:].contiguous()
|
1071 |
+
loss_fct = CrossEntropyLoss()
|
1072 |
+
loss = loss_fct(
|
1073 |
+
shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1)
|
1074 |
+
)
|
1075 |
+
|
1076 |
+
if not return_dict:
|
1077 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
1078 |
+
return ((loss,) + output) if loss is not None else output
|
1079 |
+
|
1080 |
+
return CausalLMOutputWithPast(
|
1081 |
+
loss=loss,
|
1082 |
+
logits=lm_logits,
|
1083 |
+
past_key_values=transformer_outputs.past_key_values,
|
1084 |
+
hidden_states=transformer_outputs.hidden_states,
|
1085 |
+
attentions=transformer_outputs.attentions,
|
1086 |
+
)
|
1087 |
+
|
1088 |
+
@staticmethod
|
1089 |
+
def _reorder_cache(
|
1090 |
+
past_key_values: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor
|
1091 |
+
) -> Tuple[Tuple[torch.Tensor]]:
|
1092 |
+
|
1093 |
+
return tuple(
|
1094 |
+
tuple(
|
1095 |
+
past_state.index_select(0, beam_idx.to(past_state.device))
|
1096 |
+
for past_state in layer_past
|
1097 |
+
)
|
1098 |
+
for layer_past in past_key_values
|
1099 |
+
)
|
1100 |
+
|
1101 |
+
def chat(
|
1102 |
+
self,
|
1103 |
+
tokenizer: PreTrainedTokenizer,
|
1104 |
+
query: str,
|
1105 |
+
history: Optional[HistoryType],
|
1106 |
+
system: str = "You are a helpful assistant.",
|
1107 |
+
stream: Optional[bool] = _SENTINEL,
|
1108 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
1109 |
+
generation_config: Optional[GenerationConfig] = None,
|
1110 |
+
**kwargs,
|
1111 |
+
) -> Tuple[str, HistoryType]:
|
1112 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1113 |
+
|
1114 |
+
assert stream is _SENTINEL, _ERROR_STREAM_IN_CHAT
|
1115 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
1116 |
+
if history is None:
|
1117 |
+
history = []
|
1118 |
+
else:
|
1119 |
+
# make a copy of the user's input such that is is left untouched
|
1120 |
+
history = copy.deepcopy(history)
|
1121 |
+
|
1122 |
+
if stop_words_ids is None:
|
1123 |
+
stop_words_ids = []
|
1124 |
+
|
1125 |
+
max_window_size = kwargs.get('max_window_size', None)
|
1126 |
+
if max_window_size is None:
|
1127 |
+
max_window_size = generation_config.max_window_size
|
1128 |
+
raw_text, context_tokens = make_context(
|
1129 |
+
tokenizer,
|
1130 |
+
query,
|
1131 |
+
history=history,
|
1132 |
+
system=system,
|
1133 |
+
max_window_size=max_window_size,
|
1134 |
+
chat_format=generation_config.chat_format,
|
1135 |
+
)
|
1136 |
+
|
1137 |
+
stop_words_ids.extend(get_stop_words_ids(
|
1138 |
+
generation_config.chat_format, tokenizer
|
1139 |
+
))
|
1140 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
1141 |
+
outputs = self.generate(
|
1142 |
+
input_ids,
|
1143 |
+
stop_words_ids=stop_words_ids,
|
1144 |
+
return_dict_in_generate=False,
|
1145 |
+
generation_config=generation_config,
|
1146 |
+
**kwargs,
|
1147 |
+
)
|
1148 |
+
|
1149 |
+
response = decode_tokens(
|
1150 |
+
outputs[0],
|
1151 |
+
tokenizer,
|
1152 |
+
raw_text_len=len(raw_text),
|
1153 |
+
context_length=len(context_tokens),
|
1154 |
+
chat_format=generation_config.chat_format,
|
1155 |
+
verbose=False,
|
1156 |
+
errors='replace'
|
1157 |
+
)
|
1158 |
+
|
1159 |
+
# as history is a copy of the user inputs,
|
1160 |
+
# we can always return the new turn to the user.
|
1161 |
+
# separating input history and output history also enables the user
|
1162 |
+
# to implement more complex history management
|
1163 |
+
history.append((query, response))
|
1164 |
+
|
1165 |
+
return response, history
|
1166 |
+
|
1167 |
+
def chat_stream(
|
1168 |
+
self,
|
1169 |
+
tokenizer: PreTrainedTokenizer,
|
1170 |
+
query: str,
|
1171 |
+
history: Optional[HistoryType],
|
1172 |
+
system: str = "You are a helpful assistant.",
|
1173 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
1174 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
1175 |
+
generation_config: Optional[GenerationConfig] = None,
|
1176 |
+
**kwargs,
|
1177 |
+
) -> Generator[str, Any, None]:
|
1178 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1179 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
1180 |
+
if history is None:
|
1181 |
+
history = []
|
1182 |
+
if stop_words_ids is None:
|
1183 |
+
stop_words_ids = []
|
1184 |
+
|
1185 |
+
max_window_size = kwargs.get('max_window_size', None)
|
1186 |
+
if max_window_size is None:
|
1187 |
+
max_window_size = generation_config.max_window_size
|
1188 |
+
raw_text, context_tokens = make_context(
|
1189 |
+
tokenizer,
|
1190 |
+
query,
|
1191 |
+
history=history,
|
1192 |
+
system=system,
|
1193 |
+
max_window_size=max_window_size,
|
1194 |
+
chat_format=generation_config.chat_format,
|
1195 |
+
)
|
1196 |
+
|
1197 |
+
stop_words_ids.extend(get_stop_words_ids(
|
1198 |
+
generation_config.chat_format, tokenizer
|
1199 |
+
))
|
1200 |
+
if stop_words_ids is not None:
|
1201 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
1202 |
+
stop_words_ids=stop_words_ids,
|
1203 |
+
eos_token_id=generation_config.eos_token_id,
|
1204 |
+
)
|
1205 |
+
if logits_processor is None:
|
1206 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
1207 |
+
else:
|
1208 |
+
logits_processor.append(stop_words_logits_processor)
|
1209 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
1210 |
+
|
1211 |
+
from transformers_stream_generator.main import NewGenerationMixin, StreamGenerationConfig
|
1212 |
+
self.__class__.generate_stream = NewGenerationMixin.generate
|
1213 |
+
self.__class__.sample_stream = NewGenerationMixin.sample_stream
|
1214 |
+
stream_config = StreamGenerationConfig(**generation_config.to_dict(), do_stream=True)
|
1215 |
+
|
1216 |
+
def stream_generator():
|
1217 |
+
outputs = []
|
1218 |
+
for token in self.generate_stream(
|
1219 |
+
input_ids,
|
1220 |
+
return_dict_in_generate=False,
|
1221 |
+
generation_config=stream_config,
|
1222 |
+
logits_processor=logits_processor,
|
1223 |
+
seed=-1,
|
1224 |
+
**kwargs):
|
1225 |
+
outputs.append(token.item())
|
1226 |
+
yield tokenizer.decode(outputs, skip_special_tokens=True, errors='ignore')
|
1227 |
+
|
1228 |
+
return stream_generator()
|
1229 |
+
|
1230 |
+
def generate(
|
1231 |
+
self,
|
1232 |
+
inputs: Optional[torch.Tensor] = None,
|
1233 |
+
generation_config: Optional[GenerationConfig] = None,
|
1234 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
1235 |
+
stopping_criteria: Optional[StoppingCriteriaList] = None,
|
1236 |
+
prefix_allowed_tokens_fn: Optional[
|
1237 |
+
Callable[[int, torch.Tensor], List[int]]
|
1238 |
+
] = None,
|
1239 |
+
synced_gpus: Optional[bool] = None,
|
1240 |
+
assistant_model: Optional["PreTrainedModel"] = None,
|
1241 |
+
streamer: Optional["BaseStreamer"] = None,
|
1242 |
+
**kwargs,
|
1243 |
+
) -> Union[GenerateOutput, torch.LongTensor]:
|
1244 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1245 |
+
|
1246 |
+
# Process stop_words_ids.
|
1247 |
+
stop_words_ids = kwargs.pop("stop_words_ids", None)
|
1248 |
+
if stop_words_ids is None and generation_config is not None:
|
1249 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
1250 |
+
if stop_words_ids is None:
|
1251 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
1252 |
+
|
1253 |
+
if stop_words_ids is not None:
|
1254 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
1255 |
+
stop_words_ids=stop_words_ids,
|
1256 |
+
eos_token_id=generation_config.eos_token_id,
|
1257 |
+
)
|
1258 |
+
if logits_processor is None:
|
1259 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
1260 |
+
else:
|
1261 |
+
logits_processor.append(stop_words_logits_processor)
|
1262 |
+
|
1263 |
+
return super().generate(
|
1264 |
+
inputs,
|
1265 |
+
generation_config=generation_config,
|
1266 |
+
logits_processor=logits_processor,
|
1267 |
+
stopping_criteria=stopping_criteria,
|
1268 |
+
prefix_allowed_tokens_fn=prefix_allowed_tokens_fn,
|
1269 |
+
synced_gpus=synced_gpus,
|
1270 |
+
assistant_model=assistant_model,
|
1271 |
+
streamer=streamer,
|
1272 |
+
**kwargs,
|
1273 |
+
)
|
1274 |
+
|
1275 |
+
|
1276 |
+
class RotaryEmbedding(torch.nn.Module):
|
1277 |
+
def __init__(self, dim, base=10000):
|
1278 |
+
super().__init__()
|
1279 |
+
self.dim = dim
|
1280 |
+
self.base = base
|
1281 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float() / dim))
|
1282 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
1283 |
+
if importlib.util.find_spec("einops") is None:
|
1284 |
+
raise RuntimeError("einops is required for Rotary Embedding")
|
1285 |
+
|
1286 |
+
self._rotary_pos_emb_cache = None
|
1287 |
+
self._seq_len_cached = 0
|
1288 |
+
self._ntk_alpha_cached = 1.0
|
1289 |
+
self._ntk_alpha_cached_list = [1.0]
|
1290 |
+
|
1291 |
+
def update_rotary_pos_emb_cache(self, seqlen, ntk_alpha=1.0):
|
1292 |
+
if seqlen > self._seq_len_cached or ntk_alpha != self._ntk_alpha_cached:
|
1293 |
+
base = self.base * ntk_alpha ** (self.dim / (self.dim - 2))
|
1294 |
+
self.inv_freq = 1.0 / (
|
1295 |
+
base
|
1296 |
+
** (
|
1297 |
+
torch.arange(0, self.dim, 2, device=self.inv_freq.device).float()
|
1298 |
+
/ self.dim
|
1299 |
+
)
|
1300 |
+
)
|
1301 |
+
self._seq_len_cached = max(2 * seqlen, 16)
|
1302 |
+
self._ntk_alpha_cached = ntk_alpha
|
1303 |
+
seq = torch.arange(self._seq_len_cached, device=self.inv_freq.device)
|
1304 |
+
freqs = torch.outer(seq.type_as(self.inv_freq), self.inv_freq)
|
1305 |
+
|
1306 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
1307 |
+
from einops import rearrange
|
1308 |
+
|
1309 |
+
emb = rearrange(emb, "n d -> 1 n 1 d")
|
1310 |
+
|
1311 |
+
cos, sin = emb.cos(), emb.sin()
|
1312 |
+
self._rotary_pos_emb_cache = [cos, sin]
|
1313 |
+
|
1314 |
+
def forward(self, max_seq_len, ntk_alpha=1.0):
|
1315 |
+
self.update_rotary_pos_emb_cache(max_seq_len, ntk_alpha)
|
1316 |
+
cos, sin = self._rotary_pos_emb_cache
|
1317 |
+
return [cos[:, :max_seq_len], sin[:, :max_seq_len]]
|
1318 |
+
|
1319 |
+
|
1320 |
+
def _rotate_half(x):
|
1321 |
+
from einops import rearrange
|
1322 |
+
|
1323 |
+
x = rearrange(x, "... (j d) -> ... j d", j=2)
|
1324 |
+
x1, x2 = x.unbind(dim=-2)
|
1325 |
+
return torch.cat((-x2, x1), dim=-1)
|
1326 |
+
|
1327 |
+
|
1328 |
+
def apply_rotary_pos_emb(t, freqs):
|
1329 |
+
""" Apply rotary embedding to the first rotary_dim of the iput
|
1330 |
+
|
1331 |
+
Arguments:
|
1332 |
+
t (tensor(batch_size, seq_len, n_head, head_dim)):
|
1333 |
+
the input embedding/hidden states
|
1334 |
+
freqs (list[tensor(1, seq_len, 1, rotary_dim), tensor(1, seq_len, 1, rotary_dim)]):
|
1335 |
+
the cached cos/sin position embeddings
|
1336 |
+
"""
|
1337 |
+
rot_dim = freqs[0].shape[-1]
|
1338 |
+
cos, sin = freqs
|
1339 |
+
t_float = t.float()
|
1340 |
+
if apply_rotary_emb_func is not None and t.is_cuda:
|
1341 |
+
# apply_rotary_emb in flash_attn requires cos/sin to be of
|
1342 |
+
# shape (seqlen, rotary_dim / 2) and apply rotary embedding
|
1343 |
+
# to the first rotary_dim of the input
|
1344 |
+
cos = cos.squeeze(0).squeeze(1)[:, : rot_dim // 2]
|
1345 |
+
sin = sin.squeeze(0).squeeze(1)[:, : rot_dim // 2]
|
1346 |
+
return apply_rotary_emb_func(t_float, cos, sin).type_as(t)
|
1347 |
+
else:
|
1348 |
+
t_rot, t_pass = t_float[..., :rot_dim], t_float[..., rot_dim:]
|
1349 |
+
t_rot = (t_rot * cos) + (_rotate_half(t_rot) * sin)
|
1350 |
+
return torch.cat((t_rot, t_pass), dim=-1).type_as(t)
|
1351 |
+
|
1352 |
+
|
1353 |
+
class RMSNorm(torch.nn.Module):
|
1354 |
+
def __init__(self, dim: int, eps: float = 1e-6):
|
1355 |
+
super().__init__()
|
1356 |
+
self.eps = eps
|
1357 |
+
self.weight = nn.Parameter(torch.ones(dim))
|
1358 |
+
|
1359 |
+
def _norm(self, x):
|
1360 |
+
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
|
1361 |
+
|
1362 |
+
def forward(self, x):
|
1363 |
+
if rms_norm is not None and x.is_cuda:
|
1364 |
+
return rms_norm(x, self.weight, self.eps)
|
1365 |
+
else:
|
1366 |
+
output = self._norm(x.float()).type_as(x)
|
1367 |
+
return output * self.weight
|