From 6cf06d198c72ab2796614bade00a50c777627512 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> Date: Fri, 11 Feb 2022 09:55:31 -0500 Subject: [PATCH] Mark "code in the Hub" API as experimental (#15624) --- docs/source/custom_models.mdx | 6 ++++++ src/transformers/configuration_utils.py | 6 ++++++ src/transformers/modeling_flax_utils.py | 6 ++++++ src/transformers/modeling_tf_utils.py | 6 ++++++ src/transformers/modeling_utils.py | 6 ++++++ src/transformers/tokenization_utils_base.py | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/docs/source/custom_models.mdx b/docs/source/custom_models.mdx index b7205241ba..a83c90b20d 100644 --- a/docs/source/custom_models.mdx +++ b/docs/source/custom_models.mdx @@ -213,6 +213,12 @@ code of the model is saved. ## Sending the code to the Hub + + +This API is experimental and may have some slight breaking changes in the next releases. + + + First, make sure your model is fully defined in a `.py` file. It can rely on relative imports to some other files as long as all the files are in the same directory (we don't support submodules for this feature yet). For our example, we'll define a `modeling_resnet.py` file and a `configuration_resnet.py` file in a folder of the current working diff --git a/src/transformers/configuration_utils.py b/src/transformers/configuration_utils.py index 3a43677a70..580de6b91e 100755 --- a/src/transformers/configuration_utils.py +++ b/src/transformers/configuration_utils.py @@ -867,6 +867,12 @@ class PretrainedConfig(PushToHubMixin): Register this class with a given auto class. This should only be used for custom configurations as the ones in the library are already mapped with `AutoConfig`. + + + This API is experimental and may have some slight breaking changes in the next releases. + + + Args: auto_class (`str` or `type`, *optional*, defaults to `"AutoConfig"`): The auto class to register this new configuration with. diff --git a/src/transformers/modeling_flax_utils.py b/src/transformers/modeling_flax_utils.py index 3afc82e97e..969fd6daf2 100644 --- a/src/transformers/modeling_flax_utils.py +++ b/src/transformers/modeling_flax_utils.py @@ -725,6 +725,12 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin): Register this class with a given auto class. This should only be used for custom models as the ones in the library are already mapped with an auto class. + + + This API is experimental and may have some slight breaking changes in the next releases. + + + Args: auto_class (`str` or `type`, *optional*, defaults to `"FlaxAutoModel"`): The auto class to register this new model with. diff --git a/src/transformers/modeling_tf_utils.py b/src/transformers/modeling_tf_utils.py index 54f465215f..5e37a1818d 100644 --- a/src/transformers/modeling_tf_utils.py +++ b/src/transformers/modeling_tf_utils.py @@ -2021,6 +2021,12 @@ class TFSequenceSummary(tf.keras.layers.Layer): Register this class with a given auto class. This should only be used for custom models as the ones in the library are already mapped with an auto class. + + + This API is experimental and may have some slight breaking changes in the next releases. + + + Args: auto_class (`str` or `type`, *optional*, defaults to `"TFAutoModel"`): The auto class to register this new model with. diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index e431c5a334..bc93e0616b 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -1821,6 +1821,12 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix Register this class with a given auto class. This should only be used for custom models as the ones in the library are already mapped with an auto class. + + + This API is experimental and may have some slight breaking changes in the next releases. + + + Args: auto_class (`str` or `type`, *optional*, defaults to `"AutoModel"`): The auto class to register this new model with. diff --git a/src/transformers/tokenization_utils_base.py b/src/transformers/tokenization_utils_base.py index e60d4331ed..27ed8b8984 100644 --- a/src/transformers/tokenization_utils_base.py +++ b/src/transformers/tokenization_utils_base.py @@ -3417,6 +3417,12 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin): Register this class with a given auto class. This should only be used for custom tokenizers as the ones in the library are already mapped with `AutoTokenizer`. + + + This API is experimental and may have some slight breaking changes in the next releases. + + + Args: auto_class (`str` or `type`, *optional*, defaults to `"AutoTokenizer"`): The auto class to register this new tokenizer with.