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
0486ccdd
"vscode:/vscode.git/clone" did not exist on "11f65d41581c5d12a96dc7856b7c458ddf47d855"
Unverified
Commit
0486ccdd
authored
Mar 17, 2021
by
Patrick von Platen
Committed by
GitHub
Mar 17, 2021
Browse files
small improvements (#10773)
parent
d7e0d59b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
tests/test_modeling_wav2vec2.py
tests/test_modeling_wav2vec2.py
+2
-2
No files found.
tests/test_modeling_wav2vec2.py
View file @
0486ccdd
...
...
@@ -162,7 +162,7 @@ class Wav2Vec2ModelTester:
model
.
eval
()
input_values
=
input_values
[:
3
]
attention_mask
=
torch
.
ones
(
input_values
.
shape
,
device
=
torch_device
,
dtype
=
torch
.
bool
)
attention_mask
=
torch
.
ones
(
input_values
.
shape
,
device
=
torch_device
,
dtype
=
torch
.
long
)
input_lengths
=
[
input_values
.
shape
[
-
1
]
//
i
for
i
in
[
4
,
2
,
1
]]
max_length_labels
=
model
.
_get_feat_extract_output_lengths
(
torch
.
tensor
(
input_lengths
))
...
...
@@ -171,7 +171,7 @@ class Wav2Vec2ModelTester:
# pad input
for
i
in
range
(
len
(
input_lengths
)):
input_values
[
i
,
input_lengths
[
i
]
:]
=
0.0
attention_mask
[
i
,
input_lengths
[
i
]
:]
=
0
.0
attention_mask
[
i
,
input_lengths
[
i
]
:]
=
0
model
.
config
.
ctc_loss_reduction
=
"sum"
sum_loss
=
model
(
input_values
,
attention_mask
=
attention_mask
,
labels
=
labels
).
loss
...
...
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