Skip to content

Commit f459502

Browse files
delockloadamssfc-gh-truwase
authored
rollback #6726 (#7258)
This PR rollback #6726 which caused #7116 . --------- Signed-off-by: Guokai Ma <[email protected]> Co-authored-by: Logan Adams <[email protected]> Co-authored-by: Olatunji Ruwase <[email protected]>
1 parent d46947d commit f459502

File tree

3 files changed

+3
-56
lines changed

3 files changed

+3
-56
lines changed

deepspeed/runtime/zero/parameter_offload.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ def _run_before_forward_function(input):
372372

373373
@torch.compiler.disable
374374
def _post_backward_module_hook(module, inputs):
375-
if not hasattr(module, "ds_grads_remaining"):
376-
module.ds_grads_remaining = 0
375+
module.ds_grads_remaining = 0
377376

378377
return apply_to_tensors_only(module.post_bwd_fn.apply,
379378
inputs,

deepspeed/runtime/zero/partitioned_param_coordinator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def reset_step(self) -> None:
261261
self.__most_recent_step_id_param_fetched_for = collections.defaultdict(lambda: int(-1e10))
262262
self.__step_id_module_fetched_for = collections.defaultdict(lambda: collections.deque())
263263
self.__step_id = 0
264+
self.__n_available_params = 0
264265
self.__profiler.reset_events()
265266

266267
def _dump_params(self, tag, sub_module, params, step_id=None):
@@ -451,7 +452,7 @@ def release_and_reset_all(self, module: Module) -> None:
451452
# there's a hook execution issue
452453
param.ds_active_sub_modules.clear()
453454
self.__release_param(param)
454-
self.__n_available_params = 0
455+
455456
for param in iter_params(module, recurse=True):
456457
if param.ds_status != ZeroParamStatus.NOT_AVAILABLE:
457458
raise RuntimeError(f"{param.ds_summary()} expected to be released")

tests/unit/runtime/zero/test_zero_multiple_run.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)