Upload 14 files
Browse files- chat_template.jinja +1 -0
- config.json +31 -0
- configuration_openpangu_dense.py +56 -0
- generation_config.json +10 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +453 -0
- modeling_openpangu_dense.py +588 -0
- special_tokens_map.json +30 -0
- tokenization_openpangu.py +273 -0
- tokenizer.model +3 -0
- tokenizer_config.json +334 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '[unused9]系统:[unused10]' }}{% endif %}{% if message['role'] == 'system' %}{{ '[unused9]系统:' + message['content'] + '[unused10]' }}{% endif %}{% if message['role'] == 'assistant' %}{{'[unused9]助手:' + message['content'] + '[unused10]'}}{% endif %}{% if message['role'] == 'tool' %}{{'[unused9]工具:' + message['content'] + '[unused10]'}}{% endif %}{% if message['role'] == 'function' %}{{'[unused9]方法:' + message['content'] + '[unused10]'}}{% endif %}{% if message['role'] == 'user' %}{{'[unused9]用户:' + message['content'] + '[unused10]'}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '[unused9]助手:' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"PanguEmbeddedForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration_openpangu_dense.PanguEmbeddedConfig",
|
| 8 |
+
"AutoModel": "modeling_openpangu_dense.PanguEmbeddedModel",
|
| 9 |
+
"AutoModelForCausalLM": "modeling_openpangu_dense.PanguEmbeddedForCausalLM"
|
| 10 |
+
},
|
| 11 |
+
"bias": true,
|
| 12 |
+
"bos_token_id": 1,
|
| 13 |
+
"eos_token_id": 45892,
|
| 14 |
+
"hidden_act": "silu",
|
| 15 |
+
"hidden_size": 4096,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 12800,
|
| 18 |
+
"max_position_embeddings": 32768,
|
| 19 |
+
"model_type": "PanguEmbedded",
|
| 20 |
+
"num_attention_heads": 32,
|
| 21 |
+
"num_hidden_layers": 34,
|
| 22 |
+
"num_key_value_heads": 8,
|
| 23 |
+
"pad_token_id": 0,
|
| 24 |
+
"rms_norm_eps": 1e-05,
|
| 25 |
+
"rope_theta": 16000000.0,
|
| 26 |
+
"tie_word_embeddings": false,
|
| 27 |
+
"torch_dtype": "bfloat16",
|
| 28 |
+
"transformers_version": "4.53.2",
|
| 29 |
+
"use_cache": true,
|
| 30 |
+
"vocab_size": 153376
|
| 31 |
+
}
|
configuration_openpangu_dense.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
|
| 3 |
+
|
| 4 |
+
from transformers.utils import logging
|
| 5 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
logger = logging.get_logger(__name__)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class PanguEmbeddedConfig(PretrainedConfig):
|
| 12 |
+
|
| 13 |
+
model_type = "PanguEmbedded"
|
| 14 |
+
_auto_class = "AutoConfig"
|
| 15 |
+
|
| 16 |
+
def __init__(
|
| 17 |
+
self,
|
| 18 |
+
vocab_size=153376,
|
| 19 |
+
hidden_size=4096,
|
| 20 |
+
intermediate_size=12800,
|
| 21 |
+
num_hidden_layers=34,
|
| 22 |
+
num_attention_heads=32,
|
| 23 |
+
num_key_value_heads=8,
|
| 24 |
+
hidden_act="silu",
|
| 25 |
+
max_position_embeddings=32768,
|
| 26 |
+
initializer_range=0.02,
|
| 27 |
+
rms_norm_eps=1e-5,
|
| 28 |
+
use_cache=True,
|
| 29 |
+
pad_token_id=0,
|
| 30 |
+
bos_token_id=1,
|
| 31 |
+
eos_token_id=45892,
|
| 32 |
+
tie_word_embeddings=False,
|
| 33 |
+
rope_theta=16000000.0,
|
| 34 |
+
bias=True,
|
| 35 |
+
**kwargs,
|
| 36 |
+
):
|
| 37 |
+
self.vocab_size = vocab_size
|
| 38 |
+
self.max_position_embeddings = max_position_embeddings
|
| 39 |
+
self.hidden_size = hidden_size
|
| 40 |
+
self.intermediate_size = intermediate_size
|
| 41 |
+
self.num_hidden_layers = num_hidden_layers
|
| 42 |
+
self.num_attention_heads = num_attention_heads
|
| 43 |
+
self.num_key_value_heads = num_key_value_heads
|
| 44 |
+
self.hidden_act = hidden_act
|
| 45 |
+
self.initializer_range = initializer_range
|
| 46 |
+
self.rms_norm_eps = rms_norm_eps
|
| 47 |
+
self.use_cache = use_cache
|
| 48 |
+
self.rope_theta = rope_theta
|
| 49 |
+
self.bias = bias
|
| 50 |
+
super().__init__(
|
| 51 |
+
pad_token_id=pad_token_id,
|
| 52 |
+
bos_token_id=bos_token_id,
|
| 53 |
+
eos_token_id=eos_token_id,
|
| 54 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 55 |
+
**kwargs,
|
| 56 |
+
)
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 45892,
|
| 6 |
+
"pad_token_id": 0,
|
| 7 |
+
"top_k": 0,
|
| 8 |
+
"top_p": 0.8,
|
| 9 |
+
"transformers_version": "4.53.2"
|
| 10 |
+
}
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:34d46e5873c9342b47ca9a5897107643ff0a886c2aed5834cffc2fedc8ecf665
|
| 3 |
+
size 4926838832
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:68de09f8440162ec209b6b39a63f0e783655d0c4edc48def37ea2b0c9a669803
|
| 3 |
+
size 4991682264
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e859f0c8ba998abcb8dabe593b39bd061202577ff82b44473bb707cbcdbb4fb
|
| 3 |
+
size 4886849448
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_parameters": 8030887936,
|
| 4 |
+
"total_size": 16061775872
|
| 5 |
+
},
|
| 6 |
+
"weight_map": {
|
| 7 |
+
"lm_head.weight": "model-00004-of-00004.safetensors",
|
| 8 |
+
"model.embed_tokens.weight": "model-00001-of-00004.safetensors",
|
| 9 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 10 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 11 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 12 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 13 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 14 |
+
"model.layers.0.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 15 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 16 |
+
"model.layers.0.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 17 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 18 |
+
"model.layers.0.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 19 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 20 |
+
"model.layers.0.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 21 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 22 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 23 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 24 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 25 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 26 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 27 |
+
"model.layers.1.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 28 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 29 |
+
"model.layers.1.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 30 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 31 |
+
"model.layers.1.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 32 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 33 |
+
"model.layers.1.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 34 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 35 |
+
"model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 36 |
+
"model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 37 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 38 |
+
"model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 39 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 40 |
+
"model.layers.10.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 41 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 42 |
+
"model.layers.10.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 43 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 44 |
+
"model.layers.10.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 45 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 46 |
+
"model.layers.10.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 47 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 48 |
+
"model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 49 |
+
"model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 50 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 51 |
+
"model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 52 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 53 |
+
"model.layers.11.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 54 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 55 |
+
"model.layers.11.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 56 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 57 |
+
"model.layers.11.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 58 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 59 |
+
"model.layers.11.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 60 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 61 |
+
"model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 62 |
+
"model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 63 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 64 |
+
"model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 65 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 66 |
+
"model.layers.12.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 67 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 68 |
+
"model.layers.12.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 69 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 70 |
+
"model.layers.12.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 71 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 72 |
+
"model.layers.12.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 73 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 74 |
+
"model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 75 |
+
"model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 76 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 77 |
+
"model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 78 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 79 |
+
"model.layers.13.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 80 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 81 |
+
"model.layers.13.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 82 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 83 |
+
"model.layers.13.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 84 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 85 |
+
"model.layers.13.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 86 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 87 |
+
"model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 88 |
+
"model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 89 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 90 |
+
"model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 91 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 92 |
+
"model.layers.14.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 93 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 94 |
+
"model.layers.14.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 95 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 96 |
+
"model.layers.14.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 97 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 98 |
+
"model.layers.14.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 99 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 100 |
+
"model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 101 |
+
"model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 102 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 103 |
+
"model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 104 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 105 |
+
"model.layers.15.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 106 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 107 |
+
"model.layers.15.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 108 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 109 |
+
"model.layers.15.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 110 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 111 |
+
"model.layers.15.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 112 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 113 |
+
"model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 114 |
+
"model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 115 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 116 |
+
"model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 117 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 118 |
+
"model.layers.16.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 119 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 120 |
+
"model.layers.16.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 121 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 122 |
+
"model.layers.16.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 123 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 124 |
+
"model.layers.16.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 125 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 126 |
+
"model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 127 |
+
"model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 128 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 129 |
+
"model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 130 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 131 |
+
"model.layers.17.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 132 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 133 |
+
"model.layers.17.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 134 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 135 |
+
"model.layers.17.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 136 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 137 |
+
"model.layers.17.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 138 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 139 |
+
"model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 140 |
+
"model.layers.18.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 141 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 142 |
+
"model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 143 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 144 |
+
"model.layers.18.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 145 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 146 |
+
"model.layers.18.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 147 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 148 |
+
"model.layers.18.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 149 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 150 |
+
"model.layers.18.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 151 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 152 |
+
"model.layers.19.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 153 |
+
"model.layers.19.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 154 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 155 |
+
"model.layers.19.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 156 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 157 |
+
"model.layers.19.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 158 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 159 |
+
"model.layers.19.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 160 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 161 |
+
"model.layers.19.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 162 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 163 |
+
"model.layers.19.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 164 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 165 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 166 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 167 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 168 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 169 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 170 |
+
"model.layers.2.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 171 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 172 |
+
"model.layers.2.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 173 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 174 |
+
"model.layers.2.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 175 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 176 |
+
"model.layers.2.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 177 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 178 |
+
"model.layers.20.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 179 |
+
"model.layers.20.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 180 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 181 |
+
"model.layers.20.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 182 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 183 |
+
"model.layers.20.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 184 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 185 |
+
"model.layers.20.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 186 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 187 |
+
"model.layers.20.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 188 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 189 |
+
"model.layers.20.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 190 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 191 |
+
"model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 192 |
+
"model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 193 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 194 |
+
"model.layers.21.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 195 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 196 |
+
"model.layers.21.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 197 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 198 |
+
"model.layers.21.self_attn.o_proj.bias": "model-00002-of-00004.safetensors",
|
| 199 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 200 |
+
"model.layers.21.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 201 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 202 |
+
"model.layers.21.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 203 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 204 |
+
"model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 205 |
+
"model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 206 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 207 |
+
"model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 208 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 209 |
+
"model.layers.22.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 210 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 211 |
+
"model.layers.22.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 212 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 213 |
+
"model.layers.22.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 214 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 215 |
+
"model.layers.22.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 216 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 217 |
+
"model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 218 |
+
"model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 219 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 220 |
+
"model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 221 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 222 |
+
"model.layers.23.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 223 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 224 |
+
"model.layers.23.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 225 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 226 |
+
"model.layers.23.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 227 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 228 |
+
"model.layers.23.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 229 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 230 |
+
"model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 231 |
+
"model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 232 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 233 |
+
"model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 234 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 235 |
+
"model.layers.24.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 236 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 237 |
+
"model.layers.24.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 238 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 239 |
+
"model.layers.24.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 240 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 241 |
+
"model.layers.24.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 242 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 243 |
+
"model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 244 |
+
"model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 245 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 246 |
+
"model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 247 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 248 |
+
"model.layers.25.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 249 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 250 |
+
"model.layers.25.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 251 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 252 |
+
"model.layers.25.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 253 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 254 |
+
"model.layers.25.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 255 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 256 |
+
"model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 257 |
+
"model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 258 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 259 |
+
"model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 260 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 261 |
+
"model.layers.26.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 262 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 263 |
+
"model.layers.26.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 264 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 265 |
+
"model.layers.26.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 266 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 267 |
+
"model.layers.26.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 268 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 269 |
+
"model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 270 |
+
"model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 271 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 272 |
+
"model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 273 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 274 |
+
"model.layers.27.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 275 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 276 |
+
"model.layers.27.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 277 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 278 |
+
"model.layers.27.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 279 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 280 |
+
"model.layers.27.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 281 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 282 |
+
"model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 283 |
+
"model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 284 |
+
"model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 285 |
+
"model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 286 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 287 |
+
"model.layers.28.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 288 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 289 |
+
"model.layers.28.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 290 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 291 |
+
"model.layers.28.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 292 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 293 |
+
"model.layers.28.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 294 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 295 |
+
"model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 296 |
+
"model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 297 |
+
"model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 298 |
+
"model.layers.29.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 299 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 300 |
+
"model.layers.29.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 301 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 302 |
+
"model.layers.29.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 303 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 304 |
+
"model.layers.29.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 305 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 306 |
+
"model.layers.29.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 307 |
+
"model.layers.29.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 308 |
+
"model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 309 |
+
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 310 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 311 |
+
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 312 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 313 |
+
"model.layers.3.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 314 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 315 |
+
"model.layers.3.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 316 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 317 |
+
"model.layers.3.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 318 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 319 |
+
"model.layers.3.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 320 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 321 |
+
"model.layers.30.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 322 |
+
"model.layers.30.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 323 |
+
"model.layers.30.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 324 |
+
"model.layers.30.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 325 |
+
"model.layers.30.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 326 |
+
"model.layers.30.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 327 |
+
"model.layers.30.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 328 |
+
"model.layers.30.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 329 |
+
"model.layers.30.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 330 |
+
"model.layers.30.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 331 |
+
"model.layers.30.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 332 |
+
"model.layers.30.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 333 |
+
"model.layers.30.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 334 |
+
"model.layers.31.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 335 |
+
"model.layers.31.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 336 |
+
"model.layers.31.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 337 |
+
"model.layers.31.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 338 |
+
"model.layers.31.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 339 |
+
"model.layers.31.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 340 |
+
"model.layers.31.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 341 |
+
"model.layers.31.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 342 |
+
"model.layers.31.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 343 |
+
"model.layers.31.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 344 |
+
"model.layers.31.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 345 |
+
"model.layers.31.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 346 |
+
"model.layers.31.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 347 |
+
"model.layers.32.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 348 |
+
"model.layers.32.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 349 |
+
"model.layers.32.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 350 |
+
"model.layers.32.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 351 |
+
"model.layers.32.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 352 |
+
"model.layers.32.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 353 |
+
"model.layers.32.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 354 |
+
"model.layers.32.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 355 |
+
"model.layers.32.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 356 |
+
"model.layers.32.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 357 |
+
"model.layers.32.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 358 |
+
"model.layers.32.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 359 |
+
"model.layers.32.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 360 |
+
"model.layers.33.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 361 |
+
"model.layers.33.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 362 |
+
"model.layers.33.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 363 |
+
"model.layers.33.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 364 |
+
"model.layers.33.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 365 |
+
"model.layers.33.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 366 |
+
"model.layers.33.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 367 |
+
"model.layers.33.self_attn.o_proj.bias": "model-00003-of-00004.safetensors",
|
| 368 |
+
"model.layers.33.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 369 |
+
"model.layers.33.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 370 |
+
"model.layers.33.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 371 |
+
"model.layers.33.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 372 |
+
"model.layers.33.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 373 |
+
"model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 374 |
+
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 375 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 376 |
+
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 377 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 378 |
+
"model.layers.4.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 379 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 380 |
+
"model.layers.4.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 381 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 382 |
+
"model.layers.4.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 383 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 384 |
+
"model.layers.4.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 385 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 386 |
+
"model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 387 |
+
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 388 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 389 |
+
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 390 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 391 |
+
"model.layers.5.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 392 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 393 |
+
"model.layers.5.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 394 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 395 |
+
"model.layers.5.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 396 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 397 |
+
"model.layers.5.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 398 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 399 |
+
"model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 400 |
+
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 401 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 402 |
+
"model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 403 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 404 |
+
"model.layers.6.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 405 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 406 |
+
"model.layers.6.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 407 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 408 |
+
"model.layers.6.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 409 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 410 |
+
"model.layers.6.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 411 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 412 |
+
"model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 413 |
+
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 414 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 415 |
+
"model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 416 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 417 |
+
"model.layers.7.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 418 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 419 |
+
"model.layers.7.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 420 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 421 |
+
"model.layers.7.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 422 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 423 |
+
"model.layers.7.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 424 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 425 |
+
"model.layers.8.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 426 |
+
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 427 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 428 |
+
"model.layers.8.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 429 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 430 |
+
"model.layers.8.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 431 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 432 |
+
"model.layers.8.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 433 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 434 |
+
"model.layers.8.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 435 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 436 |
+
"model.layers.8.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 437 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 438 |
+
"model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 439 |
+
"model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 440 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 441 |
+
"model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 442 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 443 |
+
"model.layers.9.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 444 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 445 |
+
"model.layers.9.self_attn.o_proj.bias": "model-00001-of-00004.safetensors",
|
| 446 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 447 |
+
"model.layers.9.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 448 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 449 |
+
"model.layers.9.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 450 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 451 |
+
"model.norm.weight": "model-00003-of-00004.safetensors"
|
| 452 |
+
}
|
| 453 |
+
}
|
modeling_openpangu_dense.py
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 2 |
+
# This file was automatically generated from modular_openpangu_dense.py.
|
| 3 |
+
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
| 4 |
+
# the file from the modular. If any change should be done, please apply the change to the
|
| 5 |
+
# modular_openpangu_dense.py file directly. One of our CI enforces this.
|
| 6 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 7 |
+
|
| 8 |
+
# coding=utf-8
|
| 9 |
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
|
| 10 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
| 11 |
+
#
|
| 12 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
| 13 |
+
# and OPT implementations in this library. It has been modified from its
|
| 14 |
+
# original forms to accommodate minor architectural differences compared
|
| 15 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
| 16 |
+
#
|
| 17 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 18 |
+
# you may not use this file except in compliance with the License.
|
| 19 |
+
# You may obtain a copy of the License at
|
| 20 |
+
#
|
| 21 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 22 |
+
#
|
| 23 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 24 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 25 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 26 |
+
# See the License for the specific language governing permissions and
|
| 27 |
+
# limitations under the License.
|
| 28 |
+
|
| 29 |
+
from typing import Callable, Optional, Union
|
| 30 |
+
|
| 31 |
+
import torch
|
| 32 |
+
from torch import nn
|
| 33 |
+
|
| 34 |
+
try:
|
| 35 |
+
import torch_npu
|
| 36 |
+
from torch_npu.contrib import transfer_to_npu
|
| 37 |
+
if "910" in torch.npu.get_device_name():
|
| 38 |
+
NPU_ATTN_INFR = True
|
| 39 |
+
print("[INFO] torch_npu detected. Using NPU fused infer attention.")
|
| 40 |
+
else:
|
| 41 |
+
NPU_ATTN_INFR = False
|
| 42 |
+
except ImportError:
|
| 43 |
+
NPU_ATTN_INFR = False
|
| 44 |
+
|
| 45 |
+
from transformers.activations import ACT2FN
|
| 46 |
+
from transformers.cache_utils import Cache, DynamicCache
|
| 47 |
+
from transformers.generation import GenerationMixin
|
| 48 |
+
from transformers.masking_utils import create_causal_mask
|
| 49 |
+
from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
|
| 50 |
+
from transformers.modeling_layers import GradientCheckpointingLayer
|
| 51 |
+
from transformers.modeling_outputs import (
|
| 52 |
+
BaseModelOutputWithPast,
|
| 53 |
+
CausalLMOutputWithPast,
|
| 54 |
+
SequenceClassifierOutputWithPast,
|
| 55 |
+
)
|
| 56 |
+
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 57 |
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 58 |
+
from transformers.processing_utils import Unpack
|
| 59 |
+
from transformers.utils import LossKwargs, auto_docstring, can_return_tuple, logging
|
| 60 |
+
from .configuration_openpangu_dense import PanguEmbeddedConfig
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
logger = logging.get_logger(__name__)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class PanguEmbeddedRMSNorm(nn.Module):
|
| 67 |
+
def __init__(self, hidden_size, eps=1e-6):
|
| 68 |
+
"""
|
| 69 |
+
PanguEmbeddedRMSNorm is equivalent to T5LayerNorm
|
| 70 |
+
"""
|
| 71 |
+
super().__init__()
|
| 72 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 73 |
+
self.variance_epsilon = eps
|
| 74 |
+
|
| 75 |
+
def forward(self, hidden_states):
|
| 76 |
+
input_dtype = hidden_states.dtype
|
| 77 |
+
hidden_states = hidden_states.to(torch.float32)
|
| 78 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
| 79 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
| 80 |
+
return self.weight * hidden_states.to(input_dtype)
|
| 81 |
+
|
| 82 |
+
def extra_repr(self):
|
| 83 |
+
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class PanguEmbeddedRotaryEmbedding(nn.Module):
|
| 87 |
+
def __init__(self, config: PanguEmbeddedConfig, device=None):
|
| 88 |
+
super().__init__()
|
| 89 |
+
# BC: "rope_type" was originally "type"
|
| 90 |
+
if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
|
| 91 |
+
self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
|
| 92 |
+
else:
|
| 93 |
+
self.rope_type = "default"
|
| 94 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 95 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 96 |
+
|
| 97 |
+
self.config = config
|
| 98 |
+
self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
|
| 99 |
+
|
| 100 |
+
inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
|
| 101 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 102 |
+
self.original_inv_freq = self.inv_freq
|
| 103 |
+
|
| 104 |
+
@torch.no_grad()
|
| 105 |
+
@dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
|
| 106 |
+
def forward(self, x, position_ids):
|
| 107 |
+
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
|
| 108 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
| 109 |
+
|
| 110 |
+
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
| 111 |
+
with torch.autocast(device_type=device_type, enabled=False): # Force float32
|
| 112 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
| 113 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 114 |
+
cos = emb.cos() * self.attention_scaling
|
| 115 |
+
sin = emb.sin() * self.attention_scaling
|
| 116 |
+
|
| 117 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def rotate_half(x):
|
| 121 |
+
"""Rotates half the hidden dims of the input."""
|
| 122 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 123 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 124 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
|
| 128 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 129 |
+
|
| 130 |
+
Args:
|
| 131 |
+
q (`torch.Tensor`): The query tensor.
|
| 132 |
+
k (`torch.Tensor`): The key tensor.
|
| 133 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 134 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 135 |
+
position_ids (`torch.Tensor`, *optional*):
|
| 136 |
+
Deprecated and unused.
|
| 137 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 138 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
| 139 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
| 140 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
| 141 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
| 142 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
| 143 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
| 144 |
+
Returns:
|
| 145 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 146 |
+
"""
|
| 147 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
| 148 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
| 149 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 150 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 151 |
+
return q_embed, k_embed
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
class PanguEmbeddedMLP(nn.Module):
|
| 155 |
+
def __init__(self, config):
|
| 156 |
+
super().__init__()
|
| 157 |
+
self.config = config
|
| 158 |
+
self.hidden_size = config.hidden_size
|
| 159 |
+
self.intermediate_size = config.intermediate_size
|
| 160 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 161 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 162 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 163 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 164 |
+
|
| 165 |
+
def forward(self, x):
|
| 166 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
| 167 |
+
return down_proj
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 171 |
+
"""
|
| 172 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 173 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 174 |
+
"""
|
| 175 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 176 |
+
if n_rep == 1:
|
| 177 |
+
return hidden_states
|
| 178 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 179 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def eager_attention_forward(
|
| 183 |
+
module: nn.Module,
|
| 184 |
+
query: torch.Tensor,
|
| 185 |
+
key: torch.Tensor,
|
| 186 |
+
value: torch.Tensor,
|
| 187 |
+
attention_mask: Optional[torch.Tensor],
|
| 188 |
+
scaling: float,
|
| 189 |
+
dropout: float = 0.0,
|
| 190 |
+
**kwargs,
|
| 191 |
+
):
|
| 192 |
+
key_states = repeat_kv(key, module.num_key_value_groups)
|
| 193 |
+
value_states = repeat_kv(value, module.num_key_value_groups)
|
| 194 |
+
|
| 195 |
+
attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
|
| 196 |
+
if attention_mask is not None:
|
| 197 |
+
causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
|
| 198 |
+
attn_weights = attn_weights + causal_mask
|
| 199 |
+
|
| 200 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
|
| 201 |
+
attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
|
| 202 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 203 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 204 |
+
|
| 205 |
+
return attn_output, attn_weights
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
class PanguEmbeddedAttention(nn.Module):
|
| 209 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
| 210 |
+
|
| 211 |
+
def __init__(self, config: PanguEmbeddedConfig, layer_idx: int):
|
| 212 |
+
super().__init__()
|
| 213 |
+
self.config = config
|
| 214 |
+
self.layer_idx = layer_idx
|
| 215 |
+
self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
|
| 216 |
+
self.num_heads = config.num_attention_heads
|
| 217 |
+
self.num_key_value_heads = config.num_key_value_heads
|
| 218 |
+
self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
|
| 219 |
+
self.scaling = self.head_dim**-0.5
|
| 220 |
+
self.attention_dropout = config.attention_dropout
|
| 221 |
+
self.is_causal = True
|
| 222 |
+
|
| 223 |
+
self.q_proj = nn.Linear(config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.bias)
|
| 224 |
+
self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.bias)
|
| 225 |
+
self.v_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.bias)
|
| 226 |
+
self.o_proj = nn.Linear(config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.bias)
|
| 227 |
+
|
| 228 |
+
def forward(
|
| 229 |
+
self,
|
| 230 |
+
hidden_states: torch.Tensor,
|
| 231 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 232 |
+
attention_mask: Optional[torch.Tensor],
|
| 233 |
+
past_key_value: Optional[Cache] = None,
|
| 234 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 235 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 236 |
+
) -> tuple[torch.Tensor, Optional[torch.Tensor], Optional[tuple[torch.Tensor]]]:
|
| 237 |
+
input_shape = hidden_states.shape[:-1]
|
| 238 |
+
hidden_shape = (*input_shape, -1, self.head_dim)
|
| 239 |
+
|
| 240 |
+
query_states = self.q_proj(hidden_states).view(hidden_shape).transpose(1, 2)
|
| 241 |
+
key_states = self.k_proj(hidden_states).view(hidden_shape).transpose(1, 2)
|
| 242 |
+
value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
|
| 243 |
+
|
| 244 |
+
cos, sin = position_embeddings
|
| 245 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 246 |
+
|
| 247 |
+
if past_key_value is not None:
|
| 248 |
+
# sin and cos are specific to RoPE models; cache_position needed for the static cache
|
| 249 |
+
cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
|
| 250 |
+
key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
| 251 |
+
|
| 252 |
+
attention_interface: Callable = eager_attention_forward
|
| 253 |
+
if self.config._attn_implementation != "eager":
|
| 254 |
+
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
|
| 255 |
+
|
| 256 |
+
if not self.training and NPU_ATTN_INFR:
|
| 257 |
+
q_len = input_shape[1]
|
| 258 |
+
if attention_mask is not None:
|
| 259 |
+
attention_mask = ~attention_mask.bool()
|
| 260 |
+
elif q_len > 1:
|
| 261 |
+
attention_mask = torch.triu(torch.ones([q_len, q_len]), diagonal=1).bool().unsqueeze(0).unsqueeze(0).to(query_states.device)
|
| 262 |
+
|
| 263 |
+
attn_output, _ = torch_npu.npu_fused_infer_attention_score(
|
| 264 |
+
query_states, key_states, value_states,
|
| 265 |
+
num_heads=self.num_heads, num_key_value_heads=self.num_key_value_heads,
|
| 266 |
+
input_layout="BNSD", atten_mask=attention_mask, scale=self.scaling)
|
| 267 |
+
attn_output = attn_output.transpose(1, 2)
|
| 268 |
+
attn_weights = None
|
| 269 |
+
else:
|
| 270 |
+
attn_output, attn_weights = attention_interface(
|
| 271 |
+
self,
|
| 272 |
+
query_states,
|
| 273 |
+
key_states,
|
| 274 |
+
value_states,
|
| 275 |
+
attention_mask,
|
| 276 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 277 |
+
scaling=self.scaling,
|
| 278 |
+
**kwargs,
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
attn_output = attn_output.reshape(*input_shape, -1).contiguous()
|
| 282 |
+
attn_output = self.o_proj(attn_output)
|
| 283 |
+
return attn_output, attn_weights
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
class PanguEmbeddedDecoderLayer(GradientCheckpointingLayer):
|
| 287 |
+
def __init__(self, config: PanguEmbeddedConfig, layer_idx: int):
|
| 288 |
+
super().__init__()
|
| 289 |
+
self.hidden_size = config.hidden_size
|
| 290 |
+
self.self_attn = PanguEmbeddedAttention(config=config, layer_idx=layer_idx)
|
| 291 |
+
self.mlp = PanguEmbeddedMLP(config)
|
| 292 |
+
self.input_layernorm = PanguEmbeddedRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 293 |
+
self.post_attention_layernorm = PanguEmbeddedRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 294 |
+
|
| 295 |
+
def forward(
|
| 296 |
+
self,
|
| 297 |
+
hidden_states: torch.Tensor,
|
| 298 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 299 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 300 |
+
past_key_value: Optional[Cache] = None,
|
| 301 |
+
output_attentions: Optional[bool] = False,
|
| 302 |
+
use_cache: Optional[bool] = False,
|
| 303 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 304 |
+
position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
|
| 305 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 306 |
+
) -> tuple[torch.FloatTensor, Optional[tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
| 307 |
+
residual = hidden_states
|
| 308 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 309 |
+
|
| 310 |
+
# Self Attention
|
| 311 |
+
hidden_states, self_attn_weights = self.self_attn(
|
| 312 |
+
hidden_states=hidden_states,
|
| 313 |
+
attention_mask=attention_mask,
|
| 314 |
+
position_ids=position_ids,
|
| 315 |
+
past_key_value=past_key_value,
|
| 316 |
+
output_attentions=output_attentions,
|
| 317 |
+
use_cache=use_cache,
|
| 318 |
+
cache_position=cache_position,
|
| 319 |
+
position_embeddings=position_embeddings,
|
| 320 |
+
**kwargs,
|
| 321 |
+
)
|
| 322 |
+
hidden_states = residual + hidden_states
|
| 323 |
+
|
| 324 |
+
# Fully Connected
|
| 325 |
+
residual = hidden_states
|
| 326 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 327 |
+
hidden_states = self.mlp(hidden_states)
|
| 328 |
+
hidden_states = residual + hidden_states
|
| 329 |
+
|
| 330 |
+
outputs = (hidden_states,)
|
| 331 |
+
if output_attentions:
|
| 332 |
+
outputs += (self_attn_weights,)
|
| 333 |
+
|
| 334 |
+
return outputs
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
@auto_docstring
|
| 338 |
+
class PanguEmbeddedPreTrainedModel(PreTrainedModel):
|
| 339 |
+
config_class = PanguEmbeddedConfig
|
| 340 |
+
base_model_prefix = "model"
|
| 341 |
+
supports_gradient_checkpointing = True
|
| 342 |
+
_no_split_modules = ["PanguEmbeddedDecoderLayer"]
|
| 343 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 344 |
+
_supports_flash_attn_3 = True
|
| 345 |
+
_supports_flash_attn_2 = True
|
| 346 |
+
_supports_sdpa = True
|
| 347 |
+
_supports_flex_attn = True
|
| 348 |
+
_supports_cache_class = True
|
| 349 |
+
_supports_quantized_cache = True
|
| 350 |
+
_supports_static_cache = True
|
| 351 |
+
_supports_attention_backend = True
|
| 352 |
+
|
| 353 |
+
def _init_weights(self, module):
|
| 354 |
+
std = self.config.initializer_range
|
| 355 |
+
if isinstance(module, nn.Linear):
|
| 356 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
| 357 |
+
if module.bias is not None:
|
| 358 |
+
module.bias.data.zero_()
|
| 359 |
+
elif isinstance(module, nn.Embedding):
|
| 360 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
| 361 |
+
if module.padding_idx is not None:
|
| 362 |
+
module.weight.data[module.padding_idx].zero_()
|
| 363 |
+
elif isinstance(module, PanguEmbeddedRMSNorm):
|
| 364 |
+
module.weight.data.fill_(1.0)
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
@auto_docstring
|
| 368 |
+
class PanguEmbeddedModel(PanguEmbeddedPreTrainedModel):
|
| 369 |
+
def __init__(self, config: PanguEmbeddedConfig):
|
| 370 |
+
super().__init__(config)
|
| 371 |
+
self.padding_idx = config.pad_token_id
|
| 372 |
+
self.vocab_size = config.vocab_size
|
| 373 |
+
|
| 374 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 375 |
+
self.layers = nn.ModuleList(
|
| 376 |
+
[PanguEmbeddedDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 377 |
+
)
|
| 378 |
+
self.norm = PanguEmbeddedRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 379 |
+
self.rotary_emb = PanguEmbeddedRotaryEmbedding(config=config)
|
| 380 |
+
self.gradient_checkpointing = False
|
| 381 |
+
|
| 382 |
+
# Initialize weights and apply final processing
|
| 383 |
+
self.post_init()
|
| 384 |
+
|
| 385 |
+
def get_input_embeddings(self):
|
| 386 |
+
return self.embed_tokens
|
| 387 |
+
|
| 388 |
+
def set_input_embeddings(self, value):
|
| 389 |
+
self.embed_tokens = value
|
| 390 |
+
|
| 391 |
+
@can_return_tuple
|
| 392 |
+
@auto_docstring
|
| 393 |
+
def forward(
|
| 394 |
+
self,
|
| 395 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 396 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 397 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 398 |
+
past_key_values: Optional[Cache] = None,
|
| 399 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 400 |
+
use_cache: Optional[bool] = None,
|
| 401 |
+
output_attentions: Optional[bool] = None,
|
| 402 |
+
output_hidden_states: Optional[bool] = None,
|
| 403 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 404 |
+
**flash_attn_kwargs: Unpack[FlashAttentionKwargs],
|
| 405 |
+
) -> BaseModelOutputWithPast:
|
| 406 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 407 |
+
output_hidden_states = (
|
| 408 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 409 |
+
)
|
| 410 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 411 |
+
|
| 412 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 413 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 414 |
+
|
| 415 |
+
if self.gradient_checkpointing and self.training and use_cache:
|
| 416 |
+
logger.warning_once(
|
| 417 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
|
| 418 |
+
)
|
| 419 |
+
use_cache = False
|
| 420 |
+
|
| 421 |
+
# TODO (joao): remove this exception in v4.56 -- it exists for users that try to pass a legacy cache
|
| 422 |
+
if not isinstance(past_key_values, (type(None), Cache)):
|
| 423 |
+
raise ValueError("The `past_key_values` should be either a `Cache` object or `None`.")
|
| 424 |
+
|
| 425 |
+
if inputs_embeds is None:
|
| 426 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 427 |
+
|
| 428 |
+
if use_cache and past_key_values is None:
|
| 429 |
+
past_key_values = DynamicCache()
|
| 430 |
+
|
| 431 |
+
if cache_position is None:
|
| 432 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 433 |
+
cache_position = torch.arange(
|
| 434 |
+
past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
|
| 435 |
+
)
|
| 436 |
+
|
| 437 |
+
if position_ids is None:
|
| 438 |
+
position_ids = cache_position.unsqueeze(0)
|
| 439 |
+
|
| 440 |
+
causal_mask = create_causal_mask(
|
| 441 |
+
config=self.config,
|
| 442 |
+
input_embeds=inputs_embeds,
|
| 443 |
+
attention_mask=attention_mask,
|
| 444 |
+
cache_position=cache_position,
|
| 445 |
+
past_key_values=past_key_values,
|
| 446 |
+
position_ids=position_ids,
|
| 447 |
+
)
|
| 448 |
+
|
| 449 |
+
hidden_states = inputs_embeds
|
| 450 |
+
|
| 451 |
+
# create position embeddings to be shared across the decoder layers
|
| 452 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 453 |
+
|
| 454 |
+
# decoder layers
|
| 455 |
+
all_hidden_states = () if output_hidden_states else None
|
| 456 |
+
all_self_attns = () if output_attentions else None
|
| 457 |
+
|
| 458 |
+
for decoder_layer in self.layers[: self.config.num_hidden_layers]:
|
| 459 |
+
if output_hidden_states:
|
| 460 |
+
all_hidden_states += (hidden_states,)
|
| 461 |
+
|
| 462 |
+
layer_outputs = decoder_layer(
|
| 463 |
+
hidden_states,
|
| 464 |
+
attention_mask=causal_mask,
|
| 465 |
+
position_ids=position_ids,
|
| 466 |
+
past_key_value=past_key_values,
|
| 467 |
+
output_attentions=output_attentions,
|
| 468 |
+
use_cache=use_cache,
|
| 469 |
+
cache_position=cache_position,
|
| 470 |
+
position_embeddings=position_embeddings,
|
| 471 |
+
**flash_attn_kwargs,
|
| 472 |
+
)
|
| 473 |
+
|
| 474 |
+
hidden_states = layer_outputs[0]
|
| 475 |
+
|
| 476 |
+
if output_attentions:
|
| 477 |
+
all_self_attns += (layer_outputs[1],)
|
| 478 |
+
|
| 479 |
+
hidden_states = self.norm(hidden_states)
|
| 480 |
+
|
| 481 |
+
# add hidden states from the last decoder layer
|
| 482 |
+
if output_hidden_states:
|
| 483 |
+
all_hidden_states += (hidden_states,)
|
| 484 |
+
|
| 485 |
+
return BaseModelOutputWithPast(
|
| 486 |
+
last_hidden_state=hidden_states,
|
| 487 |
+
past_key_values=past_key_values if use_cache else None,
|
| 488 |
+
hidden_states=all_hidden_states,
|
| 489 |
+
attentions=all_self_attns,
|
| 490 |
+
)
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs): ...
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
@auto_docstring
|
| 497 |
+
class PanguEmbeddedForCausalLM(PanguEmbeddedPreTrainedModel, GenerationMixin):
|
| 498 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 499 |
+
_tp_plan = {"lm_head": "colwise_rep"}
|
| 500 |
+
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
|
| 501 |
+
|
| 502 |
+
def __init__(self, config):
|
| 503 |
+
super().__init__(config)
|
| 504 |
+
self.model = PanguEmbeddedModel(config)
|
| 505 |
+
self.vocab_size = config.vocab_size
|
| 506 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 507 |
+
|
| 508 |
+
# Initialize weights and apply final processing
|
| 509 |
+
self.post_init()
|
| 510 |
+
|
| 511 |
+
def get_input_embeddings(self):
|
| 512 |
+
return self.model.embed_tokens
|
| 513 |
+
|
| 514 |
+
def set_input_embeddings(self, value):
|
| 515 |
+
self.model.embed_tokens = value
|
| 516 |
+
|
| 517 |
+
def get_output_embeddings(self):
|
| 518 |
+
return self.lm_head
|
| 519 |
+
|
| 520 |
+
def set_output_embeddings(self, new_embeddings):
|
| 521 |
+
self.lm_head = new_embeddings
|
| 522 |
+
|
| 523 |
+
def set_decoder(self, decoder):
|
| 524 |
+
self.model = decoder
|
| 525 |
+
|
| 526 |
+
def get_decoder(self):
|
| 527 |
+
return self.model
|
| 528 |
+
|
| 529 |
+
@can_return_tuple
|
| 530 |
+
@auto_docstring
|
| 531 |
+
def forward(
|
| 532 |
+
self,
|
| 533 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 534 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 535 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 536 |
+
past_key_values: Optional[Cache] = None,
|
| 537 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 538 |
+
labels: Optional[torch.LongTensor] = None,
|
| 539 |
+
use_cache: Optional[bool] = None,
|
| 540 |
+
output_attentions: Optional[bool] = None,
|
| 541 |
+
output_hidden_states: Optional[bool] = None,
|
| 542 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 543 |
+
logits_to_keep: Union[int, torch.Tensor] = 0,
|
| 544 |
+
**kwargs: Unpack[KwargsForCausalLM],
|
| 545 |
+
) -> CausalLMOutputWithPast:
|
| 546 |
+
|
| 547 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 548 |
+
output_hidden_states = (
|
| 549 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 550 |
+
)
|
| 551 |
+
|
| 552 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
| 553 |
+
outputs: BaseModelOutputWithPast = self.model(
|
| 554 |
+
input_ids=input_ids,
|
| 555 |
+
attention_mask=attention_mask,
|
| 556 |
+
position_ids=position_ids,
|
| 557 |
+
past_key_values=past_key_values,
|
| 558 |
+
inputs_embeds=inputs_embeds,
|
| 559 |
+
use_cache=use_cache,
|
| 560 |
+
output_attentions=output_attentions,
|
| 561 |
+
output_hidden_states=output_hidden_states,
|
| 562 |
+
cache_position=cache_position,
|
| 563 |
+
**kwargs,
|
| 564 |
+
)
|
| 565 |
+
|
| 566 |
+
hidden_states = outputs.last_hidden_state
|
| 567 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 568 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 569 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 570 |
+
|
| 571 |
+
loss = None
|
| 572 |
+
if labels is not None:
|
| 573 |
+
loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
|
| 574 |
+
|
| 575 |
+
return CausalLMOutputWithPast(
|
| 576 |
+
loss=loss,
|
| 577 |
+
logits=logits,
|
| 578 |
+
past_key_values=outputs.past_key_values,
|
| 579 |
+
hidden_states=outputs.hidden_states,
|
| 580 |
+
attentions=outputs.attentions,
|
| 581 |
+
)
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
__all__ = [
|
| 585 |
+
"PanguEmbeddedForCausalLM",
|
| 586 |
+
"PanguEmbeddedModel",
|
| 587 |
+
"PanguEmbeddedPreTrainedModel",
|
| 588 |
+
]
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "[unused10]",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenization_openpangu.py
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
|
| 3 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
| 4 |
+
#
|
| 5 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
| 6 |
+
# and OPT implementations in this library. It has been modified from its
|
| 7 |
+
# original forms to accommodate minor architectural differences compared
|
| 8 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
| 9 |
+
#
|
| 10 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 11 |
+
# you may not use this file except in compliance with the License.
|
| 12 |
+
# You may obtain a copy of the License at
|
| 13 |
+
#
|
| 14 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 15 |
+
#
|
| 16 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 17 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 18 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 19 |
+
# See the License for the specific language governing permissions and
|
| 20 |
+
# limitations under the License.
|
| 21 |
+
|
| 22 |
+
import os
|
| 23 |
+
from shutil import copyfile
|
| 24 |
+
from typing import Any, Dict, List, Optional, Tuple
|
| 25 |
+
|
| 26 |
+
import sentencepiece as spm
|
| 27 |
+
|
| 28 |
+
from transformers.tokenization_utils import PreTrainedTokenizer
|
| 29 |
+
from transformers.utils import logging
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
logger = logging.get_logger(__name__)
|
| 33 |
+
|
| 34 |
+
VOCAB_FILES_NAMES = {"vocab_file": "./tokenizer.model"}
|
| 35 |
+
|
| 36 |
+
PRETRAINED_VOCAB_FILES_MAP = {}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def convert_bool(string):
|
| 40 |
+
if isinstance(string, str):
|
| 41 |
+
if string.lower() == "true":
|
| 42 |
+
return True
|
| 43 |
+
elif string.lower() == "false":
|
| 44 |
+
return False
|
| 45 |
+
else:
|
| 46 |
+
return string
|
| 47 |
+
else:
|
| 48 |
+
return string
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class PanguTokenizer(PreTrainedTokenizer):
|
| 52 |
+
"""
|
| 53 |
+
Construct a tokenizer. Based on byte-level Byte-Pair-Encoding.
|
| 54 |
+
|
| 55 |
+
Args:
|
| 56 |
+
vocab_file (`str`):
|
| 57 |
+
Path to the vocabulary file.
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
vocab_files_names = VOCAB_FILES_NAMES
|
| 61 |
+
pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
|
| 62 |
+
model_input_names = ["input_ids", "attention_mask"]
|
| 63 |
+
_auto_class = "AutoTokenizer"
|
| 64 |
+
|
| 65 |
+
def __init__(
|
| 66 |
+
self,
|
| 67 |
+
vocab_file,
|
| 68 |
+
unk_token="<unk>",
|
| 69 |
+
bos_token="<s>",
|
| 70 |
+
eos_token="</s>",
|
| 71 |
+
pad_token="</s>",
|
| 72 |
+
sp_model_kwargs: Optional[Dict[str, Any]] = None,
|
| 73 |
+
add_bos_token=True,
|
| 74 |
+
add_eos_token=False,
|
| 75 |
+
decode_with_prefix_space=False,
|
| 76 |
+
clean_up_tokenization_spaces=False,
|
| 77 |
+
**kwargs,
|
| 78 |
+
):
|
| 79 |
+
self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
|
| 80 |
+
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
| 81 |
+
self.sp_model.Load(vocab_file)
|
| 82 |
+
super().__init__(
|
| 83 |
+
bos_token=bos_token,
|
| 84 |
+
eos_token=eos_token,
|
| 85 |
+
unk_token=unk_token,
|
| 86 |
+
pad_token=pad_token,
|
| 87 |
+
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
| 88 |
+
**kwargs,
|
| 89 |
+
)
|
| 90 |
+
self.vocab_file = vocab_file
|
| 91 |
+
self.add_bos_token = convert_bool(add_bos_token)
|
| 92 |
+
self.add_eos_token = add_eos_token
|
| 93 |
+
self.decode_with_prefix_space = decode_with_prefix_space
|
| 94 |
+
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
| 95 |
+
self.sp_model.Load(vocab_file)
|
| 96 |
+
self._no_prefix_space_tokens = None
|
| 97 |
+
|
| 98 |
+
""" Initialisation"""
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def no_prefix_space_tokens(self):
|
| 102 |
+
if self._no_prefix_space_tokens is None:
|
| 103 |
+
vocab = self.convert_ids_to_tokens(list(range(self.vocab_size)))
|
| 104 |
+
self._no_prefix_space_tokens = {i for i, tok in enumerate(vocab) if not tok.startswith("▁")}
|
| 105 |
+
return self._no_prefix_space_tokens
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def vocab_size(self):
|
| 109 |
+
"""Returns vocab size"""
|
| 110 |
+
return self.sp_model.get_piece_size()
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def bos_token_id(self) -> Optional[int]:
|
| 114 |
+
return self.sp_model.bos_id()
|
| 115 |
+
|
| 116 |
+
@property
|
| 117 |
+
def eos_token_id(self) -> Optional[int]:
|
| 118 |
+
return super().eos_token_id
|
| 119 |
+
|
| 120 |
+
def get_vocab(self):
|
| 121 |
+
"""Returns vocab as a dict"""
|
| 122 |
+
vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
|
| 123 |
+
vocab.update(self.added_tokens_encoder)
|
| 124 |
+
return vocab
|
| 125 |
+
|
| 126 |
+
def _tokenize(self, text):
|
| 127 |
+
"""Returns a tokenized string."""
|
| 128 |
+
return self.sp_model.encode(text, out_type=str)
|
| 129 |
+
|
| 130 |
+
def _convert_token_to_id(self, token):
|
| 131 |
+
"""Converts a token (str) in an id using the vocab."""
|
| 132 |
+
return self.sp_model.piece_to_id(token)
|
| 133 |
+
|
| 134 |
+
def _convert_id_to_token(self, index):
|
| 135 |
+
"""Converts an index (integer) in a token (str) using the vocab."""
|
| 136 |
+
token = self.sp_model.IdToPiece(index)
|
| 137 |
+
return token
|
| 138 |
+
|
| 139 |
+
def _maybe_add_prefix_space(self, tokens, decoded):
|
| 140 |
+
if tokens and tokens[0] not in self.no_prefix_space_tokens:
|
| 141 |
+
return " " + decoded
|
| 142 |
+
else:
|
| 143 |
+
return decoded
|
| 144 |
+
|
| 145 |
+
def convert_tokens_to_string(self, tokens):
|
| 146 |
+
"""Converts a sequence of tokens (string) in a single string."""
|
| 147 |
+
current_sub_tokens = []
|
| 148 |
+
out_string = ""
|
| 149 |
+
prev_is_special = False
|
| 150 |
+
for token in tokens:
|
| 151 |
+
# make sure that special tokens are not decoded using sentencepiece model
|
| 152 |
+
if token in self.all_special_tokens:
|
| 153 |
+
# Decode the current sub-tokens first
|
| 154 |
+
if current_sub_tokens:
|
| 155 |
+
out_string += self.sp_model.decode(current_sub_tokens)
|
| 156 |
+
current_sub_tokens = []
|
| 157 |
+
# Append the special token without adding extra spaces
|
| 158 |
+
out_string += token
|
| 159 |
+
prev_is_special = True
|
| 160 |
+
else:
|
| 161 |
+
current_sub_tokens.append(token)
|
| 162 |
+
prev_is_special = False
|
| 163 |
+
# Decode any remaining sub-tokens
|
| 164 |
+
if current_sub_tokens:
|
| 165 |
+
out_string += self.sp_model.decode(current_sub_tokens)
|
| 166 |
+
# Clean up leading and trailing spaces
|
| 167 |
+
if self.clean_up_tokenization_spaces:
|
| 168 |
+
out_string = self.clean_up_tokenization(out_string)
|
| 169 |
+
out_string = self._maybe_add_prefix_space(tokens=tokens, decoded=out_string)
|
| 170 |
+
return out_string[1:]
|
| 171 |
+
|
| 172 |
+
# Override decode to set spaces_between_special_tokens to True as default
|
| 173 |
+
def decode(self,
|
| 174 |
+
token_ids,
|
| 175 |
+
spaces_between_special_tokens: bool = False,
|
| 176 |
+
**kwargs):
|
| 177 |
+
return super().decode(
|
| 178 |
+
token_ids=token_ids,
|
| 179 |
+
spaces_between_special_tokens=spaces_between_special_tokens,
|
| 180 |
+
**kwargs,
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]:
|
| 184 |
+
"""
|
| 185 |
+
Save the vocabulary and special tokens file to a directory.
|
| 186 |
+
|
| 187 |
+
Args:
|
| 188 |
+
save_directory (`str`):
|
| 189 |
+
The directory in which to save the vocabulary.
|
| 190 |
+
|
| 191 |
+
Returns:
|
| 192 |
+
`Tuple(str)`: Paths to the files saved.
|
| 193 |
+
"""
|
| 194 |
+
if not os.path.isdir(save_directory):
|
| 195 |
+
logger.error(f"Vocabulary path ({save_directory}) should be a directory")
|
| 196 |
+
return ("",)
|
| 197 |
+
out_vocab_file = os.path.join(
|
| 198 |
+
save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file):
|
| 202 |
+
copyfile(self.vocab_file, out_vocab_file)
|
| 203 |
+
elif not os.path.isfile(self.vocab_file):
|
| 204 |
+
with open(out_vocab_file, "wb") as fi:
|
| 205 |
+
content_spiece_model = self.sp_model.serialized_model_proto()
|
| 206 |
+
fi.write(content_spiece_model)
|
| 207 |
+
|
| 208 |
+
return (out_vocab_file,)
|
| 209 |
+
|
| 210 |
+
def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
|
| 211 |
+
if self.add_bos_token:
|
| 212 |
+
bos_token_ids = [self.bos_token_id]
|
| 213 |
+
else:
|
| 214 |
+
bos_token_ids = []
|
| 215 |
+
|
| 216 |
+
output = bos_token_ids + token_ids_0
|
| 217 |
+
|
| 218 |
+
if token_ids_1 is not None:
|
| 219 |
+
output = output + token_ids_1
|
| 220 |
+
|
| 221 |
+
if self.add_eos_token:
|
| 222 |
+
output = output + [self.eos_token_id]
|
| 223 |
+
|
| 224 |
+
return output
|
| 225 |
+
|
| 226 |
+
def get_special_tokens_mask(
|
| 227 |
+
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False
|
| 228 |
+
) -> List[int]:
|
| 229 |
+
"""
|
| 230 |
+
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
|
| 231 |
+
special tokens using the tokenizer `prepare_for_model` method.
|
| 232 |
+
|
| 233 |
+
Args:
|
| 234 |
+
token_ids_0 (`List[int]`):
|
| 235 |
+
List of IDs.
|
| 236 |
+
token_ids_1 (`List[int]`, *optional*):
|
| 237 |
+
Optional second list of IDs for sequence pairs.
|
| 238 |
+
already_has_special_tokens (`bool`, *optional*, defaults to `False`):
|
| 239 |
+
Whether or not the token list is already formatted with special tokens for the model.
|
| 240 |
+
|
| 241 |
+
Returns:
|
| 242 |
+
`List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
|
| 243 |
+
"""
|
| 244 |
+
if already_has_special_tokens:
|
| 245 |
+
return super().get_special_tokens_mask(
|
| 246 |
+
token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
if token_ids_1 is None:
|
| 250 |
+
return [1] + ([0] * len(token_ids_0)) + [1]
|
| 251 |
+
return [1] + ([0] * len(token_ids_0)) + [1, 1] + ([0] * len(token_ids_1)) + [1]
|
| 252 |
+
|
| 253 |
+
def create_token_type_ids_from_sequences(
|
| 254 |
+
self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
|
| 255 |
+
) -> List[int]:
|
| 256 |
+
"""
|
| 257 |
+
Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make
|
| 258 |
+
use of token type ids, therefore a list of zeros is returned.
|
| 259 |
+
|
| 260 |
+
Args:
|
| 261 |
+
token_ids_0 (`List[int]`):
|
| 262 |
+
List of IDs.
|
| 263 |
+
token_ids_1 (`List[int]`, *optional*):
|
| 264 |
+
Optional second list of IDs for sequence pairs.
|
| 265 |
+
|
| 266 |
+
Returns:
|
| 267 |
+
`List[int]`: List of zeros.
|
| 268 |
+
"""
|
| 269 |
+
eos = [self.eos_token_id]
|
| 270 |
+
|
| 271 |
+
if token_ids_1 is None:
|
| 272 |
+
return len(token_ids_0 + eos) * [0]
|
| 273 |
+
return len(token_ids_0 + eos + token_ids_1 + eos) * [0]
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b16f1558c0cd4ae6ef1a2c605713be0a514f50e1ce2d2c878979ce988c148ec
|
| 3 |
+
size 2477809
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"1": {
|
| 13 |
+
"content": "<s>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"2": {
|
| 21 |
+
"content": "</s>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"45806": {
|
| 29 |
+
"content": "<|User|>:",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"45813": {
|
| 37 |
+
"content": "<|Bot|>:",
|
| 38 |
+
"lstrip": false,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
},
|
| 44 |
+
"45830": {
|
| 45 |
+
"content": "[unused0]",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false,
|
| 50 |
+
"special": true
|
| 51 |
+
},
|
| 52 |
+
"45840": {
|
| 53 |
+
"content": "[unused1]",
|
| 54 |
+
"lstrip": false,
|
| 55 |
+
"normalized": false,
|
| 56 |
+
"rstrip": false,
|
| 57 |
+
"single_word": false,
|
| 58 |
+
"special": true
|
| 59 |
+
},
|
| 60 |
+
"45846": {
|
| 61 |
+
"content": "[unused2]",
|
| 62 |
+
"lstrip": false,
|
| 63 |
+
"normalized": false,
|
| 64 |
+
"rstrip": false,
|
| 65 |
+
"single_word": false,
|
| 66 |
+
"special": true
|
| 67 |
+
},
|
| 68 |
+
"45849": {
|
| 69 |
+
"content": "[unused3]",
|
| 70 |
+
"lstrip": false,
|
| 71 |
+
"normalized": false,
|
| 72 |
+
"rstrip": false,
|
| 73 |
+
"single_word": false,
|
| 74 |
+
"special": true
|
| 75 |
+
},
|
| 76 |
+
"45861": {
|
| 77 |
+
"content": "[unused4]",
|
| 78 |
+
"lstrip": false,
|
| 79 |
+
"normalized": false,
|
| 80 |
+
"rstrip": false,
|
| 81 |
+
"single_word": false,
|
| 82 |
+
"special": true
|
| 83 |
+
},
|
| 84 |
+
"45866": {
|
| 85 |
+
"content": "[unused5]",
|
| 86 |
+
"lstrip": false,
|
| 87 |
+
"normalized": false,
|
| 88 |
+
"rstrip": false,
|
| 89 |
+
"single_word": false,
|
| 90 |
+
"special": true
|
| 91 |
+
},
|
| 92 |
+
"45874": {
|
| 93 |
+
"content": "[unused6]",
|
| 94 |
+
"lstrip": false,
|
| 95 |
+
"normalized": false,
|
| 96 |
+
"rstrip": false,
|
| 97 |
+
"single_word": false,
|
| 98 |
+
"special": true
|
| 99 |
+
},
|
| 100 |
+
"45883": {
|
| 101 |
+
"content": "[unused7]",
|
| 102 |
+
"lstrip": false,
|
| 103 |
+
"normalized": false,
|
| 104 |
+
"rstrip": false,
|
| 105 |
+
"single_word": false,
|
| 106 |
+
"special": true
|
| 107 |
+
},
|
| 108 |
+
"45884": {
|
| 109 |
+
"content": "[unused8]",
|
| 110 |
+
"lstrip": false,
|
| 111 |
+
"normalized": false,
|
| 112 |
+
"rstrip": false,
|
| 113 |
+
"single_word": false,
|
| 114 |
+
"special": true
|
| 115 |
+
},
|
| 116 |
+
"45887": {
|
| 117 |
+
"content": "[unused9]",
|
| 118 |
+
"lstrip": false,
|
| 119 |
+
"normalized": false,
|
| 120 |
+
"rstrip": false,
|
| 121 |
+
"single_word": false,
|
| 122 |
+
"special": true
|
| 123 |
+
},
|
| 124 |
+
"45892": {
|
| 125 |
+
"content": "[unused10]",
|
| 126 |
+
"lstrip": false,
|
| 127 |
+
"normalized": false,
|
| 128 |
+
"rstrip": false,
|
| 129 |
+
"single_word": false,
|
| 130 |
+
"special": true
|
| 131 |
+
},
|
| 132 |
+
"45920": {
|
| 133 |
+
"content": "[unused11]",
|
| 134 |
+
"lstrip": false,
|
| 135 |
+
"normalized": false,
|
| 136 |
+
"rstrip": false,
|
| 137 |
+
"single_word": false,
|
| 138 |
+
"special": true
|
| 139 |
+
},
|
| 140 |
+
"45932": {
|
| 141 |
+
"content": "[unused12]",
|
| 142 |
+
"lstrip": false,
|
| 143 |
+
"normalized": false,
|
| 144 |
+
"rstrip": false,
|
| 145 |
+
"single_word": false,
|
| 146 |
+
"special": true
|
| 147 |
+
},
|
| 148 |
+
"45938": {
|
| 149 |
+
"content": "[unused13]",
|
| 150 |
+
"lstrip": false,
|
| 151 |
+
"normalized": false,
|
| 152 |
+
"rstrip": false,
|
| 153 |
+
"single_word": false,
|
| 154 |
+
"special": true
|
| 155 |
+
},
|
| 156 |
+
"45953": {
|
| 157 |
+
"content": "[unused14]",
|
| 158 |
+
"lstrip": false,
|
| 159 |
+
"normalized": false,
|
| 160 |
+
"rstrip": false,
|
| 161 |
+
"single_word": false,
|
| 162 |
+
"special": true
|
| 163 |
+
},
|
| 164 |
+
"45968": {
|
| 165 |
+
"content": "[unused15]",
|
| 166 |
+
"lstrip": false,
|
| 167 |
+
"normalized": false,
|
| 168 |
+
"rstrip": false,
|
| 169 |
+
"single_word": false,
|
| 170 |
+
"special": true
|
| 171 |
+
},
|
| 172 |
+
"45974": {
|
| 173 |
+
"content": "<think>",
|
| 174 |
+
"lstrip": false,
|
| 175 |
+
"normalized": false,
|
| 176 |
+
"rstrip": false,
|
| 177 |
+
"single_word": false,
|
| 178 |
+
"special": true
|
| 179 |
+
},
|
| 180 |
+
"45982": {
|
| 181 |
+
"content": "</think>",
|
| 182 |
+
"lstrip": false,
|
| 183 |
+
"normalized": false,
|
| 184 |
+
"rstrip": false,
|
| 185 |
+
"single_word": false,
|
| 186 |
+
"special": true
|
| 187 |
+
},
|
| 188 |
+
"45986": {
|
| 189 |
+
"content": "[unused18]",
|
| 190 |
+
"lstrip": false,
|
| 191 |
+
"normalized": false,
|
| 192 |
+
"rstrip": false,
|
| 193 |
+
"single_word": false,
|
| 194 |
+
"special": true
|
| 195 |
+
},
|
| 196 |
+
"46005": {
|
| 197 |
+
"content": "[unused19]",
|
| 198 |
+
"lstrip": false,
|
| 199 |
+
"normalized": false,
|
| 200 |
+
"rstrip": false,
|
| 201 |
+
"single_word": false,
|
| 202 |
+
"special": true
|
| 203 |
+
},
|
| 204 |
+
"46007": {
|
| 205 |
+
"content": "[unused20]",
|
| 206 |
+
"lstrip": false,
|
| 207 |
+
"normalized": false,
|
| 208 |
+
"rstrip": false,
|
| 209 |
+
"single_word": false,
|
| 210 |
+
"special": true
|
| 211 |
+
},
|
| 212 |
+
"46014": {
|
| 213 |
+
"content": "[unused21]",
|
| 214 |
+
"lstrip": false,
|
| 215 |
+
"normalized": false,
|
| 216 |
+
"rstrip": false,
|
| 217 |
+
"single_word": false,
|
| 218 |
+
"special": true
|
| 219 |
+
},
|
| 220 |
+
"46017": {
|
| 221 |
+
"content": "[unused22]",
|
| 222 |
+
"lstrip": false,
|
| 223 |
+
"normalized": false,
|
| 224 |
+
"rstrip": false,
|
| 225 |
+
"single_word": false,
|
| 226 |
+
"special": true
|
| 227 |
+
},
|
| 228 |
+
"46028": {
|
| 229 |
+
"content": "[unused23]",
|
| 230 |
+
"lstrip": false,
|
| 231 |
+
"normalized": false,
|
| 232 |
+
"rstrip": false,
|
| 233 |
+
"single_word": false,
|
| 234 |
+
"special": true
|
| 235 |
+
},
|
| 236 |
+
"46032": {
|
| 237 |
+
"content": "[unused24]",
|
| 238 |
+
"lstrip": false,
|
| 239 |
+
"normalized": false,
|
| 240 |
+
"rstrip": false,
|
| 241 |
+
"single_word": false,
|
| 242 |
+
"special": true
|
| 243 |
+
},
|
| 244 |
+
"46081": {
|
| 245 |
+
"content": "[unused25]",
|
| 246 |
+
"lstrip": false,
|
| 247 |
+
"normalized": false,
|
| 248 |
+
"rstrip": false,
|
| 249 |
+
"single_word": false,
|
| 250 |
+
"special": true
|
| 251 |
+
},
|
| 252 |
+
"46086": {
|
| 253 |
+
"content": "[unused26]",
|
| 254 |
+
"lstrip": false,
|
| 255 |
+
"normalized": false,
|
| 256 |
+
"rstrip": false,
|
| 257 |
+
"single_word": false,
|
| 258 |
+
"special": true
|
| 259 |
+
},
|
| 260 |
+
"46101": {
|
| 261 |
+
"content": "[unused27]",
|
| 262 |
+
"lstrip": false,
|
| 263 |
+
"normalized": false,
|
| 264 |
+
"rstrip": false,
|
| 265 |
+
"single_word": false,
|
| 266 |
+
"special": true
|
| 267 |
+
},
|
| 268 |
+
"46183": {
|
| 269 |
+
"content": "[unused28]",
|
| 270 |
+
"lstrip": false,
|
| 271 |
+
"normalized": false,
|
| 272 |
+
"rstrip": false,
|
| 273 |
+
"single_word": false,
|
| 274 |
+
"special": true
|
| 275 |
+
},
|
| 276 |
+
"46230": {
|
| 277 |
+
"content": "[unused29]",
|
| 278 |
+
"lstrip": false,
|
| 279 |
+
"normalized": false,
|
| 280 |
+
"rstrip": false,
|
| 281 |
+
"single_word": false,
|
| 282 |
+
"special": true
|
| 283 |
+
},
|
| 284 |
+
"46245": {
|
| 285 |
+
"content": "[unused30]",
|
| 286 |
+
"lstrip": false,
|
| 287 |
+
"normalized": false,
|
| 288 |
+
"rstrip": false,
|
| 289 |
+
"single_word": false,
|
| 290 |
+
"special": true
|
| 291 |
+
},
|
| 292 |
+
"46257": {
|
| 293 |
+
"content": "[unused31]",
|
| 294 |
+
"lstrip": false,
|
| 295 |
+
"normalized": false,
|
| 296 |
+
"rstrip": false,
|
| 297 |
+
"single_word": false,
|
| 298 |
+
"special": true
|
| 299 |
+
},
|
| 300 |
+
"144208": {
|
| 301 |
+
"content": "<mask>",
|
| 302 |
+
"lstrip": false,
|
| 303 |
+
"normalized": false,
|
| 304 |
+
"rstrip": false,
|
| 305 |
+
"single_word": false,
|
| 306 |
+
"special": true
|
| 307 |
+
},
|
| 308 |
+
"144209": {
|
| 309 |
+
"content": "[unused33]",
|
| 310 |
+
"lstrip": false,
|
| 311 |
+
"normalized": false,
|
| 312 |
+
"rstrip": false,
|
| 313 |
+
"single_word": false,
|
| 314 |
+
"special": true
|
| 315 |
+
}
|
| 316 |
+
},
|
| 317 |
+
"auto_map": {
|
| 318 |
+
"AutoTokenizer": [
|
| 319 |
+
"tokenization_openpangu.PanguTokenizer",
|
| 320 |
+
null
|
| 321 |
+
]
|
| 322 |
+
},
|
| 323 |
+
"bos_token": "<s>",
|
| 324 |
+
"clean_up_tokenization_spaces": false,
|
| 325 |
+
"eos_token": "[unused10]",
|
| 326 |
+
"extra_special_tokens": {},
|
| 327 |
+
"legacy": true,
|
| 328 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 329 |
+
"pad_token": "<unk>",
|
| 330 |
+
"spaces_between_special_tokens": false,
|
| 331 |
+
"tokenizer_class": "PanguTokenizer",
|
| 332 |
+
"unk_token": "<unk>",
|
| 333 |
+
"use_default_system_prompt": false
|
| 334 |
+
}
|