from dv3.hparams import hparams, hparams_debug_string import dv3.train from dv3.train import TextDataSource, MelSpecDataSource from nnmnkwii.datasets import FileSourceDataset from tqdm import trange from dv3.deepvoice3_pytorch import frontend if __name__ == "__main__": args = docopt(__doc__) data_root = args["<data_root>"] preset = args["--preset"] # Load preset if specified if preset is not None: with open(preset) as f: hparams.parse_json(f.read()) # Override hyper parameters hparams.parse(args["--hparams"]) assert hparams.name == "deepvoice3" train._frontend = getattr(frontend, hparams.frontend) # Code below X = FileSourceDataset(TextDataSource(data_root)) Mel = FileSourceDataset(MelSpecDataSource(data_root)) in_sizes = [] out_sizes = [] for i in trange(len(X)): x, m = X[i], Mel[i] if X.file_data_source.multi_speaker:
else: assert False, "must be specified wrong args" # Override hyper parameters # For Speaker Adaptation hparams.parse( 'builder=deepvoice3_multispeaker,preset=deepvoice3_speaker_adaptation_vctk' ) print(hparams_debug_string()) assert hparams.name == "deepvoice3" # Presets if hparams.preset is not None and hparams.preset != "": preset = hparams.presets[hparams.preset] import json hparams.parse_json(json.dumps(preset)) print("Override hyper parameters with preset \"{}\": {}".format( hparams.preset, json.dumps(preset, indent=4))) _frontend = getattr(frontend, hparams.frontend) os.makedirs(checkpoint_dir, exist_ok=True) # Input dataset definitions dataset_split = 1 #Split number 1 for training X = FileSourceDataset(TextDataSource(data_root, speaker_id, dataset_split)) Mel = FileSourceDataset( MelSpecDataSource(data_root, speaker_id, dataset_split)) Y = FileSourceDataset( LinearSpecDataSource(data_root, speaker_id, dataset_split))