Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- config.json +118 -0
- configuration_hunyuan.py +206 -0
- generation_config.json +13 -0
- hy.tiktoken +0 -0
- model-00001-of-00080.safetensors +3 -0
- model-00002-of-00080.safetensors +3 -0
- model-00003-of-00080.safetensors +3 -0
- model-00004-of-00080.safetensors +3 -0
- model-00005-of-00080.safetensors +3 -0
- model-00006-of-00080.safetensors +3 -0
- model-00007-of-00080.safetensors +3 -0
- model-00008-of-00080.safetensors +3 -0
- model-00009-of-00080.safetensors +3 -0
- model-00010-of-00080.safetensors +3 -0
- model-00011-of-00080.safetensors +3 -0
- model-00012-of-00080.safetensors +3 -0
- model-00013-of-00080.safetensors +3 -0
- model-00014-of-00080.safetensors +3 -0
- model-00015-of-00080.safetensors +3 -0
- model-00016-of-00080.safetensors +3 -0
- model-00017-of-00080.safetensors +3 -0
- model-00018-of-00080.safetensors +3 -0
- model-00019-of-00080.safetensors +3 -0
- model-00020-of-00080.safetensors +3 -0
- model-00021-of-00080.safetensors +3 -0
- model-00022-of-00080.safetensors +3 -0
- model-00023-of-00080.safetensors +3 -0
- model-00024-of-00080.safetensors +3 -0
- model-00025-of-00080.safetensors +3 -0
- model-00026-of-00080.safetensors +3 -0
- model-00027-of-00080.safetensors +3 -0
- model-00028-of-00080.safetensors +3 -0
- model-00029-of-00080.safetensors +3 -0
- model-00030-of-00080.safetensors +3 -0
- model-00031-of-00080.safetensors +3 -0
- model-00032-of-00080.safetensors +3 -0
- model-00033-of-00080.safetensors +3 -0
- model-00034-of-00080.safetensors +3 -0
- model-00035-of-00080.safetensors +3 -0
- model-00036-of-00080.safetensors +3 -0
- model-00037-of-00080.safetensors +3 -0
- model-00038-of-00080.safetensors +3 -0
- model-00039-of-00080.safetensors +3 -0
- model-00040-of-00080.safetensors +3 -0
- model-00041-of-00080.safetensors +3 -0
- model-00042-of-00080.safetensors +3 -0
- model-00043-of-00080.safetensors +3 -0
- model-00044-of-00080.safetensors +3 -0
- model-00045-of-00080.safetensors +3 -0
- model-00046-of-00080.safetensors +3 -0
config.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HunYuanForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_hunyuan.HunYuanConfig",
|
| 9 |
+
"AutoModel": "modeling_hunyuan.HunyuanModel",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_hunyuan.HunYuanForCausalLM"
|
| 11 |
+
},
|
| 12 |
+
"bos_token_id": 1,
|
| 13 |
+
"capacity_factor": 1.0,
|
| 14 |
+
"cla_share_factor": 2,
|
| 15 |
+
"eos_token_id": 2,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"hidden_size": 6400,
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"intermediate_size": 18304,
|
| 20 |
+
"max_position_embeddings": 131072,
|
| 21 |
+
"model_type": "hunyuan",
|
| 22 |
+
"moe_drop_tokens": false,
|
| 23 |
+
"moe_random_routing_dropped_token": false,
|
| 24 |
+
"moe_topk": 1,
|
| 25 |
+
"num_attention_heads": 80,
|
| 26 |
+
"num_experts": 16,
|
| 27 |
+
"num_hidden_layers": 64,
|
| 28 |
+
"num_key_value_heads": 8,
|
| 29 |
+
"num_shared_expert": 1,
|
| 30 |
+
"pad_token_id": 0,
|
| 31 |
+
"pretraining_tp": 1,
|
| 32 |
+
"quantization_config": {
|
| 33 |
+
"activation_scheme": "static",
|
| 34 |
+
"ignored_layers": [
|
| 35 |
+
"model.layers.38.mlp.gate.wg",
|
| 36 |
+
"model.layers.60.mlp.gate.wg",
|
| 37 |
+
"model.layers.20.mlp.gate.wg",
|
| 38 |
+
"model.layers.11.mlp.gate.wg",
|
| 39 |
+
"model.layers.37.mlp.gate.wg",
|
| 40 |
+
"model.layers.51.mlp.gate.wg",
|
| 41 |
+
"model.layers.54.mlp.gate.wg",
|
| 42 |
+
"model.layers.49.mlp.gate.wg",
|
| 43 |
+
"model.layers.59.mlp.gate.wg",
|
| 44 |
+
"lm_head",
|
| 45 |
+
"model.layers.61.mlp.gate.wg",
|
| 46 |
+
"model.layers.50.mlp.gate.wg",
|
| 47 |
+
"model.layers.26.mlp.gate.wg",
|
| 48 |
+
"model.layers.34.mlp.gate.wg",
|
| 49 |
+
"model.layers.29.mlp.gate.wg",
|
| 50 |
+
"model.layers.2.mlp.gate.wg",
|
| 51 |
+
"model.layers.58.mlp.gate.wg",
|
| 52 |
+
"model.layers.23.mlp.gate.wg",
|
| 53 |
+
"model.layers.16.mlp.gate.wg",
|
| 54 |
+
"model.layers.4.mlp.gate.wg",
|
| 55 |
+
"model.layers.31.mlp.gate.wg",
|
| 56 |
+
"model.layers.45.mlp.gate.wg",
|
| 57 |
+
"model.layers.56.mlp.gate.wg",
|
| 58 |
+
"model.layers.3.mlp.gate.wg",
|
| 59 |
+
"model.layers.19.mlp.gate.wg",
|
| 60 |
+
"model.layers.14.mlp.gate.wg",
|
| 61 |
+
"model.layers.8.mlp.gate.wg",
|
| 62 |
+
"model.layers.41.mlp.gate.wg",
|
| 63 |
+
"model.layers.53.mlp.gate.wg",
|
| 64 |
+
"model.layers.46.mlp.gate.wg",
|
| 65 |
+
"model.layers.7.mlp.gate.wg",
|
| 66 |
+
"model.layers.25.mlp.gate.wg",
|
| 67 |
+
"model.layers.6.mlp.gate.wg",
|
| 68 |
+
"model.layers.1.mlp.gate.wg",
|
| 69 |
+
"model.layers.10.mlp.gate.wg",
|
| 70 |
+
"model.layers.12.mlp.gate.wg",
|
| 71 |
+
"model.layers.15.mlp.gate.wg",
|
| 72 |
+
"model.layers.18.mlp.gate.wg",
|
| 73 |
+
"model.layers.57.mlp.gate.wg",
|
| 74 |
+
"model.layers.63.mlp.gate.wg",
|
| 75 |
+
"model.layers.55.mlp.gate.wg",
|
| 76 |
+
"model.layers.40.mlp.gate.wg",
|
| 77 |
+
"model.layers.32.mlp.gate.wg",
|
| 78 |
+
"model.layers.39.mlp.gate.wg",
|
| 79 |
+
"model.layers.62.mlp.gate.wg",
|
| 80 |
+
"model.layers.28.mlp.gate.wg",
|
| 81 |
+
"model.layers.30.mlp.gate.wg",
|
| 82 |
+
"model.layers.27.mlp.gate.wg",
|
| 83 |
+
"model.layers.22.mlp.gate.wg",
|
| 84 |
+
"model.layers.5.mlp.gate.wg",
|
| 85 |
+
"model.layers.21.mlp.gate.wg",
|
| 86 |
+
"model.layers.36.mlp.gate.wg",
|
| 87 |
+
"model.layers.48.mlp.gate.wg",
|
| 88 |
+
"model.layers.42.mlp.gate.wg",
|
| 89 |
+
"model.layers.44.mlp.gate.wg",
|
| 90 |
+
"model.layers.52.mlp.gate.wg",
|
| 91 |
+
"model.layers.0.mlp.gate.wg",
|
| 92 |
+
"model.layers.13.mlp.gate.wg",
|
| 93 |
+
"model.layers.17.mlp.gate.wg",
|
| 94 |
+
"model.layers.24.mlp.gate.wg",
|
| 95 |
+
"model.layers.33.mlp.gate.wg",
|
| 96 |
+
"model.layers.35.mlp.gate.wg",
|
| 97 |
+
"model.layers.43.mlp.gate.wg",
|
| 98 |
+
"model.layers.47.mlp.gate.wg",
|
| 99 |
+
"model.layers.9.mlp.gate.wg"
|
| 100 |
+
],
|
| 101 |
+
"quant_method": "fp8"
|
| 102 |
+
},
|
| 103 |
+
"rms_norm_eps": 1e-05,
|
| 104 |
+
"rope_scaling": {
|
| 105 |
+
"alpha": 1000.0,
|
| 106 |
+
"factor": 1.0,
|
| 107 |
+
"type": "dynamic"
|
| 108 |
+
},
|
| 109 |
+
"rope_theta": 10000.0,
|
| 110 |
+
"tie_word_embeddings": true,
|
| 111 |
+
"torch_dtype": "bfloat16",
|
| 112 |
+
"transformers_version": "4.44.2",
|
| 113 |
+
"use_cache": true,
|
| 114 |
+
"use_cla": true,
|
| 115 |
+
"use_mixed_mlp_moe": true,
|
| 116 |
+
"use_qk_norm": true,
|
| 117 |
+
"vocab_size": 129024
|
| 118 |
+
}
|
configuration_hunyuan.py
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the TENCENT HUNYUAN COMMUNITY LICENSE AGREEMENT (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# https://github.com/Tencent/Tencent-Hunyuan-Large/blob/main/License.docx
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
""" HunYuan model configuration"""
|
| 15 |
+
|
| 16 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 17 |
+
from transformers.utils import logging
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
logger = logging.get_logger(__name__)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class HunYuanConfig(PretrainedConfig):
|
| 24 |
+
r"""
|
| 25 |
+
This is the configuration class to store the configuration of a [`HunYuanModel`]. It is used to instantiate an
|
| 26 |
+
HunYuan model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
| 27 |
+
with the defaults will yield a similar configuration to that of the HunYuan-7B.
|
| 28 |
+
|
| 29 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 30 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Args:
|
| 34 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
| 35 |
+
Vocabulary size of the HunYuan model. Defines the number of different tokens that can be represented by the
|
| 36 |
+
`inputs_ids` passed when calling [`HunYuanModel`]
|
| 37 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
| 38 |
+
Dimension of the hidden representations.
|
| 39 |
+
intermediate_size (`int`, *optional*, defaults to 11008):
|
| 40 |
+
Dimension of the MLP representations.
|
| 41 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 42 |
+
Number of hidden layers in the Transformer decoder.
|
| 43 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 44 |
+
Number of attention heads for each attention layer in the Transformer decoder.
|
| 45 |
+
num_key_value_heads (`int`, *optional*):
|
| 46 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 47 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 48 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 49 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 50 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
| 51 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
| 52 |
+
`num_attention_heads`.
|
| 53 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 54 |
+
The non-linear activation function (function or string) in the decoder.
|
| 55 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
| 56 |
+
The maximum sequence length that this model might ever be used with.
|
| 57 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 58 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 59 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 60 |
+
The epsilon used by the rms normalization layers.
|
| 61 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 62 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 63 |
+
relevant if `config.is_decoder=True`.
|
| 64 |
+
pad_token_id (`int`, *optional*):
|
| 65 |
+
Padding token id.
|
| 66 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
| 67 |
+
Beginning of stream token id.
|
| 68 |
+
eos_token_id (`int`, *optional*, defaults to 2):
|
| 69 |
+
End of stream token id.
|
| 70 |
+
pretraining_tp (`int`, *optional*, defaults to 1):
|
| 71 |
+
Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
|
| 72 |
+
document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is
|
| 73 |
+
necessary to ensure exact reproducibility of the pretraining results. Please refer to [this
|
| 74 |
+
issue](https://github.com/pytorch/pytorch/issues/76232).
|
| 75 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 76 |
+
Whether to tie weight embeddings
|
| 77 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 78 |
+
The base period of the RoPE embeddings.
|
| 79 |
+
rope_scaling (`Dict`, *optional*):
|
| 80 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
|
| 81 |
+
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
|
| 82 |
+
`{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
|
| 83 |
+
`max_position_embeddings` to the expected new maximum. See the following thread for more information on how
|
| 84 |
+
these scaling strategies behave:
|
| 85 |
+
https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an
|
| 86 |
+
experimental feature, subject to breaking API changes in future versions.
|
| 87 |
+
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
|
| 88 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
| 89 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 90 |
+
The dropout ratio for the attention probabilities.
|
| 91 |
+
use_qk_norm (`bool`, *optional*, defaults to `False`):
|
| 92 |
+
Whether query and key in attention use norm
|
| 93 |
+
use_cla (`bool`, *optional*, defaults to `False`):
|
| 94 |
+
Whether to use CLA in attention
|
| 95 |
+
cla_share_factor (`int`, *optional*, defaults to 1):
|
| 96 |
+
The share factor of CLA
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
model_type = "hunyuan"
|
| 100 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 101 |
+
|
| 102 |
+
def __init__(
|
| 103 |
+
self,
|
| 104 |
+
vocab_size=290943,
|
| 105 |
+
hidden_size=4096,
|
| 106 |
+
intermediate_size=11008,
|
| 107 |
+
num_hidden_layers=32,
|
| 108 |
+
num_attention_heads=32,
|
| 109 |
+
num_key_value_heads=None,
|
| 110 |
+
hidden_act="silu",
|
| 111 |
+
max_position_embeddings=2048,
|
| 112 |
+
initializer_range=0.02,
|
| 113 |
+
rms_norm_eps=1e-5,
|
| 114 |
+
use_cache=True,
|
| 115 |
+
pad_token_id=0,
|
| 116 |
+
bos_token_id=1,
|
| 117 |
+
eos_token_id=2,
|
| 118 |
+
pretraining_tp=1,
|
| 119 |
+
tie_word_embeddings=False,
|
| 120 |
+
rope_theta=10000.0,
|
| 121 |
+
rope_scaling=None,
|
| 122 |
+
attention_bias=False,
|
| 123 |
+
attention_dropout=0.0,
|
| 124 |
+
use_qk_norm=False,
|
| 125 |
+
use_cla=False,
|
| 126 |
+
cla_share_factor=1,
|
| 127 |
+
num_experts=1,
|
| 128 |
+
use_mixed_mlp_moe=False,
|
| 129 |
+
num_shared_expert=1,
|
| 130 |
+
moe_topk=1,
|
| 131 |
+
capacity_factor=1.0,
|
| 132 |
+
moe_drop_tokens=False,
|
| 133 |
+
moe_random_routing_dropped_token=False,
|
| 134 |
+
**kwargs,
|
| 135 |
+
):
|
| 136 |
+
self.vocab_size = vocab_size
|
| 137 |
+
self.max_position_embeddings = max_position_embeddings
|
| 138 |
+
self.hidden_size = hidden_size
|
| 139 |
+
self.intermediate_size = intermediate_size
|
| 140 |
+
self.num_hidden_layers = num_hidden_layers
|
| 141 |
+
self.num_attention_heads = num_attention_heads
|
| 142 |
+
self.num_experts = num_experts
|
| 143 |
+
self.use_mixed_mlp_moe = use_mixed_mlp_moe
|
| 144 |
+
self.num_shared_expert = num_shared_expert
|
| 145 |
+
self.moe_topk = moe_topk
|
| 146 |
+
self.capacity_factor = capacity_factor
|
| 147 |
+
self.moe_drop_tokens = moe_drop_tokens
|
| 148 |
+
self.moe_random_routing_dropped_token = moe_random_routing_dropped_token
|
| 149 |
+
|
| 150 |
+
# for backward compatibility
|
| 151 |
+
if num_key_value_heads is None:
|
| 152 |
+
num_key_value_heads = num_attention_heads
|
| 153 |
+
|
| 154 |
+
self.num_key_value_heads = num_key_value_heads
|
| 155 |
+
self.hidden_act = hidden_act
|
| 156 |
+
self.initializer_range = initializer_range
|
| 157 |
+
self.rms_norm_eps = rms_norm_eps
|
| 158 |
+
self.pretraining_tp = pretraining_tp
|
| 159 |
+
self.use_cache = use_cache
|
| 160 |
+
self.rope_theta = rope_theta
|
| 161 |
+
self.rope_scaling = rope_scaling
|
| 162 |
+
# self._rope_scaling_validation() # TODO: Need validation?
|
| 163 |
+
self.attention_bias = attention_bias
|
| 164 |
+
self.attention_dropout = attention_dropout
|
| 165 |
+
self.use_qk_norm = use_qk_norm
|
| 166 |
+
self.use_cla = use_cla
|
| 167 |
+
self.cla_share_factor = cla_share_factor
|
| 168 |
+
|
| 169 |
+
super().__init__(
|
| 170 |
+
pad_token_id=pad_token_id,
|
| 171 |
+
bos_token_id=bos_token_id,
|
| 172 |
+
eos_token_id=eos_token_id,
|
| 173 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 174 |
+
**kwargs,
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
def _rope_scaling_validation(self):
|
| 178 |
+
"""
|
| 179 |
+
Validate the `rope_scaling` configuration.
|
| 180 |
+
"""
|
| 181 |
+
if self.rope_scaling is None:
|
| 182 |
+
return
|
| 183 |
+
|
| 184 |
+
if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
|
| 185 |
+
raise ValueError(
|
| 186 |
+
"`rope_scaling` must be a dictionary with with two fields, `type` and `factor` or `type` and `alpha`, "
|
| 187 |
+
f"got {self.rope_scaling}"
|
| 188 |
+
)
|
| 189 |
+
rope_scaling_type = self.rope_scaling.get("type", None)
|
| 190 |
+
rope_scaling_factor = self.rope_scaling.get("factor", None)
|
| 191 |
+
rope_scaling_alpha = self.rope_scaling.get("alpha", None)
|
| 192 |
+
if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
|
| 193 |
+
raise ValueError(
|
| 194 |
+
f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
|
| 195 |
+
)
|
| 196 |
+
if rope_scaling_factor is None and rope_scaling_alpha is None:
|
| 197 |
+
raise ValueError(f"`rope_scaling`'s factor or alpha field must be have one, got both of none")
|
| 198 |
+
if rope_scaling_factor is not None:
|
| 199 |
+
if not isinstance(rope_scaling_factor, float) or rope_scaling_factor <= 1.0:
|
| 200 |
+
raise ValueError(f"`rope_scaling`'s factor field must be a float > 1.0, got {rope_scaling_factor}")
|
| 201 |
+
if rope_scaling_alpha is not None:
|
| 202 |
+
if not isinstance(rope_scaling_alpha, float) or rope_scaling_alpha <= 1.0:
|
| 203 |
+
raise ValueError(f"`rope_scaling`'s alpha field must be a float > 1.0, got {rope_scaling_alpha}")
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_sample": true,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
127960,
|
| 5 |
+
127967
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 127961,
|
| 8 |
+
"repetition_penalty": 1.05,
|
| 9 |
+
"temperature": 0.7,
|
| 10 |
+
"top_k": 20,
|
| 11 |
+
"top_p": 0.6,
|
| 12 |
+
"transformers_version": "4.44.2"
|
| 13 |
+
}
|
hy.tiktoken
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f128ac795246b3112495e297e598e472711636189ad4fb0e259e58df0ac9dcc
|
| 3 |
+
size 4904971448
|
model-00002-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:093e6582fdffce94bd452e994b69d26a1d11d8ffed4b3aca43746af519a6ef91
|
| 3 |
+
size 4885340536
|
model-00003-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dfd96542c9649179889fe586b4f24859096413f9ccd67d7cbb599efe8a3aef9e
|
| 3 |
+
size 4893533216
|
model-00004-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:662baedcb8b428ab758495a5a90be2ef9fbcb7ac98d04bd78e179dba1fd28a5a
|
| 3 |
+
size 4920129704
|
model-00005-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91c08a4ae7c4e8d44a60f2e253e334e84561f550d12fc86b5805844d2c4cbb21
|
| 3 |
+
size 4885340512
|
model-00006-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d15150b9454a9546c0ed92a754f3a8726af82c795b76926a77fb3eaf8871e480
|
| 3 |
+
size 4893533192
|
model-00007-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1a9ca7c6be84ea60b9dafb665bfda35cfc9d065b6fc583ddd2b3c6b4c080951
|
| 3 |
+
size 4885340544
|
model-00008-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21766deed6e70e5b1f6b58de4eaa4d70d94829334e90fc3834efefb79511a8f0
|
| 3 |
+
size 4893533208
|
model-00009-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06614372feab433764aed7cf660650e71dc519cef60f64f9bdbfe6c9b5c200b3
|
| 3 |
+
size 4961115848
|
model-00010-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4457ef3b320059f215e981fd515d642eec32a8763ec4a7c89df53eecd9133f66
|
| 3 |
+
size 4961500304
|
model-00011-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:63480f418f198fb93302bea5570a8a2abf629329dbeb6f36d77dd0d120007c9c
|
| 3 |
+
size 4893533184
|
model-00012-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5456b390570889577077b4311478baecfa94c15dc3fbdea48a334986c4477083
|
| 3 |
+
size 4885340544
|
model-00013-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07531b6c78253224421ad5a2984efb1e5ed5dc8afa2aa9b6ef5f0fb4774edc9b
|
| 3 |
+
size 4893533624
|
model-00014-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77818a52a915dff79d019a1956a3dbb4516885b2eec2a910b7b102d2f1c9452e
|
| 3 |
+
size 4884930896
|
model-00015-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1a6b82f1305f38ad5c8cc7966600342bd342634d5f4122d0d1a945e320ce111
|
| 3 |
+
size 4920539536
|
model-00016-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07956574fddeb21b905d274e7091f6b5cd69ae3407b3d197d1ffd5669eb6fad6
|
| 3 |
+
size 4893533328
|
model-00017-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e2c344f82131cea595a8c94005a7e79af667b393709ed42a87ad6aabc7d6d4b
|
| 3 |
+
size 4885340672
|
model-00018-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61ea4a8577feab0de9dc6e990b7d325273effc5d76b024135a685960959bf270
|
| 3 |
+
size 4893533352
|
model-00019-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f187904c6f482d154ed4ca028af8885ed78744156245afdb42fa6424d51910e0
|
| 3 |
+
size 4885340680
|
model-00020-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a932c96c17c37463622f88e239a52d76d3e7cd8606d9f843d7921b3866756c22
|
| 3 |
+
size 4920129824
|
model-00021-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f03c80dd2a592ab88f03c7460475071636c7fd47a94b76f77161d70581d50010
|
| 3 |
+
size 4893533320
|
model-00022-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f3b6139c541f318b2f5e5a8a0d95382d1ab2d700cbe868c2045314c13f6b298
|
| 3 |
+
size 4885340664
|
model-00023-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:406152b551648efff8e08e9ebfc1b98c3dd3c88fb882399379f8f1e751986dad
|
| 3 |
+
size 4893533360
|
model-00024-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab9fdb81550275baa4bdecbb04f6b635d69786d58b5b9e15fd11c8d0e45a9d1d
|
| 3 |
+
size 4885340672
|
model-00025-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aeef0752daaa9dce0ab3a48483a14a8f4077e6403e49e578fbcbba3574113825
|
| 3 |
+
size 4920129824
|
model-00026-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ef2f23bdeba79cc2644f080e2fdd3c4edfe8450fc5f91e573aa89da8a1b88f00
|
| 3 |
+
size 4893533320
|
model-00027-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a55ac4e84aa2fa6d20740ecb3b4287f911d71373cdcf6c7a2403de62b4546f6
|
| 3 |
+
size 4885340664
|
model-00028-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abe0d28e539c38dd463f4b24638d0171da36426bd9d4be1d761e004552fe636f
|
| 3 |
+
size 4893533352
|
model-00029-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0d2394809ac89de4c827f0bf04f71835a90c75e233ee440fe01e32f02691b059
|
| 3 |
+
size 4885340672
|
model-00030-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8add053886e678c67de09fc05502b38d528932642fd9daeef82b2caad301910a
|
| 3 |
+
size 4920129832
|
model-00031-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a845c4b784fb0bedb0f83ae5eeadf76b52e26d35077420cde2ff0973968302f
|
| 3 |
+
size 4893533328
|
model-00032-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd8bc1a97d29ca079e66f017c2fc24e12e76084ad3dcea7aacd61d37acb66e0a
|
| 3 |
+
size 4885340648
|
model-00033-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:963d68433c399ccdbd5afe9bfe4a1b64bb81ebd330ceded6af6e086af88e6851
|
| 3 |
+
size 4893533352
|
model-00034-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a32ae571b4172f8b514a512acce823e15e346cf2c814e81bb299ef515645c71
|
| 3 |
+
size 4885340680
|
model-00035-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7fbd6a03dba49f253d0b15c1619740fcb02a31f072cfe0412addb74619da3ad1
|
| 3 |
+
size 4893123544
|
model-00036-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5fc1715bf36b8eca1f4ee9e886af71c679093273bf2c632213eb3e8ccdcc851
|
| 3 |
+
size 4920539560
|
model-00037-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:231987dba4383a2c4905cb2959622ba32ee95af222a105f24690b9ad3a3c1387
|
| 3 |
+
size 4885340648
|
model-00038-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e261ba033602b0c39b312d3c5a2ea3b5464884ff3111d0fbfce8698a04681ec
|
| 3 |
+
size 4893533360
|
model-00039-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a3cbb5f39aa05ef2946bd31d955a512c32fda9362488f0076ca365788c528dec
|
| 3 |
+
size 4885340672
|
model-00040-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c664f93eede6dbb90676f2f698044ffe073e2779a674789c11765730ac050fb4
|
| 3 |
+
size 4893123552
|
model-00041-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec672869960a25839d3ea1eebb5c461207a77bab7ced795e45d4bedd4eb223a3
|
| 3 |
+
size 4920539536
|
model-00042-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f3d6321192323b2561f41f4545e2ed3c72601eb46197fed605c6e22d8211c7a
|
| 3 |
+
size 4885340648
|
model-00043-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5f9d9bcd38da37d15bd168b4dc7a1558127705f214d5c4e44bff68a626fa62c
|
| 3 |
+
size 4893533344
|
model-00044-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:336270175a59084544198106b89684d232e98aa70b45315fbf2eb6dd04bf75a7
|
| 3 |
+
size 4885340672
|
model-00045-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f29b7e6fbfbd04d366a299d48f135f9a9f8f69e4f9eef2be7e09cfa36d6bf134
|
| 3 |
+
size 4893533360
|
model-00046-of-00080.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:743303bde1bad2b3e915ec7c88e78cca52028fc8a6705a4a1f6c361c166e6516
|
| 3 |
+
size 4920129824
|