Args: vocab_size (`int`, *optional*, defaults to 160256): Vocabulary size of the Telechat model. hidden_size (`int`, *optional*, defaults to 4096): Dimensionality of the embeddings and hidden states. ffn_hidden_size (`int`, *optional*, defaults to 12288): Dimensional
| 21 | logger = logging.get_logger(__name__) |
| 22 | |
| 23 | class TelechatConfig(PretrainedConfig): |
| 24 | """ |
| 25 | Args: |
| 26 | vocab_size (`int`, *optional*, defaults to 160256): Vocabulary size of the Telechat model. |
| 27 | hidden_size (`int`, *optional*, defaults to 4096): Dimensionality of the embeddings and hidden states. |
| 28 | ffn_hidden_size (`int`, *optional*, defaults to 12288): Dimensionality of the feed-forward hidden states. |
| 29 | n_layer (`int`, *optional*, defaults to 30): Number of hidden layers in the Transformer |
| 30 | n_head (`int`, *optional*, defaults to 32): Number of attention heads for each attention layer. |
| 31 | layer_norm_epsilon (`float`, *optional*, defaults to 1e-5): The epsilon to use in the layer normalization layers. |
| 32 | initializer_range (`float`, *optional*, defaults to 0.02): The standard deviation of the truncated_normal_initializer for initializing all weight matrices. |
| 33 | apply_residual_connection_post_layernorm (`bool`, *optional*, defaults to `False`): If enabled, use the layer norm of the hidden states as the residual in the transformer blocks |
| 34 | hidden_dropout (`float`, *optional*, defaults to 0.0): Dropout rate of the dropout function on the bias dropout. |
| 35 | attention_dropout (`float`, *optional*, defaults to 0.0): Dropout rate applied to the attention probs |
| 36 | use_cache (`bool`, *optional*, defaults to `True`): Whether or not the model should return the last key/values attentions. |
| 37 | training_seqlen (`int`, *optional*, defaults to 8192): Sequence length during last finetuning. |
| 38 | logn (`bool`, *optional*, defaults to `True`): Whether or not to use logN during extrapolation. |
| 39 | embed_layernorm (`bool`, *optional*, defaults to `True`): Whether or not to use embedding layernorm. |
| 40 | |
| 41 | """ |
| 42 | |
| 43 | model_type = "telechat" |
| 44 | keys_to_ignore_at_inference = ["past_key_values"] |
| 45 | attribute_map = { |
| 46 | "num_hidden_layers": "n_layer", |
| 47 | "num_attention_heads": "n_head", |
| 48 | } |
| 49 | |
| 50 | def __init__( |
| 51 | self, |
| 52 | vocab_size=160256, |
| 53 | hidden_size=4096, |
| 54 | n_layer=30, |
| 55 | n_head=32, |
| 56 | layer_norm_epsilon=1e-5, |
| 57 | initializer_range=0.02, |
| 58 | use_cache=True, |
| 59 | bos_token_id=1, |
| 60 | eos_token_id=2, |
| 61 | apply_residual_connection_post_layernorm=False, |
| 62 | hidden_dropout=0.0, |
| 63 | attention_dropout=0.0, |
| 64 | ffn_hidden_size=12288, |
| 65 | training_seqlen = 8192, |
| 66 | logn = True, |
| 67 | embed_layernorm = False, |
| 68 | **kwargs, |
| 69 | ): |
| 70 | self.vocab_size = vocab_size |
| 71 | n_embed = kwargs.pop("n_embed", None) |
| 72 | self.hidden_size = hidden_size if n_embed is None else n_embed |
| 73 | self.n_layer = n_layer |
| 74 | self.n_head = n_head |
| 75 | self.layer_norm_epsilon = layer_norm_epsilon |
| 76 | self.initializer_range = initializer_range |
| 77 | self.use_cache = use_cache |
| 78 | self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm |
| 79 | self.hidden_dropout = hidden_dropout |
| 80 | self.attention_dropout = attention_dropout |
nothing calls this directly
no outgoing calls
no test coverage detected