alex-tifrea / poincare_glove

Implementation of the "Poincare Glove: Hyperbolic word embeddings" paper
GNU Lesser General Public License v2.1
83 stars 20 forks source link

ModuleNotFoundError: No module named 'glove_code.src.glove_inner' #2

Closed ousou closed 5 years ago

ousou commented 5 years ago

I tried to run the training for Poincare GloVe vectors, but the training did not start because of the following error:


_./run_glove.sh --train --root /poincare --coocc_file /glove/cooccurrence_full_vocab_20190221.shuf.bin --vocab_file /glove/vocab_orig.txt --epochs 10 --workers 16 --restrict_vocab 6000000 --lr 0.01 --poincare 1 --bias --size 100 --dist_func cosh-dist-sq --noeval

Training the model and preparing to save it to ../models/glove/geometric_emb/glove_ep10_size100_lr0.01_vocab6000000_poincare_OPTradagrad_COOCCFUNClog_DISTFUNCcosh-dist-sq_bias Running python3 glove_code/scripts/glove_main.py --train --root=.. --coocc_file=/glove/cooccurrence_full_vocab_20190221.shuf.bin --vocab_file=/glove/vocab_orig.txt --size=100 --workers=16 --chunksize= --epochs=10 --lr=0.01 --restrict_vocab=6000000 --poincare=1 --coocc_func log --dist_func cosh-dist-sq --bias --train_log_filename ../train_logs/tmp_35607 Redirecting output to ../train_logs/train_glove_ep10_size100_lr0.01_vocab6000000_poincare_OPTradagrad_COOCCFUNClog_DISTFUNCcosh-dist-sq_bias /usr/local/lib/python3.6/dist-packages/smart_open/ssh.py:34: UserWarning: paramiko missing, opening SSH/SCP/SFTP paths will be disabled. pip install paramiko to suppress warnings.warn('paramiko missing, opening SSH/SCP/SFTP paths will be disabled. pip install paramiko to suppress') Traceback (most recent call last): File "glove_code/scripts/glove_main.py", line 6, in from glove_code.src.glove import Glove, NNConfig, InitializationConfig File "/poincare/poincare_glove/glove_code/src/glove.py", line 5, in from glove_code.src.glove_inner import read_all ModuleNotFoundError: No module named 'glove_code.src.glove_inner'


Before running this I installed the required dependencies (pip3 install Cython nltk annoy) and ran the setup script (python3 setup.py develop).

I additionally tried to import the Cython module glove_code.src.glove_inner directly in the python3 REPL, and then I got the following error:


Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. import pyximport pyximport.install() (None, <pyximport.pyximport.PyxImporter object at 0x7f4f09454eb8>) _from glove_code.src.glove_inner import readall /usr/local/lib/python3.6/dist-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /poincare/poincare_glove/glove_code/src/glove_inner.pyx tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file: ... cdef extern from "vfast_invsqrt.h": double fast_inv_sqrt(float number) nogil

REAL = np.float32

cdef scopy_ptr scopy=PyCObject_AsVoidPtr(fblas.scopy._cpointer) # y = x ^

glove_code/src/glove_inner.pyx:28:5: 'scopy_ptr' is not a type identifier

Error compiling Cython file: ... double fast_inv_sqrt(float number) nogil

REAL = np.float32

cdef scopy_ptr scopy=PyCObject_AsVoidPtr(fblas.scopy._cpointer) # y = x cdef saxpy_ptr saxpy=PyCObject_AsVoidPtr(fblas.saxpy._cpointer) # y += alpha * x ^

glove_code/src/glove_inner.pyx:29:5: 'saxpy_ptr' is not a type identifier

Error compiling Cython file: ...

Traceback (most recent call last): File "/usr/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile extra_postargs) File "/usr/lib/python3.6/distutils/ccompiler.py", line 909, in spawn spawn(cmd, dry_run=self.dry_run) File "/usr/lib/python3.6/distutils/spawn.py", line 36, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/usr/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix % (cmd, exit_status)) distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 215, in load_module inplace=build_inplace, language_level=language_level) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 191, in build_module reload_support=pyxargs.reload_support) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll dist.run_commands() File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions self.build_extension(ext) File "/usr/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension depends=ext.depends) File "/usr/lib/python3.6/distutils/ccompiler.py", line 574, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile raise CompileError(msg) distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 462, in load_module language_level=self.language_level) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 231, in load_module raise exc.with_traceback(tb) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 215, in load_module inplace=build_inplace, language_level=language_level) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyximport.py", line 191, in build_module reload_support=pyxargs.reload_support) File "/usr/local/lib/python3.6/dist-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll dist.run_commands() File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/usr/lib/python3.6/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/usr/local/lib/python3.6/dist-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions self.build_extension(ext) File "/usr/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension depends=ext.depends) File "/usr/lib/python3.6/distutils/ccompiler.py", line 574, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile raise CompileError(msg) ImportError: Building module glove_code.src.glove_inner failed: ["distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1\n"]


There was lots of similar errors in the import.

Did I perhaps forget to do some installation step?

alex-tifrea commented 5 years ago

Hi,

Did you compile the Cython files? You can do that by running ./make_glove.sh.

Let me know if it worked.