MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / configure_accumulated_gradients

Method configure_accumulated_gradients

utils/pl_utils.py:1085–1094  ·  view source on GitHub ↗
(self, accumulate_grad_batches)

Source from the content-addressed store, hash-verified

1083 logging.info(param, param.grad)
1084
1085 def configure_accumulated_gradients(self, accumulate_grad_batches):
1086 self.accumulate_grad_batches = None
1087
1088 if isinstance(accumulate_grad_batches, dict):
1089 self.accumulation_scheduler = GradientAccumulationScheduler(accumulate_grad_batches)
1090 elif isinstance(accumulate_grad_batches, int):
1091 schedule = {1: accumulate_grad_batches}
1092 self.accumulation_scheduler = GradientAccumulationScheduler(schedule)
1093 else:
1094 raise TypeError("Gradient accumulation supports only int and dict types")
1095
1096 def get_dataloaders(self, model):
1097 if not self.testing:

Callers 1

__init__Method · 0.95

Calls 1

Tested by

no test coverage detected