MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / MossConfig

Class MossConfig

models/configuration_moss.py:10–122  ·  view source on GitHub ↗

r""" This is the configuration class to store the configuration of a [`MossModel`]. It is used to instantiate a Moss model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of

Source from the content-addressed store, hash-verified

8
9
10class MossConfig(PretrainedConfig):
11 r"""
12 This is the configuration class to store the configuration of a [`MossModel`]. It is used to instantiate a
13 Moss model according to the specified arguments, defining the model architecture. Instantiating a configuration
14 with the defaults will yield a similar configuration to that of the Moss
15 [OpenMOSS-Team/moss-moon-003-base](https://huggingface.co/OpenMOSS-Team/moss-moon-003-base) architecture. Configuration objects
16 inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from
17 [`PretrainedConfig`] for more information.
18
19 Args:
20 vocab_size (`int`, *optional*, defaults to 107008):
21 Vocabulary size of the Moss model. Defines the number of different tokens that can be represented by the
22 `inputs_ids` passed when calling [`MossModel`].
23 n_positions (`int`, *optional*, defaults to 2048):
24 The maximum sequence length that this model might ever be used with. Typically set this to something large
25 just in case (e.g., 512 or 1024 or 2048).
26 n_embd (`int`, *optional*, defaults to 4096):
27 Dimensionality of the embeddings and hidden states.
28 n_layer (`int`, *optional*, defaults to 28):
29 Number of hidden layers in the Transformer encoder.
30 n_head (`int`, *optional*, defaults to 16):
31 Number of attention heads for each attention layer in the Transformer encoder.
32 rotary_dim (`int`, *optional*, defaults to 64):
33 Number of dimensions in the embedding that Rotary Position Embedding is applied to.
34 n_inner (`int`, *optional*, defaults to None):
35 Dimensionality of the inner feed-forward layers. `None` will set it to 4 times n_embd
36 activation_function (`str`, *optional*, defaults to `"gelu_new"`):
37 Activation function, to be selected in the list `["relu", "silu", "gelu", "tanh", "gelu_new"]`.
38 resid_pdrop (`float`, *optional*, defaults to 0.1):
39 The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
40 embd_pdrop (`int`, *optional*, defaults to 0.1):
41 The dropout ratio for the embeddings.
42 attn_pdrop (`float`, *optional*, defaults to 0.1):
43 The dropout ratio for the attention.
44 layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
45 The epsilon to use in the layer normalization layers.
46 initializer_range (`float`, *optional*, defaults to 0.02):
47 The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
48 use_cache (`bool`, *optional*, defaults to `True`):
49 Whether or not the model should return the last key/values attentions (not used by all models).
50
51 Example:
52
53 ```python
54 >>> from modeling_moss import MossModel
55 >>> from configuration_moss import MossConfig
56
57 >>> # Initializing a moss-moon-003-base configuration
58 >>> configuration = MossConfig()
59
60 >>> # Initializing a model (with random weights) from the configuration
61 >>> model = MossModel(configuration)
62
63 >>> # Accessing the model configuration
64 >>> configuration = model.config
65 ```"""
66
67 model_type = "moss"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected