Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
df1f94eb
Unverified
Commit
df1f94eb
authored
Nov 08, 2021
by
Anton Lozhkov
Committed by
GitHub
Nov 08, 2021
Browse files
[TFWav2Vec2Model] Fix input shapes in TFWav2Vec2WeightNormConv1D (#14319)
* Add paddings to input shapes * Add padding comment
parent
e30078b5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
src/transformers/models/hubert/modeling_tf_hubert.py
src/transformers/models/hubert/modeling_tf_hubert.py
+4
-0
src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py
src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py
+4
-0
No files found.
src/transformers/models/hubert/modeling_tf_hubert.py
View file @
df1f94eb
...
...
@@ -525,7 +525,11 @@ class TFHubertWeightNormConv1D(tf.keras.layers.Conv1D):
def
build
(
self
,
input_shape
):
if
not
self
.
built
:
input_shape
=
input_shape
.
as_list
()
# Conv1D output shapes are checked at build time since TF 2.7, so we need to account for padding
input_shape
[
-
2
]
+=
self
.
explicit_padding
*
2
super
().
build
(
input_shape
)
self
.
kernel
=
tf
.
Variable
(
tf
.
transpose
(
self
.
kernel
),
name
=
"weight_v"
,
trainable
=
True
)
self
.
weight_v
=
self
.
kernel
...
...
src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py
View file @
df1f94eb
...
...
@@ -524,7 +524,11 @@ class TFWav2Vec2WeightNormConv1D(tf.keras.layers.Conv1D):
def
build
(
self
,
input_shape
):
if
not
self
.
built
:
input_shape
=
input_shape
.
as_list
()
# Conv1D output shapes are checked at build time since TF 2.7, so we need to account for padding
input_shape
[
-
2
]
+=
self
.
explicit_padding
*
2
super
().
build
(
input_shape
)
self
.
kernel
=
tf
.
Variable
(
tf
.
transpose
(
self
.
kernel
),
name
=
"weight_v"
,
trainable
=
True
)
self
.
weight_v
=
self
.
kernel
...
...
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