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
89766b3d
Unverified
Commit
89766b3d
authored
Nov 03, 2021
by
Patrick von Platen
Committed by
GitHub
Nov 03, 2021
Browse files
up (#14258)
parent
bd21ed40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/transformers/models/wav2vec2/convert_wav2vec2_original_pytorch_checkpoint_to_pytorch.py
...onvert_wav2vec2_original_pytorch_checkpoint_to_pytorch.py
+3
-3
No files found.
src/transformers/models/wav2vec2/convert_wav2vec2_original_pytorch_checkpoint_to_pytorch.py
View file @
89766b3d
...
@@ -153,7 +153,7 @@ def load_conv_layer(full_name, value, feature_extractor, unused_weights, use_gro
...
@@ -153,7 +153,7 @@ def load_conv_layer(full_name, value, feature_extractor, unused_weights, use_gro
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
bias
.
data
=
value
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
bias
.
data
=
value
logger
.
info
(
f
"Feat extract conv layer
{
layer_id
}
was initialized from
{
full_name
}
."
)
logger
.
info
(
f
"Feat extract conv layer
{
layer_id
}
was initialized from
{
full_name
}
."
)
elif
"weight"
in
name
:
elif
"weight"
in
name
:
if
value
.
shape
=
=
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
weight
.
data
.
shape
:
if
value
.
shape
!
=
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
weight
.
data
.
shape
:
raise
ValueError
(
raise
ValueError
(
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
weight
.
data
.
shape
}
was found."
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
.
conv_layers
[
layer_id
].
conv
.
weight
.
data
.
shape
}
was found."
)
)
...
@@ -163,14 +163,14 @@ def load_conv_layer(full_name, value, feature_extractor, unused_weights, use_gro
...
@@ -163,14 +163,14 @@ def load_conv_layer(full_name, value, feature_extractor, unused_weights, use_gro
if
"bias"
in
name
:
if
"bias"
in
name
:
if
value
.
shape
!=
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
bias
.
data
.
shape
:
if
value
.
shape
!=
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
bias
.
data
.
shape
:
raise
ValueError
(
raise
ValueError
(
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
[
layer_id
].
layer_norm
.
bias
.
data
.
shape
}
was found."
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
bias
.
data
.
shape
}
was found."
)
)
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
bias
.
data
=
value
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
bias
.
data
=
value
logger
.
info
(
f
"Feat extract layer norm weight of layer
{
layer_id
}
was initialized from
{
full_name
}
."
)
logger
.
info
(
f
"Feat extract layer norm weight of layer
{
layer_id
}
was initialized from
{
full_name
}
."
)
elif
"weight"
in
name
:
elif
"weight"
in
name
:
if
value
.
shape
!=
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
weight
.
data
.
shape
:
if
value
.
shape
!=
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
weight
.
data
.
shape
:
raise
ValueError
(
raise
ValueError
(
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
[
layer_id
].
layer_norm
.
weight
.
data
.
shape
}
was found."
f
"
{
full_name
}
has size
{
value
.
shape
}
, but
{
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
weight
.
data
.
shape
}
was found."
)
)
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
weight
.
data
=
value
feature_extractor
.
conv_layers
[
layer_id
].
layer_norm
.
weight
.
data
=
value
logger
.
info
(
f
"Feat extract layer norm weight of layer
{
layer_id
}
was initialized from
{
full_name
}
."
)
logger
.
info
(
f
"Feat extract layer norm weight of layer
{
layer_id
}
was initialized from
{
full_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