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
0e1869cc
Commit
0e1869cc
authored
Jun 03, 2020
by
Setu Shah
Committed by
Julien Chaumond
Jun 04, 2020
Browse files
Add drop_last arg for data loader
parent
48a05026
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
src/transformers/trainer.py
src/transformers/trainer.py
+2
-0
src/transformers/training_args.py
src/transformers/training_args.py
+4
-0
No files found.
src/transformers/trainer.py
View file @
0e1869cc
...
...
@@ -240,6 +240,7 @@ class Trainer:
batch_size
=
self
.
args
.
train_batch_size
,
sampler
=
train_sampler
,
collate_fn
=
self
.
data_collator
.
collate_batch
,
drop_last
=
self
.
args
.
dataloader_drop_last
,
)
return
data_loader
...
...
@@ -264,6 +265,7 @@ class Trainer:
sampler
=
sampler
,
batch_size
=
self
.
args
.
eval_batch_size
,
collate_fn
=
self
.
data_collator
.
collate_batch
,
drop_last
=
self
.
args
.
dataloader_drop_last
,
)
return
data_loader
...
...
src/transformers/training_args.py
View file @
0e1869cc
...
...
@@ -133,6 +133,10 @@ class TrainingArguments:
)
tpu_metrics_debug
:
bool
=
field
(
default
=
False
,
metadata
=
{
"help"
:
"TPU: Whether to print debug metrics"
})
dataloader_drop_last
:
bool
=
field
(
default
=
False
,
metadata
=
{
"help"
:
"Drop the last incomplete batch if it is not divisible by the batch size."
}
)
@
property
def
train_batch_size
(
self
)
->
int
:
if
self
.
per_gpu_train_batch_size
:
...
...
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