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
286dc19a
Unverified
Commit
286dc19a
authored
Oct 27, 2020
by
Jonathan Chang
Committed by
GitHub
Oct 27, 2020
Browse files
Fix IterableDataset with __len__ in Trainer (#8095)
parent
d93acd6f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/transformers/trainer.py
src/transformers/trainer.py
+3
-1
No files found.
src/transformers/trainer.py
View file @
286dc19a
...
...
@@ -384,7 +384,9 @@ class Trainer:
dataset
.
set_format
(
type
=
dataset
.
format
[
"type"
],
columns
=
columns
)
def
_get_train_sampler
(
self
)
->
Optional
[
torch
.
utils
.
data
.
sampler
.
Sampler
]:
if
not
isinstance
(
self
.
train_dataset
,
collections
.
abc
.
Sized
):
if
isinstance
(
self
.
train_dataset
,
torch
.
utils
.
data
.
IterableDataset
)
or
not
isinstance
(
self
.
train_dataset
,
collections
.
abc
.
Sized
):
return
None
elif
is_torch_tpu_available
():
return
get_tpu_sampler
(
self
.
train_dataset
)
...
...
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