def _save_as_numpy(predictions, output_directory, saved_keys):
    predictions = predictions[[c for c in predictions.columns if c not in saved_keys]]
    npy_filename = os.path.join(output_directory, "{}.npy")
    numpy_predictions = to_numpy_dataset(predictions)
    for k, v in numpy_predictions.items():
        if k not in saved_keys:
            k = k.replace("<", "[").replace(">", "]")  # Replace <UNK> and <PAD>
            np.save(npy_filename.format(k), v)
            saved_keys.add(k)
Exemple #2
0
def _save_as_numpy(predictions, output_directory, saved_keys):
    predictions = predictions[[
        c for c in predictions.columns if c not in saved_keys
    ]]
    npy_filename = os.path.join(output_directory, '{}.npy')
    numpy_predictions = to_numpy_dataset(predictions)
    for k, v in numpy_predictions.items():
        if k not in saved_keys:
            np.save(npy_filename.format(k), v)
            saved_keys.add(k)
Exemple #3
0
 def __init__(self, dataset, features, data_hdf5_fp):
     self.features = features
     self.data_hdf5_fp = data_hdf5_fp
     self.size = len(dataset)
     self.dataset = to_numpy_dataset(dataset)