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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]