iamalbert / pytorch-wordemb Goto Github PK
View Code? Open in Web Editor NEWLoad pretrained word embeddings (word2vec, glove format) into torch.FloatTensor for PyTorch
Load pretrained word embeddings (word2vec, glove format) into torch.FloatTensor for PyTorch
I downloaded and installed torchwordemb-0.0.9 via python setup.py install.and the i got an error related to return {vocab, dest};,I change the original code to return VocabAndTensor(vocab, dest);, and run python setup.py install again.then i install torchwordemb-0.0.9 successful;
but when i import torchwordemb,i meet an error :
import torchwordemb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.6/dist-packages/torchwordemb-0.0.9-py3.6-linux-x86_64.egg/torchwordemb.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_29E
i have found some solutions but it didn't work for me, anyone meet this problem?
Downloading torchwordemb-0.0.8.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/wm/rqr_vbc104g66ffx__hwnw3dkl2z1b/T/pip-build-3KaXlf/torchwordemb/setup.py", line 17, in <module>
import build
File "build.py", line 2, in <module>
from torch.utils.ffi import create_extension
File "/Users/dblythe/.environments/torch/lib/python2.7/site-packages/torch/utils/ffi/__init__.py", line 14, in <module>
raise ImportError("torch.utils.ffi requires the cffi package")
ImportError: torch.utils.ffi requires the cffi package
This is fixed by pip install cffi
pytorch-wordemb/src/loadwordemb.cpp:101:41: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'long long' in initializer list [-Wc++11-narrowing]
dest.resize_(torch::IntArrayRef{n_word, dim});
-Wc++11-narrowing
prevents compilation due to incompatible types Typedef Documentation using c10::IntArrayRef = ArrayRef<int64_t>
and
dest.resize_(torch::IntArrayRef{n_word, dim});
correct to:
dest.resize_(torch::IntArrayRef{(int64_t)n_word, (int64_t)dim});
or propose better / correct handling of types...
On installation with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
,
I faced the error below when I run pip install torchwordemb
inside of the docker container of the image nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04
src/loadwordemb.cpp: In function ‘VocabAndTensor load_word2vec_bin(const char*)’:
src/loadwordemb.cpp:139:52: warning: narrowing conversion of ‘n_word’ from ‘size_t {aka long unsigned int}’ to ‘long int’ inside { } [-Wnarrowing]
dest.resize_(torch::IntArrayRef{n_word, dim});
^
src/loadwordemb.cpp:139:52: warning: narrowing conversion of ‘n_word’ from ‘size_t {aka long unsigned int}’ to ‘long int’ inside { } [-Wnarrowing]
src/loadwordemb.cpp:139:52: warning: narrowing conversion of ‘dim’ from ‘size_t {aka long unsigned int}’ to ‘long int’ inside { } [-Wnarrowing]
src/loadwordemb.cpp:139:52: warning: narrowing conversion of ‘dim’ from ‘size_t {aka long unsigned int}’ to ‘long int’ inside { } [-Wnarrowing]
src/loadwordemb.cpp:157:24: error: converting to ‘VocabAndTensor {aka std::tuple<pybind11::dict, at::Tensor>}’ from initializer list would use explicit constructor ‘constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = pybind11::dict&; _U2 = at::Tensor&; <template-parameter-2-3> = void; _T1 = pybind11::dict; _T2 = at::Tensor]’
return {vocab, dest};
^
error: command 'gcc' failed with exit status 1
----------------------------------------
but I succeeded to install with gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
.
Is this error due to the conflict of gcc versions?
$ pip install --user torchwordemb
Collecting torchwordemb
Using cached https://files.pythonhosted.org/packages/ab/26/a811077fa6971b2d010cb7c10bbed18cb5182219706b71d7d151f9e6a838/torchwordemb-0.0.8.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-avn748hy/torchwordemb/setup.py", line 17, in <module>
import build
File "/tmp/pip-install-avn748hy/torchwordemb/build.py", line 2, in <module>
from torch.utils.ffi import create_extension
File "/opt/python/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-avn748hy/torchwordemb/
I have PyTorch 1.0. When I install PyTorch 0.4.0 on a virtual environment and then install torchwordemb on top of that, I don't get this error.
I loaded the word2vec embeddings trained by gensim, and I encountered the Segmentation fault (core dumped) error.
Error during installation:
src/loadwordemb.cpp:157:24: error: converting to ‘VocabAndTensor {aka std::tuple<pybind11::dict, at::Tensor>}’ from initializer list would use explicit constructor ‘constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = pybind11::dict&; _U2 = at::Tensor&; = void; _T1 = pybind11::dict; _T2 = at::Tensor]’
return {vocab, dest};
This problem has been bothering me for a long time. Is it a compatibility issue with the Pytorch version? Or other questions, thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.