if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-l", "--linguistic_model", type=str, required=True)
    parser.add_argument("-a", "--acoustic_model", type=str, required=True)
    args = parser.parse_args()

    assert isfile(
        args.acoustic_model), "acoustic_model weights file does not exist"
    assert isfile(args.acoustic_model.replace(
        ".torch", ".json")), "acoustic_model config file does not exist"
    assert isfile(
        args.linguistic_model), "linguistic_model weights file does not exist"
    assert isfile(args.linguistic_model.replace(
        ".torch", ".json")), "linguistic_model config file does not exist"

    test_features_acoustic, test_labels_acoustic, val_features_acoustic, val_labels_acoustic, _, _ = load_spectrogram_dataset(
    )
    test_iterator_acoustic = BatchIterator(test_features_acoustic,
                                           test_labels_acoustic, 100)
    test_features_linguistic, test_labels_linguistic, val_features_linguistic, val_labels_linguistic, _, _ = load_linguistic_dataset(
    )
    test_iterator_linguistic = BatchIterator(test_features_linguistic,
                                             test_labels_linguistic, 100)
    val_iterator_acoustic = BatchIterator(val_features_acoustic,
                                          val_labels_acoustic, 100)
    val_iterator_linguistic = BatchIterator(val_features_linguistic,
                                            val_labels_linguistic, 100)

    assert np.array_equal(
        test_labels_acoustic, test_labels_linguistic
    ), "Labels for acoustic and linguistic datasets are not the same!"
    """Choosing hardware"""
    parser.add_argument("-m", "--model_type", type=str, default="linguistic")
    args = parser.parse_args()

    if args.model_type == "linguistic":
        cfg = LinguisticConfig()
        test_features, test_labels, val_features, val_labels, train_features, train_labels = load_linguistic_dataset(
        )
        model = RNN(cfg)
    elif args.model_type == "acoustic-lld":
        cfg = AcousticLLDConfig()
        test_features, test_labels, val_features, val_labels, train_features, train_labels = load_acoustic_features_dataset(
        )
        model = RNN(cfg)
    elif args.model_type == "acoustic-spectrogram":
        cfg = AcousticSpectrogramConfig()
        test_features, test_labels, val_features, val_labels, train_features, train_labels = load_spectrogram_dataset(
        )
        model = CNN(cfg)
    else:
        raise Exception(
            "model_type parameter has to be one of [linguistic|acoustic-lld|acoustic-spectrogram]"
        )

    print(
        "Subsets sizes: test_features:{}, test_labels:{}, val_features:{}, val_labels:{}, train_features:{}, train_labels:{}"
        .format(test_features.shape[0], test_labels.shape[0],
                val_features.shape[0], val_labels.shape[0],
                train_features.shape[0], train_labels.shape[0]))
    """Running training"""
    run_training(model, cfg, test_features, test_labels, train_features,
                 train_labels, val_features, val_labels)