Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmczh003 opened this issue Jun 13, 2019 · 14 comments
Open

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

xmczh003 opened this issue Jun 13, 2019 · 14 comments

Comments

@xmczh003
Copy link

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 xmczh003 reopened this Jul 1, 2019
@xmczh003
Copy link
Author

xmczh003 commented Jul 1, 2019

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

@RogerQi
Copy link

RogerQi commented Jul 2, 2019

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.

@xmczh003
Copy link
Author

xmczh003 commented Jul 2, 2019

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?

@RogerQi
Copy link

RogerQi commented Jul 2, 2019

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.

@amnamasood
Copy link

amnamasood commented Jul 4, 2019

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

@RogerQi
Copy link

RogerQi commented Jul 4, 2019

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.

@amnamasood
Copy link

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

@RogerQi
Copy link

RogerQi commented Jul 4, 2019

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

@amnamasood
Copy link

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?

@RogerQi
Copy link

RogerQi commented Jul 4, 2019

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.

@amnamasood
Copy link

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
Copy link

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?

@wkcn
Copy link

wkcn commented Jul 24, 2019

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

https://github.com/wkcn/AttentionSampler

@tiancity-bytedance
Copy link

anybody had tried docker to deal with the environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants