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
f566c6e3
Unverified
Commit
f566c6e3
authored
Dec 23, 2021
by
Sylvain Gugger
Committed by
GitHub
Dec 23, 2021
Browse files
Fix failing GPU trainer tests (#14903)
* Fix failing GPU trainer tests * Remove print statements
parent
fe4197ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
tests/extended/test_trainer_ext.py
tests/extended/test_trainer_ext.py
+2
-0
tests/test_trainer.py
tests/test_trainer.py
+1
-7
No files found.
tests/extended/test_trainer_ext.py
View file @
f566c6e3
...
...
@@ -130,6 +130,7 @@ class TestTrainerExt(TestCasePlus):
self
.
run_seq2seq_quick
(
distributed
=
True
,
extra_args_str
=
"--sharded_ddp simple"
)
# test --sharded_ddp w/ --fp16
@
unittest
.
skip
(
"Requires an update of the env running those tests"
)
@
require_torch_multi_gpu
@
require_fairscale
def
test_run_seq2seq_sharded_ddp_fp16
(
self
):
...
...
@@ -142,6 +143,7 @@ class TestTrainerExt(TestCasePlus):
self
.
run_seq2seq_quick
(
distributed
=
True
,
extra_args_str
=
"--sharded_ddp zero_dp_2"
,
predict_with_generate
=
False
)
# test --sharded_ddp zero_dp_2 w/ --fp16
@
unittest
.
skip
(
"Requires an update of the env running those tests"
)
@
require_torch_multi_gpu
@
require_fairscale
def
test_run_seq2seq_fully_sharded_ddp_fp16
(
self
):
...
...
tests/test_trainer.py
View file @
f566c6e3
...
...
@@ -1093,17 +1093,13 @@ class TrainerIntegrationTest(TestCasePlus, TrainerIntegrationCommon):
self
.
assertIsInstance
(
loader
.
sampler
,
torch
.
utils
.
data
.
dataloader
.
_InfiniteConstantSampler
)
def
test_training_finite_iterable_dataset
(
self
):
num_gpus
=
max
(
1
,
get_gpu_count
())
if
num_gpus
>
2
:
return
config
=
RegressionModelConfig
()
model
=
RegressionPreTrainedModel
(
config
)
batch_size
=
1
num_samples
=
10
available_steps
=
num_samples
//
(
batch_size
*
num_gpus
)
available_steps
=
num_samples
//
batch_size
data
=
FiniteIterableDataset
(
length
=
num_samples
)
train_args
=
TrainingArguments
(
...
...
@@ -1510,7 +1506,6 @@ class TrainerIntegrationWithHubTester(unittest.TestCase):
expected_commits
=
[
f
"Training in progress, epoch
{
i
}
"
for
i
in
range
(
3
,
0
,
-
1
)]
expected_commits
.
append
(
"initial commit"
)
self
.
assertListEqual
(
commits
,
expected_commits
)
print
(
commits
,
len
(
commits
))
def
test_push_to_hub_with_saves_each_n_steps
(
self
):
num_gpus
=
max
(
1
,
get_gpu_count
())
...
...
@@ -1534,7 +1529,6 @@ class TrainerIntegrationWithHubTester(unittest.TestCase):
expected_commits
=
[
f
"Training in progress, step
{
i
}
"
for
i
in
range
(
total_steps
,
0
,
-
5
)]
expected_commits
.
append
(
"initial commit"
)
self
.
assertListEqual
(
commits
,
expected_commits
)
print
(
commits
,
len
(
commits
))
@
require_torch
...
...
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