Beispiel #1
0
        prepare_wsjmix,
        kwargs={
            "datapath": hparams["data_folder"],
            "savepath": hparams["save_folder"],
            "n_spks": hparams["num_spks"],
            "skip_prep": hparams["skip_prep"],
        },
    )

    # Create dataset objects
    if hparams["dynamic_mixing"]:

        if hparams["num_spks"] == 2:
            from dynamic_mixing import dynamic_mix_data_prep  # noqa

            train_data = dynamic_mix_data_prep(hparams)
        elif hparams["num_spks"] == 3:
            from dynamic_mixing import dynamic_mix_data_prep_3mix  # noqa

            train_data = dynamic_mix_data_prep_3mix(hparams)
        else:
            raise ValueError(
                "The specified number of speakers is not supported.")
        _, valid_data, test_data = dataio_prep(hparams)
    else:
        train_data, valid_data, test_data = dataio_prep(hparams)

    # Brain class initialization
    separator = Separation(
        modules=hparams["modules"],
        opt_class=hparams["optimizer"],
Beispiel #2
0
                )
                # adjust the base_folder_dm path
                hparams["base_folder_dm"] = (
                    os.path.normpath(hparams["base_folder_dm"]) + "_processed")
            else:
                print(
                    "Using the existing processed folder on the same directory as base_folder_dm"
                )
                hparams["base_folder_dm"] = (
                    os.path.normpath(hparams["base_folder_dm"]) + "_processed")

        train_data = dynamic_mix_data_prep(
            tr_csv=hparams["train_data"],
            data_root_folder=hparams["data_folder"],
            base_folder_dm=hparams["base_folder_dm"],
            sample_rate=hparams["sample_rate"],
            num_spks=hparams["num_spks"],
            max_training_signal_len=hparams["training_signal_len"],
            batch_size=hparams["dataloader_opts"]["batch_size"],
            num_workers=hparams["dataloader_opts"]["num_workers"],
        )

        _, valid_data, test_data = dataio_prep(hparams)
    else:
        train_data, valid_data, test_data = dataio_prep(hparams)

    # Load pretrained model if pretrained_separator is present in the yaml
    if "pretrained_separator" in hparams:
        run_on_main(hparams["pretrained_separator"].collect_files)
        hparams["pretrained_separator"].load_collected()

    # Brain class initialization