code: def main(model, model_type, outname, outdir, quants, keep_fp16):
      if not os.path.isdir(model):
          print(f"Model not found at {model}. Downloading...")
          try:
              if outname is None:
                  outname = model.split("/")[-1]
              model = snapshot_download(
                  repo_id=model, cache_dir="../models/hf_cache"
              )
          except Exception as e:
              raise Exception(f"Could not download the model: {e}")
  
      if outdir is None:
          outdir = f"../models/{outname}"
  
      if not os.path.isfile(f"{model}/config.json"):
          raise Exception(f"Could not find config.json in {model}")
  
      os.makedirs(outdir, exist_ok=True)
  
      print("Building llama.cpp")
      subprocess.run(f"cd .. && make quantize", shell=True, check=True)
  
      fp16 = f"{outdir}/{outname}.gguf.fp16.bin"
  
      print(f"Making unquantised GGUF at {fp16}")
      if not os.path.isfile(fp16):
          if model_type != "llama":
              subprocess.run(
                  f"python3 ../convert-{model_type}-hf-to-gguf.py {model} 1 --outfile {fp16}",
                  shell=True,
                  check=True,
              )
          else:
              subprocess.run(
                  f"python3 ../convert.py {model} --outtype f16 --outfile {fp16}",
                  shell=True,
                  check=True,
              )
      else:
          print(f"Unquantised GGML already exists at: {fp16}")
  
      print("Making quants")
      for type in quants:
          outfile = f"{outdir}/{outname}.gguf.{type}.bin"
          print(f"Making {type} : {outfile}")
          subprocess.run(
              f"../quantize {fp16} {outfile} {type}",
              shell=True,
              check=True,
          )
  
      if not keep_fp16:
          os.remove(fp16)
  
imports: import subprocess
  import argparse
  import os
  from huggingface_hub import snapshot_download
label_desc: Use image node_id 1 for calling a global function with example usage: main(model, model_type, outname, outdir, quants, keep_fp16) without return types