Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
f05a8a0c
Unverified
Commit
f05a8a0c
authored
Apr 05, 2021
by
Sylvain Gugger
Committed by
GitHub
Apr 05, 2021
Browse files
Document common config attributes (#11070)
parent
090e3e68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+18
-7
No files found.
src/transformers/configuration_utils.py
View file @
f05a8a0c
...
@@ -34,19 +34,30 @@ class PretrainedConfig(object):
...
@@ -34,19 +34,30 @@ class PretrainedConfig(object):
Base class for all configuration classes. Handles a few parameters common to all models' configurations as well as
Base class for all configuration classes. Handles a few parameters common to all models' configurations as well as
methods for loading/downloading/saving configurations.
methods for loading/downloading/saving configurations.
Note: A configuration file can be loaded and saved to disk. Loading the configuration file and using this file to
Note:
A configuration file can be loaded and saved to disk. Loading the configuration file and using this file to
initialize a model does **not** load the model weights. It only affects the model's configuration.
initialize a model does **not** load the model weights. It only affects the model's configuration.
Class attributes (overridden by derived classes)
Class attributes (overridden by derived classes)
- **model_type** (:obj:`str`)
:
An identifier for the model type, serialized into the JSON file, and used to
- **model_type** (:obj:`str`)
--
An identifier for the model type, serialized into the JSON file, and used to
recreate the correct object in :class:`~transformers.AutoConfig`.
recreate the correct object in :class:`~transformers.AutoConfig`.
- **is_composition** (:obj:`bool`): Whether the config class is composed of multiple sub-configs. In this case
- **is_composition** (:obj:`bool`) -- Whether the config class is composed of multiple sub-configs. In this
the config has to be initialized from two or more configs of type :class:`~transformers.PretrainedConfig`
case the config has to be initialized from two or more configs of type
like: :class:`~transformers.EncoderDecoderConfig` or :class:`~RagConfig`.
:class:`~transformers.PretrainedConfig` like: :class:`~transformers.EncoderDecoderConfig` or
- **keys_to_ignore_at_inference** (:obj:`List[str]`): A list of keys to ignore by default when looking at
:class:`~RagConfig`.
- **keys_to_ignore_at_inference** (:obj:`List[str]`) -- A list of keys to ignore by default when looking at
dictionary outputs of the model during inference.
dictionary outputs of the model during inference.
Common attributes (present in all subclasses)
- **vocab_size** (:obj:`int`) -- The number of tokens in the vocabulary, which is also the first dimension of
the embeddings matrix (this attribute may be missing for models that don't have a text modality like ViT).
- **hidden_size** (:obj:`int`) -- The hidden size of the model.
- **num_attention_heads** (:obj:`int`) -- The number of attention heads used in the multi-head attention layers
of the model.
- **num_hidden_layers** (:obj:`int`) -- The number of blocks in the model.
Args:
Args:
name_or_path (:obj:`str`, `optional`, defaults to :obj:`""`):
name_or_path (:obj:`str`, `optional`, defaults to :obj:`""`):
Store the string that was passed to :func:`~transformers.PreTrainedModel.from_pretrained` or
Store the string that was passed to :func:`~transformers.PreTrainedModel.from_pretrained` or
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment