You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "YaoJiawei329 (via GitHub)" <gi...@apache.org> on 2023/04/20 13:53:15 UTC
[GitHub] [tvm] YaoJiawei329 commented on issue #14681: [Bug] tvmc tune did not work.
YaoJiawei329 commented on issue #14681:
URL: https://github.com/apache/tvm/issues/14681#issuecomment-1516371881
And I try to use the following code to tune the same model, but it also did not work, just hangon.
`
from tvm.driver import tvmc
from tvm import autotvm, relay
def tvmc_tune(model_path, shape_dict, target, log_file):
model = tvmc.load(model_path, shape_dict=shape_dict) # 第 1 步: 加载 + shape_dict
tvmc.tune(model, target=target, tuning_records=log_file) # 第 1.5 步:可选 Tune
package = tvmc.compile(model, target=target, tuning_records=log_file) # 第 2 步:编译
mod, params = relay.frontend.from_onnx(model_path, shape_dict)
with autotvm.apply_history_best(log_file):
with tvm.transform.PassContext(opt_level=4, config={}):
lib = relay.build(mod, target=target, params=params)
lib.export_library(model_path.replace("onnx", "so"))
if __name__ == "__main__":
model_path = "./yolov7.onnx"
shape_dict = {'images':[1,3,640,640]}
target = "llvm"
log_file = 'tune.json'
tvmc_tune(model_path, shape_dict, target, log_file)
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org