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
b4773273
Unverified
Commit
b4773273
authored
Sep 13, 2023
by
Sourab Mangrulkar
Committed by
GitHub
Sep 13, 2023
Browse files
fix the deepspeed tests (#26021)
* fix the deepspeed tests * resolve comment
parent
73b13ac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
tests/deepspeed/test_deepspeed.py
tests/deepspeed/test_deepspeed.py
+5
-8
No files found.
tests/deepspeed/test_deepspeed.py
View file @
b4773273
...
@@ -379,19 +379,16 @@ class TrainerIntegrationDeepSpeed(TrainerIntegrationDeepSpeedWithCustomConfig, T
...
@@ -379,19 +379,16 @@ class TrainerIntegrationDeepSpeed(TrainerIntegrationDeepSpeedWithCustomConfig, T
self
.
assertNotEqual
(
new_a
,
a
)
self
.
assertNotEqual
(
new_a
,
a
)
def
test_hf_scheduler_ds_optimizer
(
self
):
def
test_hf_scheduler_ds_optimizer
(
self
):
a
=
0
with
mockenv_context
(
**
self
.
dist_env_1_gpu
):
with
mockenv_context
(
**
self
.
dist_env_1_gpu
):
ds_config_zero2_dict
=
self
.
get_config_dict
(
ZERO2
)
ds_config_zero2_dict
=
self
.
get_config_dict
(
ZERO2
)
del
ds_config_zero2_dict
[
"scheduler"
]
# force default HF Trainer scheduler
del
ds_config_zero2_dict
[
"scheduler"
]
# force default HF Trainer scheduler
ds_config_zero2_dict
[
"zero_optimization"
][
"offload_optimizer"
][
"device"
]
=
"none"
ds_config_zero2_dict
[
"zero_optimization"
][
"offload_optimizer"
][
"device"
]
=
"none"
ds_config_zero2_dict
[
"fp16"
][
"initial_scale_power"
]
=
1
# force optimizer on the first step
ds_config_zero2_dict
[
"fp16"
][
"initial_scale_power"
]
=
1
# force optimizer on the first step
trainer
=
get_regression_trainer
(
local_rank
=
0
,
fp16
=
True
,
deepspeed
=
ds_config_zero2_dict
)
trainer
=
get_regression_trainer
(
a
=
a
,
local_rank
=
0
,
fp16
=
True
,
deepspeed
=
ds_config_zero2_dict
)
with
self
.
assertRaises
(
Exception
)
as
context
:
trainer
.
train
()
trainer
.
train
()
new_a
=
trainer
.
model
.
a
.
item
()
self
.
assertIn
(
self
.
assertNotEqual
(
new_a
,
a
)
"Found `optimizer` configured in the DeepSpeed config, but no `scheduler`. "
"Please configure a scheduler in the DeepSpeed config."
,
str
(
context
.
exception
),
)
@
require_deepspeed_aio
@
require_deepspeed_aio
def
test_stage3_nvme_offload
(
self
):
def
test_stage3_nvme_offload
(
self
):
...
...
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