code: def quantize(
      input_path: str,
      output_path: str,
      model_family: str,
      dtype: str = "q4_0",
  ):
      """
      Quantize ggml file to lower precision.
  
      :param input_path: Path of input ggml file, for example `./ggml-model-f16.bin`.
      :param output_path: Save path of output quantized model. You must pass a directory to
              save all related output. Filename of quantized model will be like
              `bigdl_llm_llama_q4_0.bin`.
      :param model_family: Which model family your input model belongs to.
              Now only `llama`/`bloom`/`gptneox`/`starcoder` are supported.
      :param dtype: Quantization method which differs in the resulting model disk size and
              inference speed. Defalut to `q4_0`. Difference model family may support
              different types, now the supported list is:
              llama : "q4_0", "q4_1", "q5_0", "q5_1", "q8_0"
              bloom : "q4_0", "q4_1"
              gptneox : "q4_0", "q4_1", "q5_0", "q5_1", "q8_0"
              starcoder : "q4_0", "q4_1", "q5_0", "q5_1", "q8_0"
  
      :return: the path str to the converted ggml binary checkpoint
      """
      invalidInputError(
          model_family in ["llama", "bloom", "gptneox", "starcoder"],
          "Now we only support quantization of model \
                         family('llama', 'bloom', 'gptneox', 'starcoder')",
          "{} is not in the list.".format(model_family),
      )
      invalidInputError(
          os.path.isfile(input_path),
          "The file {} is not found".format(input_path),
      )
      invalidInputError(
          os.path.isdir(output_path),
          "The output_path {} is not a directory".format(output_path),
      )
      # convert quantize type str into corresponding int value
      quantize_type_map = _quantize_type[model_family]
      output_filename = "bigdl_llm_{}_{}.bin".format(
          model_family, dtype.lower()
      )
      output_path = os.path.join(output_path, output_filename)
      invalidInputError(
          dtype.lower() in quantize_type_map,
          "{0} model just accept {1} now, \
                        but you pass in {2}.".format(
              model_family, list(quantize_type_map.keys()), dtype
          ),
      )
      quantize_type = quantize_type_map[dtype]
      if platform.platform().startswith("Windows"):
          suffix = ".exe"
      else:
          suffix = ""
      quantize_args = "{0}/libs/quantize-{1}{2} {3} {4} {5}".format(
          libs_dirname,
          model_family,
          suffix,
          input_path,
          output_path,
          str(quantize_type),
      )
      p = subprocess.run(quantize_args.split(), capture_output=True)
      error_message = p.stderr
      invalidInputError(
          not p.returncode,
          "Fail to quantize {}, error message is {}.".format(
              str(input_path), error_message
          ),
      )
      return str(output_path)
  
imports: import os
  import subprocess
  from bigdl.llm.utils.common import invalidInputError
  import platform
  from pathlib import Path
label_desc: Use image node_id 1 for calling a global function with example usage: quantize(input_path, output_path, model_family, dtype) and returns: str