Skip to content

Commit

Permalink
make 'load_directly_on_device' configurable (#9657)
Browse files Browse the repository at this point in the history
Signed-off-by: ashors1 <ashors@nvidia.com>
Co-authored-by: Pablo Garay <palenq@gmail.com>
  • Loading branch information
2 people authored and web-flow committed Jul 10, 2024
1 parent 14d42dc commit 9916007
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nemo/lightning/pytorch/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def __init__(
ckpt_parallel_save=True,
ckpt_parallel_load=False,
ckpt_parallel_save_optim=True,
ckpt_load_directly_on_device=True,
setup_optimizers: bool = True,
init_model_parallel: bool = True,
**kwargs,
) -> None:
super().__init__(
Expand Down Expand Up @@ -141,6 +144,7 @@ def __init__(
self.parallel_save = ckpt_parallel_save
self.parallel_load = ckpt_parallel_load
self.parallel_save_optim = ckpt_parallel_save_optim
self.load_directly_on_device = ckpt_load_directly_on_device

self._ddp = ddp
if ddp == "megatron":
Expand Down Expand Up @@ -567,6 +571,7 @@ def checkpoint_io(self) -> CheckpointIO:
assume_constant_structure=self.assume_constant_structure,
parallel_save=self.parallel_save,
parallel_load=self.parallel_load,
load_directly_on_device=self.load_directly_on_device,
)
if async_save:
self._checkpoint_io = AsyncFinalizableCheckpointIO(self._checkpoint_io)
Expand Down

0 comments on commit 9916007

Please sign in to comment.