Beispiel #1
0
def enhance_with_model(experiment_name, loadpath, cuda=False, samples=None):
    checkpoint = load_to_cpu(loadpath)
    p = checkpoint['p']
    model = p['model_class'](**p['model_kwargs'])
    model.load_state_dict(checkpoint['state_dict'])

    model.transform = p['input_transform']
    model.transform.target_transform = None
    model.output_transform = p['output_transform']
    model.inverse_transform = istft
    model.experiment_name = experiment_name  # this is a hack

    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)
Beispiel #2
0
def clean_overfit(experiment_name, loadpath, p):
    model = p['model_class'](**p['model_kwargs'])
    model.load_state_dict(load_to_cpu(loadpath)['state_dict'])

    model.transform = p['input_transform']
    model.transform.target_transform = None
    model.output_transform = p['output_transform']
    model.inverse_transform = istft
    model.experiment_name = 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_lre17tel_dev(model, cuda=cuda, samples=samples)
Beispiel #3
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)
import os

from src.features.features_functions import istft
from src.evaluation.eval_BLSTM_A0 import (
    clean_lre17_dev, clean_lre17_eval, clean_dataset_3_eval, clean_dataset_4_eval,
    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)
Beispiel #5
0
    output_dir = os.path.join('data', 'interim', 'dataset_4_val',
                              model.experiment_name)
    enhance_Datafolder(model,
                       input_dir,
                       output_dir,
                       batch_size=10,
                       cuda=cuda,
                       samples=samples)


if __name__ == '__main__':
    # experiment_name = 'BLSTM_A5_27'
    # loadpath = os.path.join('models', 'BLSTM_A5',
    #                         'BLSTM_A5_epoch_27.state')
    # enhance_with_model(experiment_name, loadpath)

    experiment_name, loadpath, cuda = False, samples = None

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

    model.transform = p['input_transform']
    model.transform.target_transform = None
    model.output_transform = p['output_transform']
    model.inverse_transform = istft
    model.experiment_name = experiment_name  # this is a hack

    clean_dataset_4_eval(model, cuda=cuda, samples=samples)