I’ve made a tflite version of EfficientDet-Lite{0,1,2} following tutorial at “RetrainEfficientDet Model Maker tf2” (sorry – as a newb, I’m limited to two links per post )
I then follow [Compile TFLite Models(Compile TFLite Models — tvm 0.9.dev0 documentation) to load the model
And finally Vitis AI Integration – tvm to compile the model for the Xilinx KV-260.
I have everything working up until the “partition_for_vitis_ai()” function call in Vitis AI Integration – tvm. Although I have verified that this works for the mxnet model and tflite models used in the tvm examples, all of my EfficientDet-Lite models (0, 1, 2) give the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-30-36b2c4f557b5> in <module>
----> 1 mod = partition_for_vitis_ai(mod, params, dpu=dpu_target)
~/python/tvm/relay/op/contrib/vitis_ai.py in partition_for_vitis_ai(mod, params, dpu, **opts)
189
190 with tvm.transform.PassContext(opt_level=3):
--> 191 return seq(mod)
~/python/tvm/ir/transform.py in __call__(self, mod)
159 The updated module after applying this pass.
160 """
--> 161 return _ffi_transform_api.RunPass(self, mod)
162
163
~/python/tvm/_ffi/_cython/packed_func.pxi in tvm._ffi._cy3.core.PackedFuncBase.__call__()
321 cdef int ret_tcode
322 ret_tcode = kTVMNullptr
--> 323 FuncCall(self.chandle, args, &ret_val, &ret_tcode)
324 return make_ret(ret_val, ret_tcode)
325
~/python/tvm/_ffi/_cython/packed_func.pxi in tvm._ffi._cy3.core.FuncCall()
255 nargs = len(args)
256 if nargs <= 3:
--> 257 FuncCall3(chandle, args, nargs, ret_val, ret_tcode)
258 return 0
259
~/python/tvm/_ffi/_cython/packed_func.pxi in tvm._ffi._cy3.core.FuncCall3()
244 for i in range(nargs):
245 make_arg(args[i], &values[i], &tcodes[i], temp_args)
--> 246 CALL(TVMFuncCall(chandle, &values[0], &tcodes[0],
247 nargs, ret_val, ret_tcode))
248 return 0
~/python/tvm/_ffi/_cython/base.pxi in tvm._ffi._cy3.core.CALL()
161 return -2
162 if ret != 0:
--> 163 raise get_last_ffi_error()
164 return 0
165
ValueError: Traceback (most recent call last):
7: TVMFuncCall
6: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::IRModule (tvm::transform::Pass, tvm::IRModule)>::AssignTypedLambda<tvm::transform::{lambda(tvm::transform::Pass, tvm::IRModule)#7}>(tvm::transform::{lambda(tvm::transform::Pass, tvm::IRModule)#7}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, tvm::runtime::TVMRetValue)
5: tvm::transform::Pass::operator()(tvm::IRModule) const
4: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
3: tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
2: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
1: tvm::relay::transform::FunctionPassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
0: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<TVMFuncCreateFromCFunc::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) [clone .cold]
File "tvm/_ffi/_cython/./packed_func.pxi", line 56, in tvm._ffi._cy3.core.tvm_callback
rv = local_pyfunc(*pyargs)
File "/home/robert_zak/Vitis-AI/tvm/python/tvm/relay/transform/transform.py", line 932, in _pass_func
return inst.transform_function(func, mod, ctx)
File "/home/robert_zak/Vitis-AI/tvm/python/tvm/relay/op/contrib/vitis_ai.py", line 110, in transform_function
xgraph = pyxir.frontend.tvm.from_relay(mod, self.params, postprocessing=None)
File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/pyxir-0.3.3-py3.6-linux-x86_64.egg/pyxir/frontend/tvm/relay.py", line 58, in from_relay
cvx_preprocessing=cvx_preprocessing
File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/pyxir-0.3.3-py3.6-linux-x86_64.egg/pyxir/frontend/tvm/relay_tools/relay_2_xgraph_converter.py", line 129, in from_relay_to_xgraph
net=xlayers, name="relay_xgraph", blobs=False
File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/pyxir-0.3.3-py3.6-linux-x86_64.egg/pyxir/graph/xgraph_factory.py", line 42, in build_from_xlayer
xgraph.add(X)
File "/opt/vitis_ai/conda/envs/vitis-ai-tensorflow/lib/python3.6/site-packages/pyxir-0.3.3-py3.6-linux-x86_64.egg/pyxir/graph/xgraph.py", line 185, in add
self._xgraph.add(X._get_xlayer())
ValueError: Could not add xlayer with name: nn_max_pool2d_NHWC-NCHW-94770022471280as the layer already exists.
Any suggestions about what this error means, or how it might be fixed?