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
4f5faaf0
Unverified
Commit
4f5faaf0
authored
Feb 03, 2022
by
Stas Bekman
Committed by
GitHub
Feb 03, 2022
Browse files
[deepspeed] fix a bug in a test (#15493)
* [deepspeed] fix a bug in a test * consistency
parent
90166121
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
tests/deepspeed/test_deepspeed.py
tests/deepspeed/test_deepspeed.py
+5
-4
No files found.
tests/deepspeed/test_deepspeed.py
View file @
4f5faaf0
...
@@ -25,6 +25,7 @@ from transformers.deepspeed import HfDeepSpeedConfig, is_deepspeed_available
...
@@ -25,6 +25,7 @@ from transformers.deepspeed import HfDeepSpeedConfig, is_deepspeed_available
from
transformers.file_utils
import
WEIGHTS_NAME
from
transformers.file_utils
import
WEIGHTS_NAME
from
transformers.testing_utils
import
(
from
transformers.testing_utils
import
(
CaptureLogger
,
CaptureLogger
,
CaptureStd
,
CaptureStderr
,
CaptureStderr
,
ExtendSysPath
,
ExtendSysPath
,
LoggingLevel
,
LoggingLevel
,
...
@@ -972,7 +973,7 @@ class TestDeepSpeedWithLauncher(TestCasePlus):
...
@@ -972,7 +973,7 @@ class TestDeepSpeedWithLauncher(TestCasePlus):
# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
with
CaptureStderr
()
as
cs
:
with
CaptureStderr
()
as
cs
:
execute_subprocess_async
(
cmd
,
env
=
self
.
get_env
())
execute_subprocess_async
(
cmd
,
env
=
self
.
get_env
())
assert
"Detected DeepSpeed ZeRO-3"
in
cs
.
err
self
.
assert
In
(
"Detected DeepSpeed ZeRO-3"
,
cs
.
err
)
@
parameterized
.
expand
(
stages
)
@
parameterized
.
expand
(
stages
)
def
test_load_best_model
(
self
,
stage
):
def
test_load_best_model
(
self
,
stage
):
...
@@ -1008,14 +1009,14 @@ class TestDeepSpeedWithLauncher(TestCasePlus):
...
@@ -1008,14 +1009,14 @@ class TestDeepSpeedWithLauncher(TestCasePlus):
"""
.
split
()
"""
.
split
()
args
.
extend
([
"--source_prefix"
,
"translate English to Romanian: "
])
args
.
extend
([
"--source_prefix"
,
"translate English to Romanian: "
])
ds_args
=
f
"--deepspeed
{
self
.
test_file_dir_str
}
/ds_config_
zero3
.json"
.
split
()
ds_args
=
f
"--deepspeed
{
self
.
test_file_dir_str
}
/ds_config_
{
stage
}
.json"
.
split
()
script
=
[
f
"
{
self
.
examples_dir_str
}
/pytorch/translation/run_translation.py"
]
script
=
[
f
"
{
self
.
examples_dir_str
}
/pytorch/translation/run_translation.py"
]
launcher
=
get_launcher
(
distributed
=
False
)
launcher
=
get_launcher
(
distributed
=
False
)
cmd
=
launcher
+
script
+
args
+
ds_args
cmd
=
launcher
+
script
+
args
+
ds_args
# keep for quick debug
# keep for quick debug
# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
with
CaptureStd
err
()
as
cs
:
with
CaptureStd
()
as
cs
:
execute_subprocess_async
(
cmd
,
env
=
self
.
get_env
())
execute_subprocess_async
(
cmd
,
env
=
self
.
get_env
())
# enough to test it didn't fail
# enough to test it didn't fail
assert
"Detected DeepSpeed ZeRO-3"
in
cs
.
err
self
.
assert
In
(
"DeepSpeed info"
,
cs
.
out
)
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