Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PyTorch] Fix fusible ops checkpoint #1395

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 1 addition & 13 deletions transformer_engine/pytorch/ops/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,6 @@ def get_extra_state(self) -> torch.Tensor:
# See: https://github.com/NVIDIA/TransformerEngine/pull/351
# See: https://github.com/NVIDIA/TransformerEngine/pull/363

# Return immediately if op has no FP8 state
has_fp8_state = any(
self.num_fp8_scales(mode) > 0 for mode in ("input", "param", "grad_output")
)
if not has_fp8_state:
return torch.Tensor()

def to_cpu(src: torch.Tensor) -> torch.Tensor:
"""Helper function to make CPU copy of tensor

Expand All @@ -548,12 +541,7 @@ def to_cpu(src: torch.Tensor) -> torch.Tensor:
# Store FP8 state
state = {}
for mode in ("input", "param", "grad_output"):

# Get state for a given FP8 tensor
if self.num_fp8_scales(mode) == 0:
state[mode] = None
continue
fp8_meta = self.get_fp8_meta(mode)
fp8_meta = self._fp8_metas
if fp8_meta is None:
continue
state[mode] = {}
Expand Down
Loading