def main(hparams): """Main training routine specific for this project.""" # ------------------------ # 1 INIT LIGHTNING MODEL # ------------------------ model = LightningTemplateModel(hparams) # ------------------------ # 2 INIT TRAINER # ------------------------ trainer = pl.Trainer(gpus=2, num_nodes=2, distributed_backend='ddp') # ------------------------ # 3 START TRAINING # ------------------------ trainer.fit(model)
def main(hparams): """ Main training routine specific for this project :param hparams: """ # ------------------------ # 1 INIT LIGHTNING MODEL # ------------------------ model = LightningTemplateModel(hparams) # ------------------------ # 2 INIT TRAINER # ------------------------ trainer = pl.Trainer() # ------------------------ # 3 START TRAINING # ------------------------ trainer.fit(model)
def main(hparams): """ Main training routine specific for this project :param hparams: """ # ------------------------ # 1 INIT LIGHTNING MODEL # ------------------------ model = LightningTemplateModel(hparams) # ------------------------ # 2 INIT TRAINER # ------------------------ trainer = Trainer(gpus=hparams.gpus, distributed_backend=hparams.distributed_backend, use_amp=hparams.use_16bit) # ------------------------ # 3 START TRAINING # ------------------------ trainer.fit(model)
model = LightningTemplateModel(hparams) # ------------------------ # 2 INIT TRAINER # ------------------------ trainer = pl.Trainer() # ------------------------ # 3 START TRAINING # ------------------------ trainer.fit(model) if __name__ == '__main__': # ------------------------ # TRAINING ARGUMENTS # ------------------------ # these are project-wide arguments root_dir = os.path.dirname(os.path.realpath(__file__)) parent_parser = ArgumentParser(add_help=False) # each LightningModule defines arguments relevant to it parser = LightningTemplateModel.add_model_specific_args( parent_parser, root_dir) hyperparams = parser.parse_args() # --------------------- # RUN TRAINING # --------------------- main(hyperparams)