code: def _convert_to_ggml(
      model_path: str,
      outfile_dir: str,
      model_family: str = "llama",
      outtype: str = "fp16",
  ):
      """
      Convert Hugging Face llama-like / gpt-neox-like / bloom-like model to ggml format.
  
      :param input_path: Path to a *directory*  for huggingface checkpoint that are directly
              pulled from huggingface hub, for example `./llama-7b-hf`. This should be a dir
              path that contains: weight bin, tokenizer config, tokenizer.model (required for
              llama) and added_tokens.json (if applied).
              For lora finetuned model, the path should be pointed to a merged weight.
      :param outfile_dir: str, the directory to save ggml compatible file, for example `./models`.
      :param model_family: Which model family your input model belongs to. Default to `llama`.
              Now only `llama`/`bloom`/`gptneox`/`starcoder` are supported.
      :param outtype: specify the output format. Defalut to `fp16`. Now `fp32`/`fp16` are supported.
      """
      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.exists(model_path),
          "The file {} was not found".format(model_path),
      )
      invalidInputError(
          outtype in ["fp32", "fp16"],
          "Now we only support converting to 'fp32'/'fp16' format",
          "{} is not in the list.".format(outtype),
      )
  
      # make sure the output directory exists
      os.makedirs(outfile_dir, exist_ok=True)
  
      outtype = outtype.replace("p", "")
      print(
          "It may takes several minutes to load the original model, please wait..."
      )
      if model_family == "llama":
          _convert_llama(model_path, outfile_dir, outtype)
      if model_family == "gptneox":
          _convert_gptneox(model_path, outfile_dir, outtype)
      if model_family == "bloom":
          _convert_bloom(model_path, outfile_dir, outtype)
      if model_family == "starcoder":
          _convert_starcoder(model_path, outfile_dir, outtype)
  
file_path: BigDL/python/llm/src/bigdl/llm/ggml/convert.py
imports: from bigdl.llm.utils.common import invalidInputError
  from bigdl.llm.utils.convert_util import *
  from pathlib import Path
  import os
label_desc: Use image node_id 6 for calling a global function with example usage: _convert_to_ggml(model_path, outfile_dir, model_family, outtype) without return types