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
1 change: 1 addition & 0 deletions modules/trainer/GenericTrainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ def __optimizer_step(tensor: Tensor, param_group=param_group, i=i):
tensor.grad = None

def __grad_hook(tensor: Tensor, param_group=param_group, i=i):
init_compile() # workaround for https://github.com/pytorch/pytorch/issues/186537
if self.__is_update_step(self.model.train_progress):
if fused_reduce:
multi.reduce_grads_mean(
Expand Down
4 changes: 1 addition & 3 deletions modules/util/checkpointing_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ def __init__(self, orig_module: nn.Module, orig_forward, train_device: torch.dev
self.layer_index = layer_index

def __checkpointing_forward(self, dummy: torch.Tensor, call_id: int, *args):
# during the backward pass, this runs on an autograd worker thread, which needs its own
# dynamo config initialization (see init_compile)
init_compile()
init_compile() # workaround for https://github.com/pytorch/pytorch/issues/186537
if self.layer_index == 0 and not torch.is_grad_enabled():
self.conductor.start_forward(True)

Expand Down