From 6449c494d0f40f0b70442f3da9e61f042ff807a8 Mon Sep 17 00:00:00 2001 From: Lysandre Date: Mon, 1 Jun 2020 12:57:40 -0400 Subject: [PATCH] close #4685 --- src/transformers/modeling_auto.py | 30 ++++++++++++++++++++ src/transformers/modeling_tf_auto.py | 41 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/src/transformers/modeling_auto.py b/src/transformers/modeling_auto.py index 11a8281963..de97af688c 100644 --- a/src/transformers/modeling_auto.py +++ b/src/transformers/modeling_auto.py @@ -328,6 +328,11 @@ class AutoModel: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -480,6 +485,11 @@ class AutoModelForPreTraining: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -625,6 +635,11 @@ class AutoModelWithLMHead: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -771,6 +786,11 @@ class AutoModelForSequenceClassification: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -918,6 +938,11 @@ class AutoModelForQuestionAnswering: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -1058,6 +1083,11 @@ class AutoModelForTokenClassification: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: diff --git a/src/transformers/modeling_tf_auto.py b/src/transformers/modeling_tf_auto.py index d65b0f80e5..8f40734edd 100644 --- a/src/transformers/modeling_tf_auto.py +++ b/src/transformers/modeling_tf_auto.py @@ -238,6 +238,12 @@ class TFAutoModel(object): r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `distilbert` configuration class: TFDistilBertModel (DistilBERT model) @@ -378,6 +384,11 @@ class TFAutoModelForPreTraining(object): r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + Args: config (:class:`~transformers.PretrainedConfig`): The model class to instantiate is selected based on the configuration class: @@ -544,6 +555,12 @@ class TFAutoModelWithLMHead(object): r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `distilbert` configuration class: DistilBertModel (DistilBERT model) @@ -699,6 +716,12 @@ class TFAutoModelForMultipleChoice: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `albert` configuration class: AlbertModel (Albert model) @@ -849,6 +872,12 @@ class TFAutoModelForSequenceClassification(object): r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `distilbert` configuration class: DistilBertModel (DistilBERT model) @@ -1006,6 +1035,12 @@ class TFAutoModelForQuestionAnswering(object): r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `distilbert` configuration class: DistilBertModel (DistilBERT model) @@ -1143,6 +1178,12 @@ class TFAutoModelForTokenClassification: r""" Instantiates one of the base model classes of the library from a configuration. + Note: + Loading a model from its configuration file does **not** load the model weights. + It only affects the model's configuration. Use :func:`~transformers.AutoModel.from_pretrained` to load + the model weights + + Args: config: (`optional`) instance of a class derived from :class:`~transformers.PretrainedConfig`: The model class to instantiate is selected based on the configuration class: - isInstance of `bert` configuration class: BertModel (Bert model)