tasn icon indicating copy to clipboard operation
tasn copied to clipboard

AttributeError: 'module' object has no attribute 'AttSampler'

Open xmczh003 opened this issue 5 years ago • 14 comments

structure_data = mx.sym.contrib.AttSampler(data=data, attx=map_sx, atty=map_sy, scale=224.0/512, dense=4) AttributeError: 'module' object has no attribute 'AttSampler'

xmczh003 avatar Jun 13 '19 03:06 xmczh003

how can I use att_sampler-inl.h, att_sampler.cc and att_sampler.cu to address this problem?

xmczh003 avatar Jul 01 '19 04:07 xmczh003

You will have to compile a custom build of MXNet from source (using the source code they provided). This is exactly what README tells you.

RogerQi avatar Jul 02 '19 03:07 RogerQi

You will have to compile a custom build of MXNet from source (using the source code they provided). This is exactly what README tells you.

Thank you. I have installed the MXNet before. How could I use att_sampler-inl.h, att_sampler.cc and att_sampler.cu to address my problem rather than recompiling the custom version?

xmczh003 avatar Jul 02 '19 03:07 xmczh003

I doubt there is a way to do that rather than recompiling the custom version. The sampler was implemented with C++ so, if you want to use the python wrapper of MXNet to do this, you will have to recompile the entire MXNet for it to be linked and recognized in the Python wrapper. With that being said, there still may be some way to get around recompilation - you will have to figure out how to make the python wrapper recognize the attsampler function and properly link it. I would say recompilation is definitely the easier way to do this.

Either way, this is more of an MXNet question rather than a TASN question. If there are some constraints that keep you from getting a build-from-source version, you should consider addressing this question to the MXNet community instead of here.

Still, if you need help recompiling, feel free to post a follow-up under this issue. I had a up-to-date MXNet build installed on my machine before getting this custom build up and running. I will be happy to help you with problems you run into.

RogerQi avatar Jul 02 '19 05:07 RogerQi

Hi. I am facing the same problem. I have built mxnet from source with C++ package following the instructions in https://mxnet.incubator.apache.org/versions/master/install/build_from_source.html#build-configurations. However I get this error AttributeError: 'module' object has no attribute 'AttSampler' Also, looking at the mxnet documentation, I couldn't find AttSampler https://mxnet.incubator.apache.org/api/python/symbol/contrib.html

amnamasood avatar Jul 04 '19 11:07 amnamasood

Hi. I am facing the same problem. I have built mxnet from source with C++ package following the instructions in https://mxnet.incubator.apache.org/versions/master/install/build_from_source.html#build-configurations. However I get this error AttributeError: 'module' object has no attribute 'AttSampler' Also, looking at the mxnet documentation, I couldn't find AttSampler https://mxnet.incubator.apache.org/api/python/symbol/contrib.html

You must use the MXNet source from this repo instead of the official release.

RogerQi avatar Jul 04 '19 11:07 RogerQi

Oh Okay. Thanks. Would your MXNet source work with Cuda 10.0?

amnamasood avatar Jul 04 '19 11:07 amnamasood

I got it running with CUDA 9.2. I'm not sure if it works with CUDA 10.0.

RogerQi avatar Jul 04 '19 11:07 RogerQi

I got it running with CUDA 9.2. I'm not sure if it works with CUDA 10.0.

Thanks. Did you have to make any changes to get it to run with CUDA 9.2?

amnamasood avatar Jul 04 '19 12:07 amnamasood

I got it running with CUDA 9.2. I'm not sure if it works with CUDA 10.0.

Thanks. Did you have to make any changes to get it to run with CUDA 9.2?

I had to replace the entire TVM lib under tasn-mxnet/3rdparty because there seemed to be some files missing. The version of the TVM lib that came with the repo is 0.4. I got a fresh copy from here:

https://github.com/dmlc/tvm/releases/tag/v0.4

Other than that, when you are following the MXNet "build from source" instruction, you should follow the Makefile one instead of CMake one. For some mysterious reason I couldn't get CMake to work. These are the modification that I did to get it successfully compiled on my machine.

RogerQi avatar Jul 04 '19 12:07 RogerQi

I got it running with CUDA 9.2. I'm not sure if it works with CUDA 10.0.

Thanks. Did you have to make any changes to get it to run with CUDA 9.2?

I had to replace the entire TVM lib under tasn-mxnet/3rdparty because there seemed to be some files missing. The version of the TVM lib that came with the repo is 0.4. I got a fresh copy from here:

https://github.com/dmlc/tvm/releases/tag/v0.4

Other than that, when you are following the MXNet "build from source" instruction, you should follow the Makefile one instead of CMake one. For some mysterious reason I couldn't get CMake to work. These are the modification that I did to get it successfully compiled on my machine.

Thanks a lot. Following the same steps, I managed to get it running with Cuda 10.0 too with minor hiccups along the way. I also could not get it to compile using cmake.

amnamasood avatar Jul 05 '19 08:07 amnamasood

I ran TASN on my data and I got 80% training accuracy. However, my validation accuracy in first epoch was 5% and wasn't increasing. Do you guys have any idea what might have caused this?

amnamasood avatar Jul 09 '19 07:07 amnamasood

Hi, I wrote a project, which gives a way to add AttSampler without recompiling MXNet.

https://github.com/wkcn/AttentionSampler

wkcn avatar Jul 24 '19 08:07 wkcn

anybody had tried docker to deal with the environment?

tiancity-bytedance avatar Jul 25 '19 13:07 tiancity-bytedance