class_docstr: Builder class for the MMapIndexedDataset class
  
  Args:
      bin_path (str): The path to the data (.bin) file
  
      dtype (Type[numpy.number], optional): The dtype of the index file. Defaults to numpy.int32.
  
      multimodal (bool, optional): Whether the dataset is multimodal. Defaults to False.
class_docstr_tok: ["Builder","class","for","the","MMapIndexedDataset","class","Args",":","bin_path","(","str",")",":","The","path","to","the","data","(",".bin",")","file","dtype","(","Type","[","numpy.number","]",",","optional",")",":","The","dtype","of","the","index","file",".","Defaults","to","numpy.int32",".","multimodal","(","bool",",","optional",")",":","Whether","the","dataset","is","multimodal",".","Defaults","to","False","."]
docstr: Clean up and write the index (.idx) file
  
  Args:
      idx_path (str): The path to the index file
docstr_tok: ["Clean","up","and","write","the","index","(",".idx",")","file","Args",":","idx_path","(","str",")",":","The","path","to","the","index","file"]
code: def finalize(self, idx_path: str) -> None:
      """Clean up and write the index (.idx) file
  
      Args:
          idx_path (str): The path to the index file
      """
      self.data_file.close()
      with _IndexWriter(idx_path, self.dtype) as writer:
          writer.write(
              self.sequence_lengths,
              self.sequence_modes,
              self.document_indices,
          )
  
imports: import logging
  import os
  import shutil
  import struct
  import time
  from enum import Enum
  from functools import lru_cache
  from itertools import accumulate
  from types import TracebackType
  from typing import List, Optional, Tuple, Type, Union
  import numpy
  import torch
  from megatron.core.datasets.utils import log_single_rank
label_desc: Use image node_id 6 for calling the MMapIndexedDatasetBuilder obj's underlying member method code with example usage: obj.finalize(idx_path) without return types