class_docstr: Dataset for already preprocessed data.
class_docstr_tok: ["Dataset","for","already","preprocessed","data","."]
docstr: Args:
      input_file: data file in hdf5 format with preprocessed data in array format
      max_predictions_per_seq: maximum number of masked tokens per sequence. Need to be consistent with data in input file.
docstr_tok: ["Args",":","input_file",":","data","file","in","hdf5","format","with","preprocessed","data","in","array","format","max_predictions_per_seq",":","maximum","number","of","masked","tokens","per","sequence",".","Need","to","be","consistent","with","data","in","input","file","."]
code: def __init__(self, input_file: str, max_predictions_per_seq: int):
      """
      Args:
          input_file: data file in hdf5 format with preprocessed data in array format
          max_predictions_per_seq: maximum number of masked tokens per sequence. Need to be consistent with data in input file.
      """
      self.input_file = input_file
      self.max_predictions_per_seq = max_predictions_per_seq
      f = load_h5(input_file)
      keys = [
          "input_ids",
          "input_mask",
          "segment_ids",
          "masked_lm_positions",
          "masked_lm_ids",
          "next_sentence_labels",
      ]
      self.inputs = [np.asarray(f[key][:]) for key in keys]
      f.close()
  
imports: import array
  import os
  import pickle
  import random
  from typing import Dict, List, Optional
  import h5py
  import numpy
  from torch.utils.data import DataLoader, DistributedSampler
  from tqdm import tqdm
  from nemo.collections.nlp.data.data_utils.data_preprocessing import find_newlines, load_data_indices
  from nemo.core.classes import Dataset
label_desc: Use image node_id 1 to create a new BertPretrainingPreprocessedDataset object from inherited base classes: Dataset with example: obj = BertPretrainingPreprocessedDataset(input_file, max_predictions_per_seq)