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
5b185430
Unverified
Commit
5b185430
authored
Feb 02, 2023
by
ver217
Committed by
GitHub
Feb 02, 2023
Browse files
[hotfix] fix zero ddp warmup check (#2545)
parent
fa3d66fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
colossalai/gemini/gemini_mgr.py
colossalai/gemini/gemini_mgr.py
+4
-0
colossalai/nn/parallel/data_parallel.py
colossalai/nn/parallel/data_parallel.py
+2
-1
No files found.
colossalai/gemini/gemini_mgr.py
View file @
5b185430
...
@@ -58,6 +58,10 @@ class GeminiManager:
...
@@ -58,6 +58,10 @@ class GeminiManager:
self
.
_evict_time
=
0
self
.
_evict_time
=
0
self
.
_comp_cuda_demand_time
=
0
self
.
_comp_cuda_demand_time
=
0
@
property
def
need_warmup
(
self
)
->
bool
:
return
self
.
policy_name
in
(
'auto'
,
'const'
)
def
is_warmup
(
self
):
def
is_warmup
(
self
):
return
self
.
_warmup
return
self
.
_warmup
...
...
colossalai/nn/parallel/data_parallel.py
View file @
5b185430
...
@@ -269,7 +269,8 @@ class ZeroDDP(ColoDDP):
...
@@ -269,7 +269,8 @@ class ZeroDDP(ColoDDP):
# check whether we are in a inference mode
# check whether we are in a inference mode
grad_flag
=
torch
.
is_grad_enabled
()
grad_flag
=
torch
.
is_grad_enabled
()
if
not
grad_flag
:
if
not
grad_flag
:
assert
not
self
.
gemini_manager
.
is_warmup
(),
"You should run a completed iteration as your warmup iter"
assert
not
self
.
gemini_manager
.
need_warmup
or
not
self
.
gemini_manager
.
is_warmup
(
),
"You should run a completed iteration as your warmup iter"
args
,
kwargs
=
_cast_float
(
args
,
torch
.
half
),
_cast_float
(
kwargs
,
torch
.
half
)
args
,
kwargs
=
_cast_float
(
args
,
torch
.
half
),
_cast_float
(
kwargs
,
torch
.
half
)
self
.
module
.
zero_grad
(
set_to_none
=
True
)
self
.
module
.
zero_grad
(
set_to_none
=
True
)
...
...
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