MCPcopy Create free account
hub / github.com/apple/ml-pointersect / epoch_setup

Method epoch_setup

pointersect/script/train_v2.py:1445–1461  ·  view source on GitHub ↗

Set up at the beginning of an epoch, before dataloder iterator is constructed. It can be used to setup the batch sampler, etc.

(
            self,
            epoch: int,
            dataloader: T.Sequence[T.Any],
            val_dataloader: T.Sequence[T.Any],
            test_dataloader: T.Sequence[T.Any],
    )

Source from the content-addressed store, hash-verified

1443 logger.info(f'plotting used {plot_time} secs')
1444
1445 def epoch_setup(
1446 self,
1447 epoch: int,
1448 dataloader: T.Sequence[T.Any],
1449 val_dataloader: T.Sequence[T.Any],
1450 test_dataloader: T.Sequence[T.Any],
1451 ):
1452 """Set up at the beginning of an epoch, before dataloder iterator
1453 is constructed. It can be used to setup the batch sampler, etc."""
1454
1455 # used when distribution learning
1456 if self.train_sampler is not None:
1457 self.train_sampler.set_epoch(epoch)
1458 if self.valid_sampler is not None:
1459 self.valid_sampler.set_epoch(epoch)
1460 if self.test_sampler is not None:
1461 self.test_sampler.set_epoch(epoch)
1462
1463
1464if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

set_epochMethod · 0.80

Tested by

no test coverage detected