def main(cfg): logging.info(f'Hydra config: {cfg.pretty()}') trainer = pl.Trainer(**cfg.trainer) log_dir = exp_manager(trainer, cfg.get("exp_manager", None)) speaker_model = EncDecSpeakerLabelModel(cfg=cfg.model, trainer=trainer) trainer.fit(speaker_model) model_path = os.path.join(log_dir, '..', 'spkr.nemo') speaker_model.save_to(model_path) if hasattr(cfg.model, 'test_ds') and cfg.model.test_ds.manifest_filepath is not None: gpu = 1 if cfg.trainer.gpus != 0 else 0 trainer = pl.Trainer(gpus=gpu) if speaker_model.prepare_test(trainer): trainer.test(speaker_model)
def main(cfg): logging.info(f'Hydra config: {OmegaConf.to_yaml(cfg)}') trainer = pl.Trainer(**cfg.trainer) log_dir = exp_manager(trainer, cfg.get("exp_manager", None)) speaker_model = EncDecSpeakerLabelModel(cfg=cfg.model, trainer=trainer) trainer.fit(speaker_model) if not trainer.fast_dev_run: model_path = os.path.join(log_dir, '..', 'spkr.nemo') speaker_model.save_to(model_path) if hasattr(cfg.model, 'test_ds') and cfg.model.test_ds.manifest_filepath is not None: trainer = pl.Trainer(devices=1, accelerator=cfg.trainer.accelerator) if speaker_model.prepare_test(trainer): trainer.test(speaker_model)