code: def __init__(
      self,
      name,
      indexed_dataset,
      data_prefix,
      num_epochs,
      max_num_samples,
      masked_lm_prob,
      max_seq_length,
      short_seq_prob,
      seed,
      binary_head,
  ):
      # Params to store.
      self.name = name
      self.seed = seed
      self.masked_lm_prob = masked_lm_prob
      self.max_seq_length = max_seq_length
      self.binary_head = binary_head
  
      # Dataset.
      self.indexed_dataset = indexed_dataset
  
      # Build the samples mapping.
      self.samples_mapping = get_samples_mapping_(
          self.indexed_dataset,
          data_prefix,
          num_epochs,
          max_num_samples,
          self.max_seq_length - 3,  # account for added tokens,
          short_seq_prob,
          self.seed,
          self.name,
          self.binary_head,
      )
  
      # Vocab stuff.
      tokenizer = get_tokenizer()
      self.vocab_id_list = list(tokenizer.inv_vocab.keys())
      self.vocab_id_to_token_dict = tokenizer.inv_vocab
      self.cls_id = tokenizer.cls
      self.sep_id = tokenizer.sep
      self.mask_id = tokenizer.mask
      self.pad_id = tokenizer.pad
  
file_path: ColossalAI/examples/tutorial/sequence_parallel/data/datasets/bert_dataset.py
imports: import os
  import time
  import numpy
  import torch
  from torch.utils.data import Dataset
  from colossalai.legacy.context import ParallelMode
  from colossalai.legacy.core import global_context
  from colossalai.logging import get_dist_logger
  from ..tokenizer import get_tokenizer
  from .dataset_utils import create_masked_lm_predictions, create_tokens_and_tokentypes, get_a_and_b_segments, pad_and_convert_to_numpy, truncate_segments
label_desc: Use image node_id 1 to create a new BertDataset object from inherited base classes: Dataset with example: obj = BertDataset(name, indexed_dataset, data_prefix, num_epochs, max_num_samples, masked_lm_prob, max_seq_length, short_seq_prob, seed, binary_head)