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
088c1880
Unverified
Commit
088c1880
authored
Mar 25, 2022
by
Sylvain Gugger
Committed by
GitHub
Mar 25, 2022
Browse files
Big file_utils cleanup (#16396)
* Big file_utils cleanup * This one still needs to be treated separately
parent
2b23e080
Changes
222
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
38 additions
and
38 deletions
+38
-38
src/transformers/modeling_flax_utils.py
src/transformers/modeling_flax_utils.py
+1
-1
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-2
src/transformers/models/albert/modeling_albert.py
src/transformers/models/albert/modeling_albert.py
+1
-1
src/transformers/models/albert/modeling_flax_albert.py
src/transformers/models/albert/modeling_flax_albert.py
+1
-1
src/transformers/models/albert/modeling_tf_albert.py
src/transformers/models/albert/modeling_tf_albert.py
+2
-2
src/transformers/models/bart/modeling_bart.py
src/transformers/models/bart/modeling_bart.py
+4
-4
src/transformers/models/bart/modeling_flax_bart.py
src/transformers/models/bart/modeling_flax_bart.py
+3
-3
src/transformers/models/bart/modeling_tf_bart.py
src/transformers/models/bart/modeling_tf_bart.py
+4
-4
src/transformers/models/beit/feature_extraction_beit.py
src/transformers/models/beit/feature_extraction_beit.py
+1
-1
src/transformers/models/beit/modeling_beit.py
src/transformers/models/beit/modeling_beit.py
+1
-1
src/transformers/models/beit/modeling_flax_beit.py
src/transformers/models/beit/modeling_flax_beit.py
+1
-1
src/transformers/models/bert/modeling_bert.py
src/transformers/models/bert/modeling_bert.py
+1
-1
src/transformers/models/bert/modeling_flax_bert.py
src/transformers/models/bert/modeling_flax_bert.py
+1
-1
src/transformers/models/bert/modeling_tf_bert.py
src/transformers/models/bert/modeling_tf_bert.py
+2
-2
src/transformers/models/bert_generation/modeling_bert_generation.py
...ormers/models/bert_generation/modeling_bert_generation.py
+1
-1
src/transformers/models/big_bird/modeling_big_bird.py
src/transformers/models/big_bird/modeling_big_bird.py
+1
-1
src/transformers/models/big_bird/modeling_flax_big_bird.py
src/transformers/models/big_bird/modeling_flax_big_bird.py
+1
-1
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
...ormers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
+5
-5
src/transformers/models/blenderbot/modeling_blenderbot.py
src/transformers/models/blenderbot/modeling_blenderbot.py
+4
-4
No files found.
src/transformers/modeling_flax_utils.py
View file @
088c1880
...
...
@@ -681,7 +681,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
</Tip>
kwargs:
Additional key word arguments passed along to the [`~
file_
utils.PushToHubMixin.push_to_hub`] method.
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
"""
if
os
.
path
.
isfile
(
save_directory
):
logger
.
error
(
f
"Provided path (
{
save_directory
}
) should be a directory, not a file"
)
...
...
src/transformers/modeling_tf_utils.py
View file @
088c1880
...
...
@@ -1401,7 +1401,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
</Tip>
kwargs:
Additional key word arguments passed along to the [`~
file_
utils.PushToHubMixin.push_to_hub`] method.
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
"""
if
os
.
path
.
isfile
(
save_directory
):
logger
.
error
(
f
"Provided path (
{
save_directory
}
) should be a directory, not a file"
)
...
...
src/transformers/modeling_utils.py
View file @
088c1880
...
...
@@ -1036,7 +1036,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
</Tip>
kwargs:
Additional key word arguments passed along to the [`~
file_
utils.PushToHubMixin.push_to_hub`] method.
Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
"""
if
os
.
path
.
isfile
(
save_directory
):
logger
.
error
(
f
"Provided path (
{
save_directory
}
) should be a directory, not a file"
)
...
...
@@ -2129,7 +2129,7 @@ class SQuADHead(nn.Module):
Mask for tokens at invalid position, such as query and special symbols (PAD, SEP, CLS). 1.0 means token
should be masked.
return_dict (`bool`, *optional*, defaults to `False`):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
Returns:
"""
...
...
src/transformers/models/albert/modeling_albert.py
View file @
088c1880
...
...
@@ -610,7 +610,7 @@ ALBERT_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/albert/modeling_flax_albert.py
View file @
088c1880
...
...
@@ -144,7 +144,7 @@ ALBERT_INPUTS_DOCSTRING = r"""
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
config.max_position_embeddings - 1]`.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/albert/modeling_tf_albert.py
View file @
088c1880
...
...
@@ -747,8 +747,8 @@ ALBERT_INPUTS_DOCSTRING = r"""
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
training (`bool`, *optional*, defaults to `False`):
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).
...
...
src/transformers/models/bart/modeling_bart.py
View file @
088c1880
...
...
@@ -679,7 +679,7 @@ BART_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
@@ -770,7 +770,7 @@ class BartEncoder(BartPretrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -993,7 +993,7 @@ class BartDecoder(BartPretrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -1799,7 +1799,7 @@ class BartForCausalLM(BartPretrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
Returns:
...
...
src/transformers/models/bart/modeling_flax_bart.py
View file @
088c1880
...
...
@@ -138,7 +138,7 @@ BART_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
@@ -169,7 +169,7 @@ BART_ENCODE_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
BART_DECODE_INPUTS_DOCSTRING
=
r
"""
...
...
@@ -215,7 +215,7 @@ BART_DECODE_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/bart/modeling_tf_bart.py
View file @
088c1880
...
...
@@ -625,8 +625,8 @@ BART_INPUTS_DOCSTRING = r"""
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
training (`bool`, *optional*, defaults to `False`):
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).
...
...
@@ -715,7 +715,7 @@ class TFBartEncoder(tf.keras.layers.Layer):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
if
input_ids
is
not
None
and
inputs_embeds
is
not
None
:
...
...
@@ -894,7 +894,7 @@ class TFBartDecoder(tf.keras.layers.Layer):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
if
input_ids
is
not
None
and
inputs_embeds
is
not
None
:
...
...
src/transformers/models/beit/feature_extraction_beit.py
View file @
088c1880
...
...
@@ -120,7 +120,7 @@ class BeitFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
segmentation_maps (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`, *optional*):
Optionally, the corresponding semantic segmentation maps with the pixel-wise annotations.
return_tensors (`str` or [`~
file_
utils.TensorType`], *optional*, defaults to `'np'`):
return_tensors (`str` or [`~utils.TensorType`], *optional*, defaults to `'np'`):
If set, will return tensors of a particular framework. Acceptable values are:
- `'tf'`: Return TensorFlow `tf.constant` objects.
...
...
src/transformers/models/beit/modeling_beit.py
View file @
088c1880
...
...
@@ -618,7 +618,7 @@ BEIT_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/beit/modeling_flax_beit.py
View file @
088c1880
...
...
@@ -111,7 +111,7 @@ BEIT_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/bert/modeling_bert.py
View file @
088c1880
...
...
@@ -837,7 +837,7 @@ BERT_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/bert/modeling_flax_bert.py
View file @
088c1880
...
...
@@ -164,7 +164,7 @@ BERT_INPUTS_DOCSTRING = r"""
- 0 indicates the head is **masked**.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/bert/modeling_tf_bert.py
View file @
088c1880
...
...
@@ -1025,8 +1025,8 @@ BERT_INPUTS_DOCSTRING = r"""
more detail. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple. This argument can be used
in
eager mode, in graph mode the value will always be set to True.
training (`bool`, *optional*, defaults to `False``):
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).
...
...
src/transformers/models/bert_generation/modeling_bert_generation.py
View file @
088c1880
...
...
@@ -242,7 +242,7 @@ BERT_GENERATION_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/big_bird/modeling_big_bird.py
View file @
088c1880
...
...
@@ -1844,7 +1844,7 @@ BIG_BIRD_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/big_bird/modeling_flax_big_bird.py
View file @
088c1880
...
...
@@ -181,7 +181,7 @@ BIG_BIRD_INPUTS_DOCSTRING = r"""
- 0 indicates the head is **masked**.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
View file @
088c1880
...
...
@@ -1724,7 +1724,7 @@ BIGBIRD_PEGASUS_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
BIGBIRD_PEGASUS_STANDALONE_INPUTS_DOCSTRING
=
r
"""
...
...
@@ -1751,7 +1751,7 @@ BIGBIRD_PEGASUS_STANDALONE_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
@@ -1834,7 +1834,7 @@ class BigBirdPegasusEncoder(BigBirdPegasusPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -2188,7 +2188,7 @@ class BigBirdPegasusDecoder(BigBirdPegasusPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -2999,7 +2999,7 @@ class BigBirdPegasusForCausalLM(BigBirdPegasusPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
Returns:
...
...
src/transformers/models/blenderbot/modeling_blenderbot.py
View file @
088c1880
...
...
@@ -625,7 +625,7 @@ BLENDERBOT_INPUTS_DOCSTRING = r"""
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
...
...
@@ -710,7 +710,7 @@ class BlenderbotEncoder(BlenderbotPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -935,7 +935,7 @@ class BlenderbotDecoder(BlenderbotPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""
output_attentions
=
output_attentions
if
output_attentions
is
not
None
else
self
.
config
.
output_attentions
output_hidden_states
=
(
...
...
@@ -1518,7 +1518,7 @@ class BlenderbotForCausalLM(BlenderbotPreTrainedModel):
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
for more detail.
return_dict (`bool`, *optional*):
Whether or not to return a [`~
file_
utils.ModelOutput`] instead of a plain tuple.
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
Returns:
...
...
Prev
1
2
3
4
5
6
…
12
Next
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