mlc-ai / mlc-llm

Universal LLM Deployment Engine with ML Compilation
https://llm.mlc.ai/
Apache License 2.0
18.58k stars 1.5k forks source link

[Question] looking for docs about build.py #503

Closed ylc2001 closed 10 months ago

ylc2001 commented 1 year ago

❓ General Question

Are there any docs elaborating on the model building process in https://github.com/mlc-ai/mlc-llm/blob/main/build.py ?

I'm learning about tvm these days and I'm courious about what exactly did you do to transform & build the model in build.py. Especially the part where tir functions are optimized for different targets in function build():

if target_kind != "cpu":
  db = utils.get_database(args.db_path)  # pylint: disable=invalid-name
  with db, tvm.target.Target("apple/m1-gpu-restricted"):
      if args.target_kind == "android":
          mod_deploy = mlc_llm.dispatch.DispatchTIROperatorAdreno()(  # pylint: disable=not-callable
              mod_deploy
          )
      mod_deploy = relax.transform.MetaScheduleApplyDatabase()(mod_deploy)
      mod_deploy = (
          mlc_llm.dispatch.DispatchTIROperator(  # pylint: disable=not-callable
              args.model_category
          )(mod_deploy)
      )
      mod_deploy = tvm.tir.transform.DefaultGPUSchedule()(mod_deploy)
      mod_deploy = mlc_llm.transform.LiftTIRGlobalBufferAlloc()(mod_deploy)
      mod_deploy = tvm.tir.transform.ForceNarrowIndexToInt32()(mod_deploy)

This looks quite different from the mlc course https://mlc.ai/

pecanjk commented 1 year ago

same

tqchen commented 10 months ago

It is now available at llm.mlc.ai