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
Problems with memory mapped files and vectors.most_similar() #4
Comments
I use the Python It seems like If I gave you contributor access on the main GitLab repository, would you be comfortable creating a branch that fixes this issue and Issue #2 by checking |
If you can point me to the specific parts in the code that would need to be modified concerning the lock i could try and see if it works. |
Thanks. Can you sign up to GitLab and give me your username? I'll add you to the repository as a contributor and comment the parts of the code that need to be changed. |
Or would it be possible to implement the locking with this? This seems to be a crossplatform solution that abstracts Unix fcntl.flock(), fcntl.lockf() EDIT: |
Possibly, I'll give that library a try and see if that works first. |
I actually just went ahead and made the changes. I integrated that lockfile library and added an if-statement that opens The diff can be seen here: Test cases are running on the CI server, once they pass, it will be deployed to PyPI as version 0.1.10. Once it is deployed, you can upgrade magnitude on your system by running |
Thank you very much for your time Ajay. I will post as soon as i can, most likely tomorrow. |
The update is now deployed to PyPI. I actually continued using the fastener library because it does apparently support Windows. Not sure why you were getting the process locking error. Please update magnitude and restart your computer (that will get rid of temp files). And hopefully, the package should be compatible with Windows now. |
Damn. The bug was still there after the test but i figured it out. It doesn't seem to have anything to do with the locks. You need to delete the mmap reference to close it. So i simply added all_vectors.flush()
del all_vectors at line 1129 I don't understand why there would be different behavior on windows vs mac and linux. Maybe mac/linux and windows python have different GC implementations so the reference gets cleaned up immedietly on max/linux? Would be my best guess. Anyway. All the examples in the documentation work now except slice indexing of vector. |
Hm, okay, that seems fine to me. I guess the GC is different on Windows or the open file reference from NumPy doesn't cause a conflict on macOS / Unix. Fixed on this commit: And deploying to version 0.1.14 after the tests run. |
Well this seems to be the last of it then. Thank you for your time and swift responses. This library is very helpful for me since i can use it in my master thesis. It is easier to use and more ergonomic and has more functionality than the official fasttext library. Also the documentation is a lot better/ easier to navigate. And now it works on windows, which the original does not. 👍 Thank you for all the work you put into it. |
Your welcome and thanks for the help in making it Windows compatible! I added your handle as a Developer on the GitLab repository. If you come across any other issues, feel free to submit a pull request / merge request to get it merged into master and deployed to PyPI. Would love to see what you working on / end up doing with Magnitude in your master's thesis, e-mail us at opensource@plasticity.ai if you can share it. |
Hello. I am on windows using python 3.6
There seems to be a problem with creating the magmap files for using the vectors.most_similar() method. Error:
I looked into the code and it seems you are creating and filling these files in the background.
It works fine for the vectors.most_similar_approx() method. The memmap file for approx seems to be created just fine.
The problem persists even when i use blocking=True when constructing the magnitude object.
Then i can't even use the approx method. It just hangs while initializing the object.
Thank you for your time.
The text was updated successfully, but these errors were encountered: