[SOLVED] After clean built 'tvm._ffi._ctypes.node.NodeBase' object has no attribute 'set_default'


#1

Once I’ve built latest master TVM following guide from documentation I cannot run any example (tried so far tune_relay_x86.py and relay_quick_start.py).

I am getting all the time error

Traceback (most recent call last):
  File "tune_relay_x86.py", line 30, in <module>
    from tvm import relay
  File "/home/tvm_test/python/tvm/relay/__init__.py", line 24, in <module>
    from . import expr_functor
  File "/home/tvm_test/python/tvm/relay/expr_functor.py", line 24, in <module>
    from .op import Op
  File "/home/tvm_test/python/tvm/relay/op/__init__.py", line 20, in <module>
    from .op import get, register, register_schedule, register_compute, register_gradient, \
  File "/home/tvm_test/python/tvm/relay/op/op.py", line 19, in <module>
    import topi
  File "/home/tvm_test/topi/python/topi/__init__.py", line 25, in <module>
    from . import nn
  File "/home/tvm_test/topi/python/topi/nn/__init__.py", line 11, in <module>
    from .dense import *
  File "/home/tvm_test/topi/python/topi/nn/dense.py", line 65, in <module>
    def dense(data, weight, bias=None, out_dtype=None):
  File "/home/tvm_test/python/tvm/target.py", line 256, in fdecorate
    generic_func_node.set_default(fdefault, allow_override=True)
  File "/home/tvm_test/python/tvm/_ffi/_ctypes/node.py", line 75, in __getattr__
    "'%s' object has no attribute '%s'" % (str(type(self)), name))
AttributeError: '<class 'tvm._ffi._ctypes.node.NodeBase'>' object has no attribute 'set_default'

My believe is that environment variables are set correctly:
export TVM_HOME=/home/tvm_test && export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:$TVM_HOME/nnvm/python:${PYTHONPATH}
I’m running Python 3.6.7 if that helps.


#2

rebuilding ffi make cython3 should fix this issue


#3

Could you please explain a bit more how to rebuild it? There was no need to build it at first place AFAIK. I’m just doing make -j4 and that’s it.

build$ make cython3
make: *** No rule to make target 'cython3'.  Stop.

#4

You can run this command in the root dir of tvm


#5

Unfortunately this also doesn’t help. Unless I have to do something extra after rebuilding it?

make cython3
cd python; python3 setup.py build_ext --inplace
/home/.local/lib/python3.6/site-packages/setuptools/dist.py:475: UserWarning: Normalizing '0.6.dev' to '0.6.dev0'
  normalized_version,
running build_ext
copying build/lib.linux-x86_64-3.6/tvm/_ffi/_cy3/core.cpython-36m-x86_64-linux-gnu.so -> tvm/_ffi/_cy3

#6

I met this error before. This was some ffi version issue and simply running this command worked.


#7

I am not sure what has changed, but after downloading whole repository today one more time and building in clean directory everything works.


#8

Is there a reason not to modify the default ‘all’ Makefile target to re-make cython3?


#9

The main reason is cython is not a cmake target and different people expect different behaviors. It is better to make sure that make all is equivalent to make all under cmake


#10

Understood. In which case perhaps a better place to fix the “inconsistent build” situation that arizes here is to call “make cython” from task_build.sh. Does that make more sense?


#11

In the case of ci script, the cython binaries are not packaged. So we do not have to call it during task_build