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
6cf06d19
Unverified
Commit
6cf06d19
authored
Feb 11, 2022
by
Sylvain Gugger
Committed by
GitHub
Feb 11, 2022
Browse files
Mark "code in the Hub" API as experimental (#15624)
parent
45c7b5b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
0 deletions
+36
-0
docs/source/custom_models.mdx
docs/source/custom_models.mdx
+6
-0
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+6
-0
src/transformers/modeling_flax_utils.py
src/transformers/modeling_flax_utils.py
+6
-0
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+6
-0
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+6
-0
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+6
-0
No files found.
docs/source/custom_models.mdx
View file @
6cf06d19
...
@@ -213,6 +213,12 @@ code of the model is saved.
...
@@ -213,6 +213,12 @@ code of the model is saved.
## Sending the code to the Hub
## Sending the code to the Hub
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
First, make sure your model is fully defined in a `.py` file. It can rely on relative imports to some other files as
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
,
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
we
'll define a `modeling_resnet.py` file and a `configuration_resnet.py` file in a folder of the current working
...
...
src/transformers/configuration_utils.py
View file @
6cf06d19
...
@@ -867,6 +867,12 @@ class PretrainedConfig(PushToHubMixin):
...
@@ -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
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`.
the library are already mapped with `AutoConfig`.
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
Args:
Args:
auto_class (`str` or `type`, *optional*, defaults to `"AutoConfig"`):
auto_class (`str` or `type`, *optional*, defaults to `"AutoConfig"`):
The auto class to register this new configuration with.
The auto class to register this new configuration with.
...
...
src/transformers/modeling_flax_utils.py
View file @
6cf06d19
...
@@ -725,6 +725,12 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -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
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.
library are already mapped with an auto class.
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
Args:
Args:
auto_class (`str` or `type`, *optional*, defaults to `"FlaxAutoModel"`):
auto_class (`str` or `type`, *optional*, defaults to `"FlaxAutoModel"`):
The auto class to register this new model with.
The auto class to register this new model with.
...
...
src/transformers/modeling_tf_utils.py
View file @
6cf06d19
...
@@ -2021,6 +2021,12 @@ class TFSequenceSummary(tf.keras.layers.Layer):
...
@@ -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
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.
library are already mapped with an auto class.
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
Args:
Args:
auto_class (`str` or `type`, *optional*, defaults to `"TFAutoModel"`):
auto_class (`str` or `type`, *optional*, defaults to `"TFAutoModel"`):
The auto class to register this new model with.
The auto class to register this new model with.
...
...
src/transformers/modeling_utils.py
View file @
6cf06d19
...
@@ -1821,6 +1821,12 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -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
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.
library are already mapped with an auto class.
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
Args:
Args:
auto_class (`str` or `type`, *optional*, defaults to `"AutoModel"`):
auto_class (`str` or `type`, *optional*, defaults to `"AutoModel"`):
The auto class to register this new model with.
The auto class to register this new model with.
...
...
src/transformers/tokenization_utils_base.py
View file @
6cf06d19
...
@@ -3417,6 +3417,12 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
...
@@ -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
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`.
library are already mapped with `AutoTokenizer`.
<Tip warning={true}>
This API is experimental and may have some slight breaking changes in the next releases.
</Tip>
Args:
Args:
auto_class (`str` or `type`, *optional*, defaults to `"AutoTokenizer"`):
auto_class (`str` or `type`, *optional*, defaults to `"AutoTokenizer"`):
The auto class to register this new tokenizer with.
The auto class to register this new tokenizer with.
...
...
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