-
Notifications
You must be signed in to change notification settings - Fork 137
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
Python extension #26
Comments
I tried your version but something is wrong. |
I think there are two issues: The first one is that I forgot to add the
|
It works, successfully installed btm-0.1.0, thanks for your solution. |
when i run the example code above, i got something like this: |
No is not. Somehow is accessing the pvec in the position 3 when it has only 3 elements. I am going to try in another PC to see if I get the same error. I've tried with another ArchLinux and it worked. I'm going to try with an ubuntu. |
I tried in a Debian 10. And the version of boost-python was old. I had to recompile boost-python in order to work. But apart from that, I did not have any other problem. I don't know what is happening in your case. |
Hi! I tried but the code is not working. It says:
Not sure what is wrong. |
For what I see ...model.h(10): fatal error C1083: 无法打开包括文件: “boost/python/numpy.hpp”: No such file or directory Do you have boost correctly installed? And did you add the headers path to the include path dir? |
Hi! I installed boost, but I do not know how to add the header path to the include path directory. |
So I tried to install boost using anaconda, and again it does not work:
I have also included the directory of boost in the system path variable. |
The include path are the paths where the compiler looks for headers file (the .h files). It is not related to the system path which are the paths where the operating system looks for executables. I will try to add a configuration file to specify these paths and make the compilation easier. In the meantime you can edit the setup.py and add it yourself.
The THE_PATH_WHERE_THE_BOOST_HEADERS_ARE_LOCATED should end with an include, i.e. Depending on how boost was installed you probably will need to change the name of the libraries [''boost_numpy3', 'boost_python3'] |
Hi! Thanks. I have a question: In your set up:
What does 3 mean at here? Should not all the parameters be fixed already? |
Hi! |
Hi! Thanks for the prompt reply. Wish you are safe! I am giving a try with this on a large data set. One question - is it possible for this to be displaying progressing bars like tqdm? So far I am not seeing any indicator at all. Since training a large model takes a lot of time, I feel this could be useful. |
That's odd. The progress bar is the same that in the original code, I can see it. btm_model = btm.Model(number_of_topics, alpha, beta, n_iters, background_topic, show_progressbar)
btm_model.initialize(["sentence 1", "sentence 2", "sentence 2"])
for j in range(500):
btm_model.fit_step() To perform the fit steps in python. The |
It is wierd. Here is a public ipynb file: https://colab.research.google.com/drive/1Rr2WsY7MRy3Pin8Eak9HNa6rddBLSn07 I tried your commands but it says
|
I am training using Google colab, not windows. So theoretically the issue should be from Google colab. |
You did not define the background_topic variable. I run it in google colab and is working |
Thanks! I figured out how to use it now. The second method works for me. Quick question: Is it possible to speed up the training using GPU/TPU? I know it uses Gibbs sampling in the background. Just wondering if we can speed up the training process since colab offer GPU/TPU support. |
@Logos23333 I've encountered the same problem. And I found out that this is caused by the following line of code
in line 118 in model.cpp. For example, when this->w2id is empty, i.e., its size is 0, the above code will assign this->w2id[w] to 1. That is. the resultant ids of the words are one greater than the expected ids, which causes the index out of boundary error. However, since I am not too familiar with c++, I am not sure why I run into this. The line of code can be changed to the following to avoid the error:
|
In case is anyone interested. I've made a python extension out of this code. It is more or less the same code, except it is wrapped with python-boost. And it avoids all the intermediate files.
You can use it something like this:
The text was updated successfully, but these errors were encountered: