Error in tune_relay_arm.py


#1

i use the script tune_relay_arm.py to tune the model , i set try_spatial_pack_depthwise=True in function

def tune_tasks(tasks, measure_option, tuner='xgb', n_trial=1000, early_stopping=None, log_filename='tuning.log', use_transfer_learning=True, try_winograd=True, try_spatial_pack_depthwise=True)

it gives the error after i run tune_relay_arm.py, the error info as follows:

    Exception has occurred: KeyError
'contrib_spatial_pack'
File "/home/mm/workspace/tvm-master-new/python/tvm/autotvm/task/dispatcher.py", line 220, in dispatch_func
    return dispatch_dict[cfg.template_key](cfg, *args, **kwargs)
File "</home/mm/.local/lib/python3.7/site-packages/decorator.py:decorator-gen-101>", line 2, in config_dispatcher
File "/home/mm/workspace/tvm-master-new/python/tvm/target.py", line 372, in dispatch_func
    return dispatch_dict[k](*args, **kwargs)
File "</home/mm/.local/lib/python3.7/site-packages/decorator.py:decorator-gen-29>", line 2, in depthwise_conv2d_nchw
File "/home/mm/workspace/tvm-master-new/python/tvm/autotvm/task/topi_integration.py", line 186, in _topi_nn_depthwise_conv2d_nchw
    C = topi.nn.depthwise_conv2d_nchw(*args, **kwargs)
File "/home/mm/workspace/tvm-master-new/python/tvm/autotvm/task/task.py", line 191, in create
    sch, _ = func(*args)
File "/home/mm/workspace/somecodes/tvm/autotvm/mxnet_retinaface_tune_relay_arm.py", line 122, in tune_tasks
    template_key='contrib_spatial_pack')
File "/home/mm/workspace/somecodes/tvm/autotvm/mxnet_retinaface_tune_relay_arm.py", line 183, in tune_and_evaluate
    tune_tasks(tasks, **tuning_opt)
File "/home/mm/workspace/somecodes/tvm/autotvm/mxnet_retinaface_tune_relay_arm.py", line 227, in <module>
    tune_and_evaluate(tuning_option)

#2

Do you tune from the scratch? seems that you have tuned and run with the tuned log, then you get the error.


#3

yes ,i tune the model from the scratch, this is the first time i use autotvm to tune the mxnet model.


#4

I have tested it and no problem of contrib_spatial_pack. What I means before is do you tune from scratch without contrib_spatial_pack, but when you run, you set contrib_spatial_pack be true? Or do you have workload not tuned with contrib_spatial_pack?


#5

yes ,at first, i tune the model without contrib_spatial_pack(try_spatial_pack_depthwise=False), then i break the tuning. i restart the tuning with try_spatial_pack_depthwise=True,it gives the error.


#6

Do you remove the .tmp file? If you use the transfer learning, it will load the history file and maybe have problem. If you still have problem, try to update the latest code and try again.


#7

i just tested it, it always give the erros: KeyError: 'contrib_spatial_pack’
i don’t find .tmp file , i have update the latest code, it is weird. i will test it by another computer tommrow.


#8

i have tested it by another computer , the same error, can you help me to test the model ? the mxnet model download url(mxnet model) thanks


#9

which model? I find it has two models.


#10

this model : mnet.25-0000.params ,mnet.25-symbol.json


#11

input size is 640*640


#12

I can not reproduce this error. It could also work well too. Some suggestions maybe help:
firstly install cython, i.e. pip3 install cython

Then in the build directory run make cython3

I find it could solve some issue of macOS, but this issue shouldn’t be existed in Linux.


#13

i have tested it, same error, can you post the your tuning codes?thanks


#14

No special. Just tune_relay_arm.py https://docs.tvm.ai/tutorials/autotvm/tune_relay_arm.html