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
7e4de520
"git@developer.sourcefind.cn:OpenDAS/colossalai.git" did not exist on "d7f8db8e21fe63d4279afafadc6ed4663952cba8"
Commit
7e4de520
authored
Jul 14, 2023
by
Hongxin Liu
Browse files
[shardformer] fix base policy (#4229)
parent
208ac8f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
colossalai/shardformer/policies/base_policy.py
colossalai/shardformer/policies/base_policy.py
+8
-2
No files found.
colossalai/shardformer/policies/base_policy.py
View file @
7e4de520
...
@@ -156,7 +156,10 @@ class Policy(ABC):
...
@@ -156,7 +156,10 @@ class Policy(ABC):
# append or create a new description
# append or create a new description
if
target_key
in
policy
:
if
target_key
in
policy
:
policy
[
target_key
].
sub_module_replacement
.
extend
(
description
)
if
policy
[
target_key
].
sub_module_replacement
is
None
:
policy
[
target_key
].
sub_module_replacement
=
description
else
:
policy
[
target_key
].
sub_module_replacement
.
extend
(
description
)
else
:
else
:
policy
[
target_key
]
=
ModulePolicyDescription
(
sub_module_replacement
=
description
)
policy
[
target_key
]
=
ModulePolicyDescription
(
sub_module_replacement
=
description
)
...
@@ -174,7 +177,10 @@ class Policy(ABC):
...
@@ -174,7 +177,10 @@ class Policy(ABC):
target_key (Union[str, nn.Module]): the key of the policy to be updated
target_key (Union[str, nn.Module]): the key of the policy to be updated
"""
"""
if
target_key
in
policy
:
if
target_key
in
policy
:
policy
[
target_key
].
method_replacement
.
update
(
description
)
if
policy
[
target_key
].
method_replacement
is
None
:
policy
[
target_key
].
method_replacement
=
description
else
:
policy
[
target_key
].
method_replacement
.
update
(
description
)
else
:
else
:
policy
[
target_key
]
=
ModulePolicyDescription
(
method_replacement
=
description
)
policy
[
target_key
]
=
ModulePolicyDescription
(
method_replacement
=
description
)
...
...
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