def __init__(self, file, key_file, batch_size=64, feat_dim=40, n_labels=1024, procs=10, extras1=10, extras2=10, num_extras1=1, nbest=100, mode='train', shuffle=False, mod=1):
    self.file = file
    self.batch_size = batch_size
    self.feat_dim = feat_dim
    self.n_labels = n_labels
    self.procs = procs
    self.extras1 = extras1
    self.extras2 = extras2
    self.num_extras1 = num_extras1
    self.nbest = nbest
    self.shuffle = shuffle
    self.keys = []
    self.sorted_keys = []
    self.mode = mode
    self.mod = 1
    self.h5fd = h5py.File(self.file, 'r')
    self.n_samples = len(self.h5fd.keys())
    if (key_file is not None):
        with open(key_file, 'r') as f:
            for line in f:
                self.sorted_keys.append(line.strip())
    for key in self.h5fd.keys():
        self.keys.append(key)
    self.n_samples = len(self.h5fd.keys())
    for key in self.h5fd.keys():
        self.keys.append(key)
    if (len(self.sorted_keys) > 0):
        self.keys = self.sorted_keys
def __init__(self, file, key_file, batch_size=64, feat_dim=40, n_labels=1024, procs=10, extras1=10, extras2=10, num_extras1=1, nbest=100, mode='train', shuffle=False, mod=1):
    self.file = file
    self.batch_size = batch_size
    self.feat_dim = feat_dim
    self.n_labels = n_labels
    self.procs = procs
    self.extras1 = extras1
    self.extras2 = extras2
    self.num_extras1 = num_extras1
    self.nbest = nbest
    self.shuffle = shuffle
    self.keys = []
    self.sorted_keys = []
    self.mode = mode
    self.mod = 1
    self.h5fd = h5py.File(self.file, 'r')
    self.n_samples = len(self.h5fd.keys())
    if (key_file is not None):
        with open(key_file, 'r') as f:
            for line in f:
                self.sorted_keys.append(line.strip())
    for key in self.h5fd.keys():
        self.keys.append(key)
    self.n_samples = len(self.h5fd.keys())
    for key in self.h5fd.keys():
        self.keys.append(key)
    if (len(self.sorted_keys) > 0):
        self.keys = self.sorted_keys