Skip to content

Commit

Permalink
Export default mlc_llm_config in build (octoml#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrometerHBH authored May 15, 2023
1 parent 9e29ff0 commit 09b8b6e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import os
import pickle
import json
from typing import List

import tvm
Expand Down Expand Up @@ -130,6 +131,22 @@ def mod_transform_before_build(
return mod_deploy


def dump_default_mlc_llm_config(args):
config = dict()
config["model_lib"] = f"{args.model}-{args.quantization.name}"
config["local_id"] = f"{args.model}-{args.quantization.name}"
config["conv_template"] = args.conv_template
config["temperature"] = 0.7
config["top_p"] = 0.95
config["stream_interval"] = 2
config["mean_gen_len"] = 128
config["shift_fill_factor"] = 0.3
dump_path = os.path.join(args.artifact_path, "mlc_llm_config.json")
with open(dump_path, "w") as outfile:
json.dump(config, outfile, indent=4)
print(f"Finish exporting mlc_llm_config to {dump_path}")


def build(mod_deploy: tvm.IRModule, args: argparse.Namespace) -> None:
target_kind = args.target_kind
debug_dump_script(mod_deploy, "mod_before_build.py", args)
Expand Down Expand Up @@ -219,3 +236,4 @@ def dump_split_tir(mod: tvm.IRModule):
mod = pickle.load(open(cache_path, "rb"))
dump_split_tir(mod)
build(mod, ARGS)
dump_default_mlc_llm_config(ARGS)

0 comments on commit 09b8b6e

Please sign in to comment.