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
386e86e2
Commit
386e86e2
authored
Oct 07, 2019
by
Rémi Louf
Browse files
raise exception when class initialized with __init__
parent
4446c02b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
transformers/modeling_seq2seq.py
transformers/modeling_seq2seq.py
+5
-3
No files found.
transformers/modeling_seq2seq.py
View file @
386e86e2
...
@@ -17,11 +17,13 @@
...
@@ -17,11 +17,13 @@
class
Seq2SeqModel
(
object
):
class
Seq2SeqModel
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
# need to use from_pretrained to initialize
raise
EnvironmentError
(
raise
NotImplementedError
"""Seq2Seq is designed to be instantiated using the
`Seq2Seq.from_pretrained(encoder_name_or_path, decoder_name_or_path)` method."""
)
@
classmethod
@
classmethod
def
from_pretrained
(
cls
,
encoder
,
decoder
):
def
from_pretrained
(
cls
,
encoder
_name
,
decoder
_name
):
# Here we should call AutoModel to initialize the models depending
# Here we should call AutoModel to initialize the models depending
# on the pretrained models taken as an input.
# on the pretrained models taken as an input.
# For a first iteration we only work with Bert.
# For a first iteration we only work with Bert.
...
...
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