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
4da84008
"vscode:/vscode.git/clone" did not exist on "ebb62e8880229e893c82d4b760927ef6aa4579a4"
Unverified
Commit
4da84008
authored
Jun 12, 2023
by
Zach Mueller
Committed by
GitHub
Jun 12, 2023
Browse files
Finish dataloader integration (#24201)
parent
0675600a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
12 deletions
+1
-12
src/transformers/trainer.py
src/transformers/trainer.py
+1
-12
No files found.
src/transformers/trainer.py
View file @
4da84008
...
@@ -176,7 +176,6 @@ if is_datasets_available():
...
@@ -176,7 +176,6 @@ if is_datasets_available():
if
is_torch_tpu_available
(
check_device
=
False
):
if
is_torch_tpu_available
(
check_device
=
False
):
import
torch_xla.core.xla_model
as
xm
import
torch_xla.core.xla_model
as
xm
import
torch_xla.debug.metrics
as
met
import
torch_xla.debug.metrics
as
met
import
torch_xla.distributed.parallel_loader
as
pl
if
is_fairscale_available
():
if
is_fairscale_available
():
dep_version_check
(
"fairscale"
)
dep_version_check
(
"fairscale"
)
...
@@ -1762,10 +1761,6 @@ class Trainer:
...
@@ -1762,10 +1761,6 @@ class Trainer:
total_batched_samples
=
0
total_batched_samples
=
0
for
epoch
in
range
(
epochs_trained
,
num_train_epochs
):
for
epoch
in
range
(
epochs_trained
,
num_train_epochs
):
if
is_torch_tpu_available
():
parallel_loader
=
pl
.
ParallelLoader
(
train_dataloader
,
[
args
.
device
]).
per_device_loader
(
args
.
device
)
epoch_iterator
=
parallel_loader
else
:
epoch_iterator
=
train_dataloader
epoch_iterator
=
train_dataloader
# Reset the past mems state at the beginning of each epoch if necessary.
# Reset the past mems state at the beginning of each epoch if necessary.
...
@@ -3088,9 +3083,6 @@ class Trainer:
...
@@ -3088,9 +3083,6 @@ class Trainer:
# Do this before wrapping.
# Do this before wrapping.
eval_dataset
=
getattr
(
dataloader
,
"dataset"
,
None
)
eval_dataset
=
getattr
(
dataloader
,
"dataset"
,
None
)
if
is_torch_tpu_available
():
dataloader
=
pl
.
ParallelLoader
(
dataloader
,
[
args
.
device
]).
per_device_loader
(
args
.
device
)
if
args
.
past_index
>=
0
:
if
args
.
past_index
>=
0
:
self
.
_past
=
None
self
.
_past
=
None
...
@@ -3694,9 +3686,6 @@ class Trainer:
...
@@ -3694,9 +3686,6 @@ class Trainer:
model
.
eval
()
model
.
eval
()
if
is_torch_tpu_available
():
dataloader
=
pl
.
ParallelLoader
(
dataloader
,
[
args
.
device
]).
per_device_loader
(
args
.
device
)
if
args
.
past_index
>=
0
:
if
args
.
past_index
>=
0
:
self
.
_past
=
None
self
.
_past
=
None
...
...
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