code: def compact_dataset(path: str):
      """Compact the dataset, removes blocks which the files were deleted.
  
      **Note** This may affect the existing dataset state dict.
  
      Args:
          path (str): path to dataset
  
      Example:
          >>> compact_dataset("/path/to/dataset")
  
      """
  
      meta_path = os.path.join(path, "meta.bin")
  
      info: List[FileInfo] = []
      if os.path.exists(meta_path):
          info = _read_info_list(meta_path)
      else:
          raise ValueError("Dataset not exists")
  
      nw_info: List[FileInfo] = []
      curr_block = 0
      for v in info:
          if not os.path.exists(v.file_name):
              # file is deleted
              pass
          else:
              num_file_block = v.block_end - v.block_begin
              nw_info.append(
                  FileInfo(
                      v.file_name,
                      curr_block,
                      curr_block + num_file_block,
                      v.nbytes,
                      v.nlines,
                      v.mask,
                      v.block_size,
                  )
              )
              curr_block += num_file_block
  
      _write_info_list(meta_path, nw_info)
  
file_path: DeepKE/example/llm/CPM-Bee/src/cpm_live/dataset/utils.py
imports: import os
  import struct
  from typing import List, Optional
  from .distributed_dataset import SimpleDataset, build_dataset, _read_info_list, _write_info_list, _random_string, _DEFAULT_BLOCK_SIZE, FileInfo
  from .serializer import RawSerializer
  import random
  import shutil
label_desc: Use image node_id 2 for calling a global function with example usage: compact_dataset(path) without return types