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
OpenDAS
ColossalAI
Commits
2b834187
Unverified
Commit
2b834187
authored
Jan 11, 2024
by
Frank Lee
Committed by
GitHub
Jan 11, 2024
Browse files
[ci] fixed ddp test (#5254)
* [ci] fixed ddp test * polish
parent
d5eeeb14
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
tests/kit/model_zoo/registry.py
tests/kit/model_zoo/registry.py
+16
-2
tests/test_shardformer/test_with_torch_ddp.py
tests/test_shardformer/test_with_torch_ddp.py
+1
-1
No files found.
tests/kit/model_zoo/registry.py
View file @
2b834187
...
@@ -61,7 +61,7 @@ class ModelZooRegistry(dict):
...
@@ -61,7 +61,7 @@ class ModelZooRegistry(dict):
"""
"""
self
[
name
]
=
(
model_fn
,
data_gen_fn
,
output_transform_fn
,
loss_fn
,
model_attribute
)
self
[
name
]
=
(
model_fn
,
data_gen_fn
,
output_transform_fn
,
loss_fn
,
model_attribute
)
def
get_sub_registry
(
self
,
keyword
:
Union
[
str
,
List
[
str
]]):
def
get_sub_registry
(
self
,
keyword
:
Union
[
str
,
List
[
str
]]
,
exclude
:
Union
[
str
,
List
[
str
]]
=
None
):
"""
"""
Get a sub registry with models that contain the keyword.
Get a sub registry with models that contain the keyword.
...
@@ -76,9 +76,23 @@ class ModelZooRegistry(dict):
...
@@ -76,9 +76,23 @@ class ModelZooRegistry(dict):
keyword_list
=
keyword
keyword_list
=
keyword
assert
isinstance
(
keyword_list
,
(
list
,
tuple
))
assert
isinstance
(
keyword_list
,
(
list
,
tuple
))
if
exclude
is
None
:
exclude_keywords
=
[]
elif
isinstance
(
exclude
,
str
):
exclude_keywords
=
[
exclude
]
else
:
exclude_keywords
=
exclude
assert
isinstance
(
exclude_keywords
,
(
list
,
tuple
))
for
k
,
v
in
self
.
items
():
for
k
,
v
in
self
.
items
():
for
kw
in
keyword_list
:
for
kw
in
keyword_list
:
if
kw
in
k
:
if
kw
in
k
:
should_exclude
=
False
for
ex_kw
in
exclude_keywords
:
if
ex_kw
in
k
:
should_exclude
=
True
if
not
should_exclude
:
new_dict
[
k
]
=
v
new_dict
[
k
]
=
v
assert
len
(
new_dict
)
>
0
,
f
"No model found with keyword
{
keyword
}
"
assert
len
(
new_dict
)
>
0
,
f
"No model found with keyword
{
keyword
}
"
...
...
tests/test_shardformer/test_with_torch_ddp.py
View file @
2b834187
...
@@ -16,7 +16,7 @@ from tests.kit.model_zoo import model_zoo
...
@@ -16,7 +16,7 @@ from tests.kit.model_zoo import model_zoo
@
parameterize
(
"lazy_init"
,
[
True
,
False
])
@
parameterize
(
"lazy_init"
,
[
True
,
False
])
def
check_shardformer_with_ddp
(
lazy_init
:
bool
):
def
check_shardformer_with_ddp
(
lazy_init
:
bool
):
sub_model_zoo
=
model_zoo
.
get_sub_registry
(
"transformers_gpt"
)
sub_model_zoo
=
model_zoo
.
get_sub_registry
(
"transformers_gpt"
,
exclude
=
"transformers_gptj"
)
# create shardformer
# create shardformer
# ranks: [0, 1, 2, 3]
# ranks: [0, 1, 2, 3]
...
...
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