class_docstr: Load documents from different files into list of langchain Documents
docstr: Load data. Please refer to https://python.langchain.com/docs/modules/data_connection/document_loaders/
      for sepcific format requirements.
  Args:
      path: path to a file
          To load files with glob path, here are some examples.
              Load all file from directory: folder1/folder2/*
              Load all pdf file from directory: folder1/folder2/*.pdf
docstr_tok: ["Load","data",".","Please","refer","to","https",":","\/\/python.langchain.com\/docs\/modules\/data_connection\/document_loaders\/","for","sepcific","format","requirements",".","Args",":","path",":","path","to","a","file","To","load","files","with","glob","path",",","here","are","some","examples",".","Load","all","file","from","directory",":","folder1\/folder2\/","*","Load","all","pdf","file","from","directory",":","folder1\/folder2\/","*",".pdf"]
code: def load_data(self, path: str) -> None:
      """
      Load data. Please refer to https://python.langchain.com/docs/modules/data_connection/document_loaders/
          for sepcific format requirements.
      Args:
          path: path to a file
              To load files with glob path, here are some examples.
                  Load all file from directory: folder1/folder2/*
                  Load all pdf file from directory: folder1/folder2/*.pdf
      """
      files = []
  
      # Handle glob expression
      try:
          files = glob.glob(path)
      except Exception as e:
          logger.error(e)
      if len(files) == 0:
          raise ValueError(
              "Unsupported file/directory format. For directories, please use glob expression"
          )
      elif len(files) == 1:
          path = files[0]
      else:
          for file in files:
              self.load_data(file)
          return
  
      # Load data if the path is a file
      logger.info(f"load {path}", verbose=True)
      if path.endswith(".csv"):
          # Load csv
          loader = CSVLoader(file_path=path, encoding="utf8")
          data = loader.load()
          self.data[path] = data
      elif path.endswith(".txt"):
          # Load txt
          loader = TextLoader(path, encoding="utf8")
          data = loader.load()
          self.data[path] = data
      elif path.endswith("html"):
          # Load html
          loader = UnstructuredHTMLLoader(path, encoding="utf8")
          data = loader.load()
          self.data[path] = data
      elif path.endswith("json"):
          # Load json
          loader = JSONLoader(
              file_path=path,
              jq_schema=self.kwargs.get("jq_schema", ".data[]"),
              content_key=self.kwargs.get("content_key", "content"),
              metadata_func=self.kwargs.get("metadata_func", None),
          )
  
          data = loader.load()
          self.data[path] = data
      elif path.endswith("jsonl"):
          # Load jsonl
          loader = JSONLoader(
              file_path=path,
              jq_schema=self.kwargs.get("jq_schema", ".data[].content"),
              json_lines=True,
          )
          data = loader.load()
          self.data[path] = data
      elif path.endswith(".md"):
          # Load markdown
          loader = UnstructuredMarkdownLoader(path)
          data = loader.load()
          self.data[path] = data
      elif path.endswith(".pdf"):
          # Load pdf
          loader = PyPDFLoader(path)
          data = loader.load_and_split()
          self.data[path] = data
      else:
          if "." in path.split("/")[-1]:
              raise ValueError(
                  f"Unsupported file format {path}. Supported formats: {SUPPORTED_DATA_FORMAT}"
              )
          else:
              # May ba a directory, we strictly follow the glob path and will not load files in subdirectories
              pass
  
file_path: colossalai/applications/ColossalQA/colossalqa/data_loader/document_loader.py
imports: import glob
  from typing import List
  from colossalqa.mylogging import get_logger
  from langchain.document_loaders import JSONLoader, PyPDFLoader, TextLoader, UnstructuredHTMLLoader, UnstructuredMarkdownLoader
  from langchain.document_loaders.csv_loader import CSVLoader
label_desc: Use image node_id 2 for calling the DocumentLoader obj's underlying member method code with example usage: obj.load_data(path) without return types