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
d9d387af
Commit
d9d387af
authored
Oct 14, 2019
by
thomwolf
Browse files
clean up
parent
b7141a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
transformers/modeling_seq2seq.py
transformers/modeling_seq2seq.py
+1
-5
No files found.
transformers/modeling_seq2seq.py
View file @
d9d387af
...
...
@@ -127,12 +127,8 @@ class PreTrainedSeq2seq(nn.Module):
decoder
=
decoder_model
else
:
kwargs
.
update
(
decoder_kwargs
)
# Replace encoder kwargs with decoder specific kwargs like config, state_dict, etc...
kwargs
[
'is_decoder'
]
=
True
# Make sure the decoder will be a
n
decoder
kwargs
[
'is_decoder'
]
=
True
# Make sure the decoder will be a decoder
decoder
=
AutoModelWithLMHead
.
from_pretrained
(
decoder_pretrained_model_name_or_path
,
**
kwargs
)
else
:
raise
ValueError
(
"Unrecognized model identifier in {}. Should contains one of "
"'bert', 'openai-gpt', 'gpt2', 'transfo-xl', 'xlnet', "
"'xlm', 'roberta'"
.
format
(
decoder_pretrained_model_name_or_path
))
model
=
cls
(
encoder
,
decoder
)
return
model
...
...
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