Skip to content

Commit

Permalink
Dtensor oom (#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
dakinggg authored Jul 25, 2024
1 parent cfab70e commit e882658
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llmfoundry/callbacks/hf_checkpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ def tensor_hook(
state_dict[fqn] = tensor
else:
state_dict[fqn] = None
# Convert the state dict to the requested precision
if isinstance(tensor, torch.Tensor):
state_dict[fqn] = tensor.to(dtype=self.dtype)

if isinstance(state_dict[fqn], torch.Tensor):
state_dict[fqn] = state_dict[fqn].to(dtype=self.dtype)
del tensor
if dist.get_global_rank() != 0:
state_dict = {}
Expand Down

0 comments on commit e882658

Please sign in to comment.