class_docstr: Allow per-line lazy access to multiple text files using numpy memmap.
docstr: Loads a text file as np.int8.
  
  Returns:
      mdata - memorymap of np.int8
      midx - indices pointing to the end-of-line (or end of file) position
      size - number of lines in file
code: def load_file(self, fn, index_mapping_dir: Optional[str] = None):
      """
      Loads a text file as np.int8.
  
      Returns:
          mdata - memorymap of np.int8
          midx - indices pointing to the end-of-line (or end of file) position
          size - number of lines in file
      """
      logging.info(f"Loading {fn}")
      idx_fn = _index_fn(fn, index_mapping_dir)
  
      # create data map
      mdata = np.memmap(fn, dtype=np.uint8, mode="r")
  
      if _index_file_exists(idx_fn):
          # load index file into memory map
          midx = np.load(
              idx_fn + ".npy", allow_pickle=True, mmap_mode="r"
          )
          # test for header
          if len(midx) < self._header_lines:
              raise RuntimeError(
                  f"Missing header, expected {self._header_lines} header lines"
              )
  
          # load meta info
          idx_info_dict = pickle.load(open(idx_fn + ".info", "rb"))
          # test for mismatch in expected newline_int
          if "newline_int" in idx_info_dict:
              newline_int = idx_info_dict["newline_int"]
              if self._newline_int != newline_int:
                  logging.warning(
                      f"Mismatch in newline_int, expected = {self._newline_int} but loaded {newline_int}"
                  )
  
          # test for version mismatch (useful to force recreation of index files)
          idx_version = idx_info_dict.get("version", "0.0")
          if __idx_version__ != idx_version:
              raise RuntimeError(
                  f"Version mismatch: Please delete existing '.{__idx_suffix__}' files. Expected version = {__idx_version__}, but file version = {idx_version}. File path = {idx_fn}"
              )
      else:
          raise ValueError(
              f"Memory Map for {fn} is not found, missing one or more of files: {idx_fn}.{{.npy,.info}}"
          )
  
      return (mdata, midx)
  
imports: import datetime
  import json
  import multiprocessing
  import os
  import pickle
  import time
  from functools import partial
  from typing import Callable, List, Optional, Type
  import numpy
  import torch
  from nemo.core import Dataset
  from nemo.utils import AppState, logging
label_desc: Use image node_id 7 for calling the TextMemMapDataset obj's underlying member method code with example usage: obj.load_file(fn, index_mapping_dir) and returns: mdata,  midx