Пример #1
0
 def parse_config_cnn(self, arguments, nnet_spec, conv_nnet_spec):
     self.parse_config_dnn(arguments, nnet_spec)
     # parse convolutional layer structure
     self.conv_layer_configs = parse_conv_spec(conv_nnet_spec, self.batch_size)
     # parse convolutional layer activation
     # parse activation function, including maxout
     if arguments.has_key('conv_activation'):
         self.conv_activation_text = arguments['conv_activation']
         self.conv_activation = parse_activation(arguments['conv_activation'])
         # maxout not supported yet
     # whether we use the fast version of convolution 
     if arguments.has_key('use_fast'):
         self.use_fast = string_2_bool(arguments['use_fast'])
Пример #2
0
def read_data_args(data_spec):
    elements = data_spec.split(",")
    pfile_path_list = glob.glob(elements[0])
    dataset_args = {}
    # default settings
    dataset_args['type'] = 'pickle'
    dataset_args['random'] = False
    dataset_args['stream'] = False
    dataset_args['partition'] = 1024 * 1024 * 600  # by default the partition size is 600m if stream is True

    # the type of the data: pickle, pfile   TO-DO: HDF5
    if '.pickle' in data_spec:
        dataset_args['type'] = 'pickle'
    elif '.pfile' in data_spec:
        dataset_args['type'] = 'pfile'
    elif '.scp' in data_spec:
        dataset_args['type'] = 'kaldi'
    else:
        dataset_args['type'] = ''

    for i in range(1, len(elements)):
        element = elements[i]
        arg_value = element.split("=")
        value = arg_value[1]
        key = arg_value[0]
        if key == 'partition':
            dataset_args['partition'] = 1024 * 1024 * int(value.replace('m',''))
        elif key == 'stream':
            dataset_args['stream'] = string_2_bool(value) # not supported for now
        elif key == 'random':
            dataset_args['random'] = string_2_bool(value)
        elif key == 'label':
            dataset_args['label'] = value
        else:
            dataset_args[key] = value  # left context & right context; maybe different
    return pfile_path_list, dataset_args