Exemple #1
0
def clean_overfit(experiment_name, loadpath):
    from src.models.BLSTM_A5 import p

    model = p['model_class'](**p['model_kwargs'])
    model.load_state_dict(load_to_cpu(loadpath)['state_dict'])

    model.experiment_name = experiment_name
    model.transform = p['input_transform']
    model.transform.mode = 'runtime'

    model.apply_mask = apply_mask
    model.inverse_transform = istft

    samples = None  # slice(-1,None,-1)
    cuda = True
    if cuda:
        model.cuda()

    clean_lre17_dev(model, cuda=cuda, samples=samples)
    clean_lre17_eval(model, cuda=cuda, samples=samples)
    clean_lre17tel_dev(model, cuda=cuda, samples=samples)
    clean_lre17tel_eval(model, cuda=cuda, samples=samples)
    clean_dataset_4_eval(model, cuda=cuda, samples=samples)
    clean_lre17tel_dev, clean_lre17tel_eval, clean_lre17tel_train)
from src.models.model_functions import apply_mask, load_to_cpu


if __name__ == '__main__':
    from src.models.BLSTM_A11 import p
    model = p['model_class'](**p['model_kwargs'])
    loadpath = os.path.join('models', 'BLSTM_A11',
                            'BLSTM_A11_epoch_32.state')

    model.load_state_dict(load_to_cpu(loadpath)['state_dict'])

    model.transform = p['input_transform']
    model.transform.mode = 'runtime'

    model.apply_mask = apply_mask
    model.inverse_transform = istft
    model.experiment_name = p['experiment_name']  # this is a hack

    samples = None  # slice(-1,None,-1)
    cuda = True
    if cuda:
        model.cuda()

    clean_lre17_dev(model, cuda=cuda, samples=samples)
    clean_lre17_eval(model, cuda=cuda, samples=samples)
    clean_dataset_4_eval(model, cuda=cuda, samples=samples)
    clean_lre17tel_dev(model, cuda=cuda, samples=samples)
    clean_lre17tel_eval(model, cuda=cuda, samples=samples)
    # clean_lre17tel_train(model, cuda=cuda, samples=samples)