Commit accc7db8 by Xingyu Zhou Committed by Yao Wang

[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
parent 2ed39e91
...@@ -198,7 +198,7 @@ def load_reference_log(backend, model, workload_name, template_key): ...@@ -198,7 +198,7 @@ def load_reference_log(backend, model, workload_name, template_key):
backend: str backend: str
The backend name The backend name
model: str model: str
The name of the model The name of the device model
workload_name: str workload_name: str
The name of the workload. (The first item in the workload tuple) The name of the workload. (The first item in the workload tuple)
template_key: str template_key: str
...@@ -218,12 +218,15 @@ def load_reference_log(backend, model, workload_name, template_key): ...@@ -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)): if os.path.isfile(os.path.join(AUTOTVM_TOPHUB_ROOT_PATH, package_name)):
find = False find = False
inp = None inp = None
counts = {}
for inp, res in load_from_file(filename): for inp, res in load_from_file(filename):
counts[inp.target.model] = counts.get(inp.target.model, 0) + 1
if model == inp.target.model: if model == inp.target.model:
find = True find = True
break break
if not find and inp: # if device model is not find, use the device model with the most tuned worklaods
model = inp.target.model if not find and counts:
model = max(counts.items(), key=lambda k: k[1])[0]
for inp, res in load_from_file(filename): for inp, res in load_from_file(filename):
if (model == inp.target.model and inp.task.workload[0] == workload_name and if (model == inp.target.model and inp.task.workload[0] == workload_name and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment