code: def load_lit_format(
      path: str, *args, id_fn=input_hash, **kw
  ) -> Union[Dataset, IndexedDataset]:
      """Load data from LIT jsonl format."""
      with open(path + LIT_SPEC_EXTENSION, "r") as fd:
          spec = serialize.from_json(fd.read())
  
      with open(path, "r") as fd:
          examples = [
              serialize.from_json(line) for line in fd.readlines()
          ]
  
      first_example_keys = set(ex.keys() if (ex := examples[0]) else [])
      # TODO(b/294233896): remove this once input representations are consolidated.
      if first_example_keys.issuperset({"id", "data"}):
          return IndexedDataset(
              spec=spec,
              indexed_examples=cast(
                  list[lit_types.IndexedInput], examples
              ),
              id_fn=id_fn,
              *args,
              **kw,
          )
      else:
          return Dataset(spec=spec, examples=examples, *args, **kw)
  
imports: from collections.abc import Callable, Mapping, Sequence
  import hashlib
  import glob
  import inspect
  import os
  import random
  import types
  from typing import Optional, Union, cast
  from absl import logging
  from lit_nlp.api import types
  from lit_nlp.lib import serialize
  from lit_nlp.lib import utils
label_desc: Use image node_id 4 for calling a global function with example usage: load_lit_format(path) and returns: IndexedDataset, Dataset