MCPcopy Create free account
hub / github.com/Tele-AI/Telechat / TelechatConfig

Class TelechatConfig

models/12B/configuration_telechat.py:26–92  ·  view source on GitHub ↗

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): Dimensionality

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected