From accc7db813dce6a4ce6be0af5bd71ce03f6ca7ec Mon Sep 17 00:00:00 2001 From: Xingyu Zhou Date: Tue, 26 Nov 2019 10:17:25 -0800 Subject: [PATCH] [AutoTVM] select model with the most tuned schedules (#4404) * select model with the most tuned schedules * change detect empty map method * modify model description for load_reference_log --- python/tvm/autotvm/tophub.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/tvm/autotvm/tophub.py b/python/tvm/autotvm/tophub.py index 12f2b80..95e9acb 100644 --- a/python/tvm/autotvm/tophub.py +++ b/python/tvm/autotvm/tophub.py @@ -198,7 +198,7 @@ def load_reference_log(backend, model, workload_name, template_key): backend: str The backend name model: str - The name of the model + The name of the device model workload_name: str The name of the workload. (The first item in the workload tuple) template_key: str @@ -218,12 +218,15 @@ def load_reference_log(backend, model, workload_name, template_key): if os.path.isfile(os.path.join(AUTOTVM_TOPHUB_ROOT_PATH, package_name)): find = False inp = None + counts = {} for inp, res in load_from_file(filename): + counts[inp.target.model] = counts.get(inp.target.model, 0) + 1 if model == inp.target.model: find = True break - if not find and inp: - model = inp.target.model + # if device model is not find, use the device model with the most tuned worklaods + if not find and counts: + model = max(counts.items(), key=lambda k: k[1])[0] for inp, res in load_from_file(filename): if (model == inp.target.model and inp.task.workload[0] == workload_name and -- 2.7.4