r""" This is the configuration class to store the configuration of a [`~ChatGLMModel`]. It is used to instantiate an ChatGLM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to
| 51 | from transformers.configuration_utils import PretrainedConfig |
| 52 | |
| 53 | class ChatGLMConfig(PretrainedConfig): |
| 54 | r""" |
| 55 | This is the configuration class to store the configuration of a [`~ChatGLMModel`]. |
| 56 | It is used to instantiate an ChatGLM model according to the specified arguments, defining the model |
| 57 | architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of |
| 58 | the ChatGLM-6B [THUDM/ChatGLM-6B](https://huggingface.co/THUDM/chatglm-6b) architecture. |
| 59 | |
| 60 | Configuration objects inherit from [`PretrainedConfig`] and can be used |
| 61 | to control the model outputs. Read the documentation from [`PretrainedConfig`] |
| 62 | for more information. |
| 63 | |
| 64 | |
| 65 | Args: |
| 66 | vocab_size (`int`, *optional*, defaults to 150528): |
| 67 | Vocabulary size of the ChatGLM-6B model. Defines the number of different tokens that can be represented by the |
| 68 | `inputs_ids` passed when calling [`~ChatGLMModel`] or |
| 69 | [`~TFChatGLMModel`]. |
| 70 | hidden_size (`int`, *optional*, defaults to 4096): |
| 71 | Dimension of the encoder layers and the pooler layer. |
| 72 | num_hidden_layers (`int`, *optional*, defaults to 28): |
| 73 | Number of hidden layers in the Transformer encoder. |
| 74 | num_attention_heads (`int`, *optional*, defaults to 32): |
| 75 | Number of attention heads for each attention layer in the Transformer encoder. |
| 76 | inner_hidden_size (`int`, *optional*, defaults to 16384): |
| 77 | Dimension of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder. |
| 78 | max_sequence_length (`int`, *optional*, defaults to 512): |
| 79 | The maximum sequence length that this model might ever be used with. |
| 80 | Typically set this to something large just in case (e.g., 512 or 1024 or 2048). |
| 81 | layernorm_epsilon (`float`, *optional*, defaults to 1e-5): |
| 82 | The epsilon used by the layer normalization layers. |
| 83 | use_cache (`bool`, *optional*, defaults to `True`): |
| 84 | Whether the model should return the last key/values attentions (not used by all models). |
| 85 | Example: |
| 86 | |
| 87 | ```python |
| 88 | >>> from configuration_chatglm import ChatGLMConfig |
| 89 | >>> from modeling_chatglm import ChatGLMModel |
| 90 | |
| 91 | >>> # Initializing a ChatGLM-6B THUDM/ChatGLM-6B style configuration |
| 92 | >>> configuration = ChatGLMConfig() |
| 93 | |
| 94 | >>> # Initializing a model from the THUDM/ChatGLM-6B style configuration |
| 95 | >>> model = ChatGLMModel(configuration) |
| 96 | |
| 97 | >>> # Accessing the model configuration |
| 98 | >>> configuration = model.config |
| 99 | ``` |
| 100 | """ |
| 101 | model_type = "chatglm" |
| 102 | |
| 103 | def __init__( |
| 104 | self, |
| 105 | vocab_size=150528, |
| 106 | hidden_size=4096, |
| 107 | num_layers=28, |
| 108 | num_attention_heads=32, |
| 109 | layernorm_epsilon=1e-5, |
| 110 | use_cache=False, |
nothing calls this directly
no outgoing calls
no test coverage detected