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
57c8e822
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "ab7551cd7ff84cb5b7328bc37a06e06fa19f02bb"
Unverified
Commit
57c8e822
authored
Apr 30, 2021
by
Suraj Patil
Committed by
GitHub
Apr 30, 2021
Browse files
reszie token embeds (#11524)
parent
20d6931e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
examples/pytorch/summarization/run_summarization.py
examples/pytorch/summarization/run_summarization.py
+2
-0
examples/pytorch/translation/run_translation.py
examples/pytorch/translation/run_translation.py
+2
-0
No files found.
examples/pytorch/summarization/run_summarization.py
View file @
57c8e822
...
@@ -353,6 +353,8 @@ def main():
...
@@ -353,6 +353,8 @@ def main():
use_auth_token
=
True
if
model_args
.
use_auth_token
else
None
,
use_auth_token
=
True
if
model_args
.
use_auth_token
else
None
,
)
)
model
.
resize_token_embeddings
(
len
(
tokenizer
))
if
model
.
config
.
decoder_start_token_id
is
None
:
if
model
.
config
.
decoder_start_token_id
is
None
:
raise
ValueError
(
"Make sure that `config.decoder_start_token_id` is correctly defined"
)
raise
ValueError
(
"Make sure that `config.decoder_start_token_id` is correctly defined"
)
...
...
examples/pytorch/translation/run_translation.py
View file @
57c8e822
...
@@ -337,6 +337,8 @@ def main():
...
@@ -337,6 +337,8 @@ def main():
use_auth_token
=
True
if
model_args
.
use_auth_token
else
None
,
use_auth_token
=
True
if
model_args
.
use_auth_token
else
None
,
)
)
model
.
resize_token_embeddings
(
len
(
tokenizer
))
# Set decoder_start_token_id
# Set decoder_start_token_id
if
model
.
config
.
decoder_start_token_id
is
None
and
isinstance
(
tokenizer
,
(
MBartTokenizer
,
MBartTokenizerFast
)):
if
model
.
config
.
decoder_start_token_id
is
None
and
isinstance
(
tokenizer
,
(
MBartTokenizer
,
MBartTokenizerFast
)):
if
isinstance
(
tokenizer
,
MBartTokenizer
):
if
isinstance
(
tokenizer
,
MBartTokenizer
):
...
...
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