示例#1
0
        elif arguments['activation'].startswith('pnorm'):
            do_pnorm = True
            pool_size, pnorm_order = parse_two_integers(arguments['activation'])

    train_dataset, train_dataset_args = read_data_args(train_data_spec)
    valid_dataset, valid_dataset_args = read_data_args(valid_data_spec)
    train_sets, train_xy, train_x, train_y = read_dataset(train_dataset, train_dataset_args)
    valid_sets, valid_xy, valid_x, valid_y = read_dataset(valid_dataset, valid_dataset_args)

    numpy_rng = numpy.random.RandomState(89677)
    theano_rng = RandomStreams(numpy_rng.randint(2 ** 30))
    log('> ... building the model')
    # doesn't deal with dropout 
    dnn = DNN_SAT(numpy_rng=numpy_rng, theano_rng = theano_rng, n_ins=n_ins,
              hidden_layers_sizes=hidden_layers_sizes, n_outs=n_outs,
              activation = activation, do_maxout = do_maxout, pool_size = pool_size,
              do_pnorm = do_pnorm, pnorm_order = pnorm_order,
              max_col_norm = max_col_norm, l1_reg = l1_reg, l2_reg = l2_reg,
              ivec_dim = ivec_dim, ivec_layers_sizes = ivec_layers_sizes)
    # read the initial DNN 
    _file2nnet(dnn.sigmoid_layers, filename = si_model_file)

    # get the training, validation and testing function for iVecNN
    dnn.params = dnn.ivec_params
    dnn.delta_params = dnn.ivec_delta_params
    log('> ... getting the finetuning functions for iVecNN')
    train_fn, valid_fn = dnn.build_finetune_functions(
                (train_x, train_y), (valid_x, valid_y),
                batch_size=batch_size)

    log('> ... learning the iVecNN network')
    while (lrate.get_rate() != 0):
示例#2
0
    cfg_si.init_data_reading(train_data_spec, valid_data_spec)
    # parse the structure of the i-vector network
    cfg_adapt = NetworkConfig()
    #    net_split = adapt_nnet_spec.split(':')
    #    adapt_nnet_spec = ''
    #    for n in xrange(len(net_split) - 1):
    #        adapt_nnet_spec += net_split[n] + ':'
    #    cfg_adapt.parse_config_dnn(arguments, adapt_nnet_spec + '0')
    cfg_adapt.parse_config_dnn(arguments, adapt_nnet_spec + ':0')

    numpy_rng = numpy.random.RandomState(89677)
    theano_rng = RandomStreams(numpy_rng.randint(2**30))
    log('> ... initializing the model')
    # setup up the model
    dnn = DNN_SAT(numpy_rng=numpy_rng,
                  theano_rng=theano_rng,
                  cfg_si=cfg_si,
                  cfg_adapt=cfg_adapt)
    # read the initial DNN  (the SI DNN which has been well trained)
    _file2nnet(dnn.dnn_si.layers, filename=init_model_file)

    # get the training and  validation functions for adaptation network training
    dnn.params = dnn.dnn_adapt.params  # only update the parameters of the i-vector nnet
    dnn.delta_params = dnn.dnn_adapt.delta_params
    log('> ... getting the finetuning functions for iVecNN')
    train_fn, valid_fn = dnn.build_finetune_functions(
        (cfg_si.train_x, cfg_si.train_y), (cfg_si.valid_x, cfg_si.valid_y),
        batch_size=cfg_adapt.batch_size)

    log('> ... learning the adaptation network')
    cfg = cfg_adapt
    while (cfg.lrate.get_rate() != 0):
示例#3
0
    cfg_si.parse_config_dnn(arguments, si_nnet_spec)
    cfg_si.init_data_reading(train_data_spec, valid_data_spec)   
    # parse the structure of the i-vector network 
    cfg_adapt = NetworkConfig()
#    net_split = adapt_nnet_spec.split(':')
#    adapt_nnet_spec = ''
#    for n in xrange(len(net_split) - 1):
#        adapt_nnet_spec += net_split[n] + ':'
#    cfg_adapt.parse_config_dnn(arguments, adapt_nnet_spec + '0')
    cfg_adapt.parse_config_dnn(arguments, adapt_nnet_spec + ':0')

    numpy_rng = numpy.random.RandomState(89677)
    theano_rng = RandomStreams(numpy_rng.randint(2 ** 30))
    log('> ... initializing the model')
    # setup up the model 
    dnn = DNN_SAT(numpy_rng=numpy_rng, theano_rng = theano_rng, cfg_si = cfg_si, cfg_adapt = cfg_adapt)
    # read the initial DNN  (the SI DNN which has been well trained)
    _file2nnet(dnn.dnn_si.layers, filename = init_model_file)

    # get the training and  validation functions for adaptation network training
    dnn.params = dnn.dnn_adapt.params  # only update the parameters of the i-vector nnet
    dnn.delta_params = dnn.dnn_adapt.delta_params
    log('> ... getting the finetuning functions for iVecNN')
    train_fn, valid_fn = dnn.build_finetune_functions(
                (cfg_si.train_x, cfg_si.train_y), (cfg_si.valid_x, cfg_si.valid_y),
                batch_size = cfg_adapt.batch_size)

    log('> ... learning the adaptation network')
    cfg = cfg_adapt
    while (cfg.lrate.get_rate() != 0):
        # one epoch of sgd training