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
6690a61b
Unverified
Commit
6690a61b
authored
Jun 21, 2022
by
ver217
Committed by
GitHub
Jun 21, 2022
Browse files
[hotfix] prevent nested ZeRO (#1140)
parent
15aab147
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
colossalai/zero/sharded_model/sharded_model_v2.py
colossalai/zero/sharded_model/sharded_model_v2.py
+1
-0
colossalai/zero/sharded_optim/sharded_optim_v2.py
colossalai/zero/sharded_optim/sharded_optim_v2.py
+1
-0
No files found.
colossalai/zero/sharded_model/sharded_model_v2.py
View file @
6690a61b
...
...
@@ -77,6 +77,7 @@ class ShardedModelV2(nn.Module):
tensor_placement_policy
:
str
=
'cuda'
,
gradient_predivide_factor
:
Optional
[
float
]
=
1.0
,
reuse_fp16_shard
:
bool
=
False
):
assert
not
isinstance
(
module
,
ShardedModelV2
),
'Nested ShardedModelV2 is not supported.'
super
().
__init__
()
self
.
logger
=
get_dist_logger
()
...
...
colossalai/zero/sharded_optim/sharded_optim_v2.py
View file @
6690a61b
...
...
@@ -87,6 +87,7 @@ class ShardedOptimizerV2(ColossalaiOptimizer):
mp_process_group
:
Optional
[
ProcessGroup
]
=
None
,
verbose
:
bool
=
False
)
->
None
:
assert
isinstance
(
sharded_model
,
ShardedModelV2
),
'model must be wrapped with ShardedModel'
assert
not
isinstance
(
optimizer
,
ShardedOptimizerV2
),
'Nested ShardedOptimizerV2 is not supported.'
super
().
__init__
(
optimizer
)
self
.
shard_strategy
=
sharded_model
.
shard_strategy
...
...
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