def preprocess_MLPerf(model, checkpoint_name, folds, fp16, list_of_lists, output_filenames, preprocessing_folder, num_threads_preprocessing):
    assert (len(list_of_lists) == len(output_filenames))
    print('loading parameters for folds', folds)
    (trainer, params) = load_model_and_checkpoint_files(model, folds, fp16, checkpoint_name=checkpoint_name)
    print('starting preprocessing generator')
    preprocessing = preprocess_multithreaded(trainer, list_of_lists, output_filenames, num_threads_preprocessing, None)
    print('Preprocessing images...')
    all_output_files = []
    for preprocessed in preprocessing:
        (output_filename, (d, dct)) = preprocessed
        all_output_files.append(output_filename)
        if isinstance(d, str):
            data = np.load(d)
            os.remove(d)
            d = data
        d = pad_nd_image(d, trainer.patch_size, 'constant', None, False, None)
        with open(os.path.join(preprocessing_folder, (output_filename + '.pkl')), 'wb') as f:
            pickle.dump([d, dct], f)
        f.close()
    return all_output_files
def preprocess_MLPerf(model, checkpoint_name, folds, fp16, list_of_lists, output_filenames, preprocessing_folder, num_threads_preprocessing):
    assert (len(list_of_lists) == len(output_filenames))
    print('loading parameters for folds', folds)
    (trainer, params) = load_model_and_checkpoint_files(model, folds, fp16, checkpoint_name=checkpoint_name)
    print('starting preprocessing generator')
    preprocessing = preprocess_multithreaded(trainer, list_of_lists, output_filenames, num_threads_preprocessing, None)
    print('Preprocessing images...')
    all_output_files = []
    for preprocessed in preprocessing:
        (output_filename, (d, dct)) = preprocessed
        all_output_files.append(output_filename)
        if isinstance(d, str):
            data = np.load(d)
            os.remove(d)
            d = data
        d = pad_nd_image(d, trainer.patch_size, 'constant', None, False, None)
        with open(os.path.join(preprocessing_folder, (output_filename + '.pkl')), 'wb') as f:
            pickle.dump([d, dct], f)
        f.close()
    return all_output_files