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
b9a0ede6
Unverified
Commit
b9a0ede6
authored
Dec 06, 2022
by
xxyzz
Committed by
GitHub
Dec 06, 2022
Browse files
Check if docstring is None before formating it (#20592)
docstrings could be `None` if Python optimize level is set to 2.
parent
ae06bce8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
21 deletions
+28
-21
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+4
-3
src/transformers/feature_extraction_utils.py
src/transformers/feature_extraction_utils.py
+4
-3
src/transformers/image_processing_utils.py
src/transformers/image_processing_utils.py
+4
-3
src/transformers/modeling_flax_utils.py
src/transformers/modeling_flax_utils.py
+4
-3
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+4
-3
src/transformers/processing_utils.py
src/transformers/processing_utils.py
+4
-3
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+4
-3
No files found.
src/transformers/configuration_utils.py
View file @
b9a0ede6
...
@@ -942,6 +942,7 @@ def get_configuration_file(configuration_files: List[str]) -> str:
...
@@ -942,6 +942,7 @@ def get_configuration_file(configuration_files: List[str]) -> str:
PretrainedConfig
.
push_to_hub
=
copy_func
(
PretrainedConfig
.
push_to_hub
)
PretrainedConfig
.
push_to_hub
=
copy_func
(
PretrainedConfig
.
push_to_hub
)
PretrainedConfig
.
push_to_hub
.
__doc__
=
PretrainedConfig
.
push_to_hub
.
__doc__
.
format
(
if
PretrainedConfig
.
push_to_hub
.
__doc__
is
not
None
:
PretrainedConfig
.
push_to_hub
.
__doc__
=
PretrainedConfig
.
push_to_hub
.
__doc__
.
format
(
object
=
"config"
,
object_class
=
"AutoConfig"
,
object_files
=
"configuration file"
object
=
"config"
,
object_class
=
"AutoConfig"
,
object_files
=
"configuration file"
)
)
src/transformers/feature_extraction_utils.py
View file @
b9a0ede6
...
@@ -598,6 +598,7 @@ class FeatureExtractionMixin(PushToHubMixin):
...
@@ -598,6 +598,7 @@ class FeatureExtractionMixin(PushToHubMixin):
FeatureExtractionMixin
.
push_to_hub
=
copy_func
(
FeatureExtractionMixin
.
push_to_hub
)
FeatureExtractionMixin
.
push_to_hub
=
copy_func
(
FeatureExtractionMixin
.
push_to_hub
)
FeatureExtractionMixin
.
push_to_hub
.
__doc__
=
FeatureExtractionMixin
.
push_to_hub
.
__doc__
.
format
(
if
FeatureExtractionMixin
.
push_to_hub
.
__doc__
is
not
None
:
FeatureExtractionMixin
.
push_to_hub
.
__doc__
=
FeatureExtractionMixin
.
push_to_hub
.
__doc__
.
format
(
object
=
"feature extractor"
,
object_class
=
"AutoFeatureExtractor"
,
object_files
=
"feature extractor file"
object
=
"feature extractor"
,
object_class
=
"AutoFeatureExtractor"
,
object_files
=
"feature extractor file"
)
)
src/transformers/image_processing_utils.py
View file @
b9a0ede6
...
@@ -523,6 +523,7 @@ def get_size_dict(
...
@@ -523,6 +523,7 @@ def get_size_dict(
ImageProcessingMixin
.
push_to_hub
=
copy_func
(
ImageProcessingMixin
.
push_to_hub
)
ImageProcessingMixin
.
push_to_hub
=
copy_func
(
ImageProcessingMixin
.
push_to_hub
)
ImageProcessingMixin
.
push_to_hub
.
__doc__
=
ImageProcessingMixin
.
push_to_hub
.
__doc__
.
format
(
if
ImageProcessingMixin
.
push_to_hub
.
__doc__
is
not
None
:
ImageProcessingMixin
.
push_to_hub
.
__doc__
=
ImageProcessingMixin
.
push_to_hub
.
__doc__
.
format
(
object
=
"image processor"
,
object_class
=
"AutoImageProcessor"
,
object_files
=
"image processor file"
object
=
"image processor"
,
object_class
=
"AutoImageProcessor"
,
object_files
=
"image processor file"
)
)
src/transformers/modeling_flax_utils.py
View file @
b9a0ede6
...
@@ -1073,9 +1073,10 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -1073,9 +1073,10 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
# To update the docstring, we need to copy the method, otherwise we change the original docstring.
# To update the docstring, we need to copy the method, otherwise we change the original docstring.
FlaxPreTrainedModel
.
push_to_hub
=
copy_func
(
FlaxPreTrainedModel
.
push_to_hub
)
FlaxPreTrainedModel
.
push_to_hub
=
copy_func
(
FlaxPreTrainedModel
.
push_to_hub
)
FlaxPreTrainedModel
.
push_to_hub
.
__doc__
=
FlaxPreTrainedModel
.
push_to_hub
.
__doc__
.
format
(
if
FlaxPreTrainedModel
.
push_to_hub
.
__doc__
is
not
None
:
FlaxPreTrainedModel
.
push_to_hub
.
__doc__
=
FlaxPreTrainedModel
.
push_to_hub
.
__doc__
.
format
(
object
=
"model"
,
object_class
=
"FlaxAutoModel"
,
object_files
=
"model checkpoint"
object
=
"model"
,
object_class
=
"FlaxAutoModel"
,
object_files
=
"model checkpoint"
)
)
def
overwrite_call_docstring
(
model_class
,
docstring
):
def
overwrite_call_docstring
(
model_class
,
docstring
):
...
...
src/transformers/modeling_utils.py
View file @
b9a0ede6
...
@@ -2810,9 +2810,10 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -2810,9 +2810,10 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
PreTrainedModel
.
push_to_hub
=
copy_func
(
PreTrainedModel
.
push_to_hub
)
PreTrainedModel
.
push_to_hub
=
copy_func
(
PreTrainedModel
.
push_to_hub
)
PreTrainedModel
.
push_to_hub
.
__doc__
=
PreTrainedModel
.
push_to_hub
.
__doc__
.
format
(
if
PreTrainedModel
.
push_to_hub
.
__doc__
is
not
None
:
PreTrainedModel
.
push_to_hub
.
__doc__
=
PreTrainedModel
.
push_to_hub
.
__doc__
.
format
(
object
=
"model"
,
object_class
=
"AutoModel"
,
object_files
=
"model file"
object
=
"model"
,
object_class
=
"AutoModel"
,
object_files
=
"model file"
)
)
class
PoolerStartLogits
(
nn
.
Module
):
class
PoolerStartLogits
(
nn
.
Module
):
...
...
src/transformers/processing_utils.py
View file @
b9a0ede6
...
@@ -234,6 +234,7 @@ class ProcessorMixin(PushToHubMixin):
...
@@ -234,6 +234,7 @@ class ProcessorMixin(PushToHubMixin):
ProcessorMixin
.
push_to_hub
=
copy_func
(
ProcessorMixin
.
push_to_hub
)
ProcessorMixin
.
push_to_hub
=
copy_func
(
ProcessorMixin
.
push_to_hub
)
ProcessorMixin
.
push_to_hub
.
__doc__
=
ProcessorMixin
.
push_to_hub
.
__doc__
.
format
(
if
ProcessorMixin
.
push_to_hub
.
__doc__
is
not
None
:
ProcessorMixin
.
push_to_hub
.
__doc__
=
ProcessorMixin
.
push_to_hub
.
__doc__
.
format
(
object
=
"processor"
,
object_class
=
"AutoProcessor"
,
object_files
=
"processor files"
object
=
"processor"
,
object_class
=
"AutoProcessor"
,
object_files
=
"processor files"
)
)
src/transformers/tokenization_utils_base.py
View file @
b9a0ede6
...
@@ -3768,6 +3768,7 @@ def get_fast_tokenizer_file(tokenization_files: List[str]) -> str:
...
@@ -3768,6 +3768,7 @@ def get_fast_tokenizer_file(tokenization_files: List[str]) -> str:
# To update the docstring, we need to copy the method, otherwise we change the original docstring.
# To update the docstring, we need to copy the method, otherwise we change the original docstring.
PreTrainedTokenizerBase
.
push_to_hub
=
copy_func
(
PreTrainedTokenizerBase
.
push_to_hub
)
PreTrainedTokenizerBase
.
push_to_hub
=
copy_func
(
PreTrainedTokenizerBase
.
push_to_hub
)
PreTrainedTokenizerBase
.
push_to_hub
.
__doc__
=
PreTrainedTokenizerBase
.
push_to_hub
.
__doc__
.
format
(
if
PreTrainedTokenizerBase
.
push_to_hub
.
__doc__
is
not
None
:
PreTrainedTokenizerBase
.
push_to_hub
.
__doc__
=
PreTrainedTokenizerBase
.
push_to_hub
.
__doc__
.
format
(
object
=
"tokenizer"
,
object_class
=
"AutoTokenizer"
,
object_files
=
"tokenizer files"
object
=
"tokenizer"
,
object_class
=
"AutoTokenizer"
,
object_files
=
"tokenizer files"
)
)
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