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
88dbbfb2
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "e8968bd03ad35c2bd0e38ddcbd9243870212944f"
Unverified
Commit
88dbbfb2
authored
Sep 16, 2021
by
Sylvain Gugger
Committed by
GitHub
Sep 16, 2021
Browse files
Fix make fix-copies with type annotations (#13586)
parent
cec1c636
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
src/transformers/models/hubert/modeling_hubert.py
src/transformers/models/hubert/modeling_hubert.py
+4
-0
src/transformers/models/hubert/modeling_tf_hubert.py
src/transformers/models/hubert/modeling_tf_hubert.py
+1
-1
src/transformers/models/roberta/modeling_tf_roberta.py
src/transformers/models/roberta/modeling_tf_roberta.py
+2
-2
utils/check_copies.py
utils/check_copies.py
+1
-1
No files found.
src/transformers/models/hubert/modeling_hubert.py
View file @
88dbbfb2
...
...
@@ -109,6 +109,10 @@ def _compute_mask_indices(
# scatter indices to mask
spec_aug_mask
=
spec_aug_mask
.
scatter
(
1
,
spec_aug_mask_idxs
,
True
)
if
attention_mask
is
not
None
:
# make sure padded input ids cannot be masked
spec_aug_mask
=
torch
.
where
(
attention_mask
.
bool
(),
spec_aug_mask
,
False
)
return
spec_aug_mask
...
...
src/transformers/models/hubert/modeling_tf_hubert.py
View file @
88dbbfb2
...
...
@@ -258,7 +258,7 @@ def _compute_mask_indices(
tf
.
ones_like
(
spec_aug_mask_idxs
),
spec_aug_mask_idxs
,
spec_aug_mask
.
shape
)
return
tf
.
cast
(
spec_aug_mask
,
tf
.
float32
)
return
spec_aug_mask
# Copied from transformers.models.bart.modeling_tf_bart._expand_mask
...
...
src/transformers/models/roberta/modeling_tf_roberta.py
View file @
88dbbfb2
...
...
@@ -508,9 +508,9 @@ class TFRobertaMainLayer(tf.keras.layers.Layer):
if
inputs
[
"input_ids"
]
is
not
None
and
inputs
[
"inputs_embeds"
]
is
not
None
:
raise
ValueError
(
"You cannot specify both input_ids and inputs_embeds at the same time"
)
elif
inputs
[
"input_ids"
]
is
not
None
:
input_shape
=
shape_list
(
tensor
=
inputs
[
"input_ids"
])
input_shape
=
shape_list
(
inputs
[
"input_ids"
])
elif
inputs
[
"inputs_embeds"
]
is
not
None
:
input_shape
=
shape_list
(
tensor
=
inputs
[
"inputs_embeds"
])[:
-
1
]
input_shape
=
shape_list
(
inputs
[
"inputs_embeds"
])[:
-
1
]
else
:
raise
ValueError
(
"You have to specify either input_ids or inputs_embeds"
)
...
...
utils/check_copies.py
View file @
88dbbfb2
...
...
@@ -52,7 +52,7 @@ LOCALIZED_READMES = {
def
_should_continue
(
line
,
indent
):
return
line
.
startswith
(
indent
)
or
len
(
line
)
<=
1
or
re
.
search
(
r
"^\s*\)
:
\s*$"
,
line
)
is
not
None
return
line
.
startswith
(
indent
)
or
len
(
line
)
<=
1
or
re
.
search
(
r
"^\s*\)
(\s*->.*:|:)
\s*$"
,
line
)
is
not
None
def
find_code_in_transformers
(
object_name
):
...
...
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