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
f2ffcaf4
Unverified
Commit
f2ffcaf4
authored
May 10, 2021
by
Tommy Chiang
Committed by
GitHub
May 09, 2021
Browse files
[Examples] Check key exists in datasets first (#11503)
parent
ba0d50f2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
examples/pytorch/multiple-choice/run_swag.py
examples/pytorch/multiple-choice/run_swag.py
+1
-1
examples/pytorch/summarization/run_summarization.py
examples/pytorch/summarization/run_summarization.py
+1
-1
examples/pytorch/translation/run_translation.py
examples/pytorch/translation/run_translation.py
+1
-1
No files found.
examples/pytorch/multiple-choice/run_swag.py
View file @
f2ffcaf4
...
...
@@ -347,9 +347,9 @@ def main():
return
{
k
:
[
v
[
i
:
i
+
4
]
for
i
in
range
(
0
,
len
(
v
),
4
)]
for
k
,
v
in
tokenized_examples
.
items
()}
if
training_args
.
do_train
:
train_dataset
=
datasets
[
"train"
]
if
"train"
not
in
datasets
:
raise
ValueError
(
"--do_train requires a train dataset"
)
train_dataset
=
datasets
[
"train"
]
if
data_args
.
max_train_samples
is
not
None
:
train_dataset
=
train_dataset
.
select
(
range
(
data_args
.
max_train_samples
))
train_dataset
=
train_dataset
.
map
(
...
...
examples/pytorch/summarization/run_summarization.py
View file @
f2ffcaf4
...
...
@@ -422,9 +422,9 @@ def main():
return
model_inputs
if
training_args
.
do_train
:
train_dataset
=
datasets
[
"train"
]
if
"train"
not
in
datasets
:
raise
ValueError
(
"--do_train requires a train dataset"
)
train_dataset
=
datasets
[
"train"
]
if
data_args
.
max_train_samples
is
not
None
:
train_dataset
=
train_dataset
.
select
(
range
(
data_args
.
max_train_samples
))
train_dataset
=
train_dataset
.
map
(
...
...
examples/pytorch/translation/run_translation.py
View file @
f2ffcaf4
...
...
@@ -416,9 +416,9 @@ def main():
return
model_inputs
if
training_args
.
do_train
:
train_dataset
=
datasets
[
"train"
]
if
"train"
not
in
datasets
:
raise
ValueError
(
"--do_train requires a train dataset"
)
train_dataset
=
datasets
[
"train"
]
if
data_args
.
max_train_samples
is
not
None
:
train_dataset
=
train_dataset
.
select
(
range
(
data_args
.
max_train_samples
))
train_dataset
=
train_dataset
.
map
(
...
...
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