Hi @kazum, thank you for your suggestion.I'm able to start the RPC tracker.
I'm also tried as same as @jacobpostman mostly, but while tuning the sample
model I got the below logs.
[Task 1/16] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (15/100) |
600.01 s[19:07:37]
/Users/Dileep/LatestTVM/22_08/tvm/src/runtime/metal/metal_device_api.mm:137:
Intializing Metal device 0, name=Intel Iris Pro Graphics
[Task 1/16] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (16/100) |
640.05 s[19:08:18]
/Users/Dileep/LatestTVM/22_08/tvm/src/runtime/metal/metal_device_api.mm:137:
Intializing Metal device 0, name=Intel Iris Pro Graphics
[Task 1/16] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (17/100) |
680.11 s[19:08:57]
/Users/Dileep/LatestTVM/22_08/tvm/src/runtime/metal/metal_device_api.mm:137:
Intializing Metal device 0, name=Intel Iris Pro Graphics
[Task 1/16] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (18/100) |
720.17 s[19:09:38]
/Users/Dileep/LatestTVM/22_08/tvm/src/runtime/metal/metal_device_api.mm:137:
Intializing Metal device 0, name=Intel Iris Pro Graphics
[Task 1/16] Current/Best: 0.00/ 0.00 GFLOPS | Progress: (19/100) |
760.24 s[19:10:18]
/Users/Dileep/LatestTVM/22_08/tvm/src/runtime/metal/metal_device_api.mm:137:
Intializing Metal device 0, name=Intel Iris Pro Graphics
I always see " 0.00/ 0.00 GFLOPS" while tuning the model. whether the model is
tuning properly or missing some thing while tuning the model ?
here is the part of code
target = 'metal'
proxy_port = 9090
key = "iphone"
arch = "arm64"
sdk = "iphoneos"
target_host = "llvm -mtriple=%s-apple-darwin" % arch
@tvm.register_func("tvm_callback_metal_compile")
def compile_metal(src):
return xcode.compile_metal(src, sdk=sdk)
#### TUNING OPTION ####
network = 'resnet-18'
log_file = "%s.log" % network
dtype = 'float32'
autotvm.measure.measure_methods.check_remote = lambda *args: True
def fcompile(*args):
from tvm.contrib import xcode
xcode.create_dylib(*args, arch=arch, sdk=sdk)
path = args[0]
xcode.codesign(path)
xcode.popen_test_rpc(proxy_host, proxy_port, key,
destination=destination,
libs=[path])
fcompile.output_format = "dylib"
tuning_option = {
'log_filename': log_file,
'tuner': 'xgb',
'early_stopping': None,
'measure_option': autotvm.measure_option(
builder=autotvm.LocalBuilder(
n_parallel=1,
build_func=fcompile,
timeout=60
),
runner=autotvm.RPCRunner(
key, host='127.0.0.1', port=9190,
number=20, repeat=3, timeout=60, min_repeat_ms=150)
),
}
def tune_tasks(tasks,
measure_option,
tuner='xgb',
n_trial=100,
early_stopping=None,
log_filename='tuning.log',
use_transfer_learning=False):
# create tmp log file
tmp_log_file = log_filename + ".tmp"
if os.path.exists(tmp_log_file):
os.remove(tmp_log_file)
for i, tsk in enumerate(reversed(tasks)):
prefix = "[Task %2d/%2d] " %(i+1, len(tasks))
# create tuner
if tuner == 'xgb' or tuner == 'xgb-rank':
tuner_obj = XGBTuner(tsk, loss_type='rank')
elif tuner == 'ga':
tuner_obj = GATuner(tsk, pop_size=100)
elif tuner == 'random':
tuner_obj = RandomTuner(tsk)
elif tuner == 'gridsearch':
tuner_obj = GridSearchTuner(tsk)
else:
raise ValueError("Invalid tuner: " + tuner)
if use_transfer_learning:
if os.path.isfile(tmp_log_file):
tuner_obj.load_history(autotvm.record.load_from_file(tmp_log_file))
# do tuning
tsk_trial = min(n_trial, len(tsk.config_space))
tuner_obj.tune(n_trial=tsk_trial,
early_stopping=early_stopping,
measure_option=measure_option,
callbacks=[
autotvm.callback.progress_bar(tsk_trial,
prefix=prefix),
autotvm.callback.log_to_file(tmp_log_file)
])
# pick best records to a cache file
autotvm.record.pick_best(tmp_log_file, log_filename)
os.remove(tmp_log_file)
########################################################################
# Finally, we launch tuning jobs and evaluate the end-to-end performance.
def tune_and_evaluate(tuning_opt):
# extract workloads from relay program
print("Extract tasks...")
mod, params, input_shape, out_shape = get_network(network, batch_size=1)
tasks = autotvm.task.extract_from_program(mod["main"], target=target,
params=params,
target_host=target_host,
ops=(relay.op.get("nn.conv2d"),))
# run tuning tasks
print("Tuning...")
tune_tasks(tasks, **tuning_opt)
Please let me know if anything i'm missing on the above code.
Thanks,
---
[Visit
Topic](https://discuss.tvm.ai/t/auto-tvm-how-to-auto-tune-the-model-on-ios-device/7681/10)
to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
here](https://discuss.tvm.ai/email/unsubscribe/169c869406e0ac52f2aaf9cb37e8a9e28aa36a5e178deffa26f3a44313f7ef1a).