@@ -40,12 +40,17 @@ class PretrainedConfig(object):
...
@@ -40,12 +40,17 @@ class PretrainedConfig(object):
- ``pretrained_config_archive_map``: a python ``dict`` with `shortcut names` (string) as keys and `url` (string) of associated pretrained model configurations as values.
- ``pretrained_config_archive_map``: a python ``dict`` with `shortcut names` (string) as keys and `url` (string) of associated pretrained model configurations as values.
- ``model_type``: a string that identifies the model type, that we serialize into the JSON file, and that we use to recreate the correct object in :class:`~transformers.AutoConfig`.
- ``model_type``: a string that identifies the model type, that we serialize into the JSON file, and that we use to recreate the correct object in :class:`~transformers.AutoConfig`.
Parameters:
Args:
``finetuning_task``: string, default `None`. Name of the task used to fine-tune the model. This can be used when converting from an original (TensorFlow or PyTorch) checkpoint.
finetuning_task (:obj:`string` or :obj:`None`, `optional`, defaults to :obj:`None`):
``num_labels``: integer, default `2`. Number of classes to use when the model is a classification model (sequences/tokens)
Name of the task used to fine-tune the model. This can be used when converting from an original (TensorFlow or PyTorch) checkpoint.
``output_attentions``: boolean, default `False`. Should the model returns attentions weights.
num_labels (:obj:`int`, `optional`, defaults to `2`):
``output_hidden_states``: string, default `False`. Should the model returns all hidden-states.
Number of classes to use when the model is a classification model (sequences/tokens)
``torchscript``: string, default `False`. Is the model used with Torchscript.
output_attentions (:obj:`bool`, `optional`, defaults to :obj:`False`):
Should the model returns attentions weights.
output_hidden_states (:obj:`string`, `optional`, defaults to :obj:`False`):
Should the model returns all hidden-states.
torchscript (:obj:`bool`, `optional`, defaults to :obj:`False`):
Is the model used with Torchscript (for PyTorch models).
r""" Instantiate a :class:`~transformers.PretrainedConfig` (or a derived class) from a pre-trained model configuration.
r"""
Parameters:
Instantiate a :class:`~transformers.PretrainedConfig` (or a derived class) from a pre-trained model configuration.
pretrained_model_name_or_path: either:
Args:
- a string with the `shortcut name` of a pre-trained model configuration to load from cache or download, e.g.: ``bert-base-uncased``.
pretrained_model_name_or_path (:obj:`string`):
- a string with the `identifier name` of a pre-trained model configuration that was user-uploaded to our S3, e.g.: ``dbmdz/bert-base-german-cased``.
either:
- a path to a `directory` containing a configuration file saved using the :func:`~transformers.PretrainedConfig.save_pretrained` method, e.g.: ``./my_model_directory/``.
- a string with the `shortcut name` of a pre-trained model configuration to load from cache or
- a path or url to a saved configuration JSON `file`, e.g.: ``./my_model_directory/configuration.json``.
download, e.g.: ``bert-base-uncased``.
- a string with the `identifier name` of a pre-trained model configuration that was user-uploaded to
cache_dir: (`optional`) string:
our S3, e.g.: ``dbmdz/bert-base-german-cased``.
- a path to a `directory` containing a configuration file saved using the
If False, then this function returns just the final configuration object.
If True, then this functions returns a :obj:`Tuple(config, unused_kwargs)` where `unused_kwargs` is a
dictionary consisting of the key/value pairs whose keys are not configuration attributes: ie the part
of kwargs which has not been used to update `config` and is otherwise ignored.
- If False, then this function returns just the final configuration object.
Returns:
- If True, then this functions returns a tuple `(config, unused_kwargs)` where `unused_kwargs` is a dictionary consisting of the key/value pairs whose keys are not configuration attributes: ie the part of kwargs which has not been used to update `config` and is otherwise ignored.
:class:`PretrainedConfig`: An instance of a configuration object
Examples::
Examples::
...
@@ -169,9 +184,14 @@ class PretrainedConfig(object):
...
@@ -169,9 +184,14 @@ class PretrainedConfig(object):
for instantiating a Config using `from_dict`.
for instantiating a Config using `from_dict`.
Parameters:
Parameters:
pretrained_config_archive_map: (`optional`) Dict:
pretrained_model_name_or_path (:obj:`string`):
A map of `shortcut names` to `url`.
The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.