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
129f0604
Unverified
Commit
129f0604
authored
Feb 23, 2020
by
Sam Shleifer
Committed by
GitHub
Feb 23, 2020
Browse files
Delete untested, broken Model2LSTM (#2968)
parent
0e84559d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
19 deletions
+0
-19
src/transformers/modeling_encoder_decoder.py
src/transformers/modeling_encoder_decoder.py
+0
-19
No files found.
src/transformers/modeling_encoder_decoder.py
View file @
129f0604
...
...
@@ -18,7 +18,6 @@
import
logging
import
os
import
torch
from
torch
import
nn
from
.modeling_auto
import
AutoModel
,
AutoModelWithLMHead
...
...
@@ -294,21 +293,3 @@ class Model2Model(PreTrainedEncoderDecoder):
)
return
model
class
Model2LSTM
(
PreTrainedEncoderDecoder
):
@
classmethod
def
from_pretrained
(
cls
,
*
args
,
**
kwargs
):
if
kwargs
.
get
(
"decoder_model"
,
None
)
is
None
:
# We will create a randomly initilized LSTM model as decoder
if
"decoder_config"
not
in
kwargs
:
raise
ValueError
(
"To load an LSTM in Encoder-Decoder model, please supply either: "
" - a torch.nn.LSTM model as `decoder_model` parameter (`decoder_model=lstm_model`), or"
" - a dictionary of configuration parameters that will be used to initialize a"
" torch.nn.LSTM model as `decoder_config` keyword argument. "
" E.g. `decoder_config={'input_size': 768, 'hidden_size': 768, 'num_layers': 2}`"
)
kwargs
[
"decoder_model"
]
=
torch
.
nn
.
LSTM
(
kwargs
.
pop
(
"decoder_config"
))
model
=
super
().
from_pretrained
(
*
args
,
**
kwargs
)
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