Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def async_save(self, state_dict, *args, **kwargs):
preloaded_sd = preload_tensors(state_dict)
torch.cuda.synchronize()
async_request = AsyncRequest(
TorchAsyncCheckpoint.async_fn, (preloaded_sd, *args), [], kwargs
TorchAsyncCheckpoint.async_fn, (preloaded_sd, *args), [], kwargs or {}
)
self._async_calls_queue.schedule_async_request(async_request)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def finalize_fn():
# we must wait for D2H to complete before returning control to the training
with debug_time("ckpt_D2H_synchronize", logger):
torch.cuda.synchronize()
return AsyncRequest(save_fn, save_args, [finalize_fn])
return AsyncRequest(save_fn, save_args, [finalize_fn], async_fn_kwargs={})

assert not is_async
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwargs inside the function def async_save(self, state_dict, *args, **kwargs): should be {} if nothing is passed to async_save so I don't think this should cause any error.

save_fn(*save_args)
Expand Down
4 changes: 3 additions & 1 deletion tests/checkpointing/unit/test_async_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def finalize_fn():
"""Finalizes async checkpointing and synchronizes processes."""
save_state_dict_async_finalize(*save_state_dict_ret)

return AsyncRequest(save_fn, save_args, [finalize_fn], preload_fn=preload_fn)
return AsyncRequest(
save_fn, save_args, [finalize_fn], preload_fn=preload_fn, async_fn_kwargs={}
)

def async_save_checkpoint(
self,
Expand Down
4 changes: 3 additions & 1 deletion tests/checkpointing/unit/test_async_writer_msc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def finalize_fn():
save_state_dict_async_finalize(*save_state_dict_ret)
torch.distributed.barrier()

return AsyncRequest(save_fn, save_args, [finalize_fn], preload_fn=preload_fn)
return AsyncRequest(
save_fn, save_args, [finalize_fn], preload_fn=preload_fn, async_fn_kwargs={}
)

def async_save_checkpoint(
self, checkpoint_dir, state_dict, planner, async_queue, thread_count=1
Expand Down