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
aa018a79
Unverified
Commit
aa018a79
authored
Sep 29, 2021
by
Patrick von Platen
Committed by
GitHub
Sep 29, 2021
Browse files
up (#13777)
parent
a21ee1f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/transformers/models/hubert/modeling_hubert.py
src/transformers/models/hubert/modeling_hubert.py
+8
-0
src/transformers/models/wav2vec2/modeling_wav2vec2.py
src/transformers/models/wav2vec2/modeling_wav2vec2.py
+8
-0
No files found.
src/transformers/models/hubert/modeling_hubert.py
View file @
aa018a79
...
@@ -964,6 +964,14 @@ class HubertForCTC(HubertPreTrainedModel):
...
@@ -964,6 +964,14 @@ class HubertForCTC(HubertPreTrainedModel):
self
.
hubert
=
HubertModel
(
config
)
self
.
hubert
=
HubertModel
(
config
)
self
.
dropout
=
nn
.
Dropout
(
config
.
final_dropout
)
self
.
dropout
=
nn
.
Dropout
(
config
.
final_dropout
)
if
config
.
vocab_size
is
None
:
raise
ValueError
(
f
"You are trying to instantiate
{
self
.
__class__
}
with a configuration that "
"does not define the vocabulary size of the language model head. Please "
"instantiate the model as follows: `HubertForCTC.from_pretrained(..., vocab_size=vocab_size)`. "
"or define `vocab_size` of your model's configuration."
)
self
.
lm_head
=
nn
.
Linear
(
config
.
hidden_size
,
config
.
vocab_size
)
self
.
lm_head
=
nn
.
Linear
(
config
.
hidden_size
,
config
.
vocab_size
)
self
.
init_weights
()
self
.
init_weights
()
...
...
src/transformers/models/wav2vec2/modeling_wav2vec2.py
View file @
aa018a79
...
@@ -1416,6 +1416,14 @@ class Wav2Vec2ForCTC(Wav2Vec2PreTrainedModel):
...
@@ -1416,6 +1416,14 @@ class Wav2Vec2ForCTC(Wav2Vec2PreTrainedModel):
self
.
wav2vec2
=
Wav2Vec2Model
(
config
)
self
.
wav2vec2
=
Wav2Vec2Model
(
config
)
self
.
dropout
=
nn
.
Dropout
(
config
.
final_dropout
)
self
.
dropout
=
nn
.
Dropout
(
config
.
final_dropout
)
if
config
.
vocab_size
is
None
:
raise
ValueError
(
f
"You are trying to instantiate
{
self
.
__class__
}
with a configuration that "
"does not define the vocabulary size of the language model head. Please "
"instantiate the model as follows: `Wav2Vec2ForCTC.from_pretrained(..., vocab_size=vocab_size)`."
"or define `vocab_size` of your model's configuration."
)
self
.
lm_head
=
nn
.
Linear
(
config
.
hidden_size
,
config
.
vocab_size
)
self
.
lm_head
=
nn
.
Linear
(
config
.
hidden_size
,
config
.
vocab_size
)
self
.
init_weights
()
self
.
init_weights
()
...
...
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