Error using OpenNMT-py (Multiple edits, new issue)

pytorch

(Jeremy) #1

Hi!

I was led to believe we could use OpenNmt on the client-side using tensorflow but I don’t think it is possible.
How should I interact from NodeJS to OpenNmt and which OpenNmt library would be better?

My goal is to have the user input a product name like “Sliced White Bread” and it will be translated in multiple languages directly on the form for review before the user can add it to the database.

EDIT:
I tried cloning https://github.com/OpenNMT/OpenNMT-tf following the instructions but they are unclear.
After cd’ing in the folder, commands like onmt-build-vocab doesn’t work, obviously. Typing python ./setup.py doesn’t work either.

Second Edit:
OpenNMT-py seems to be more complete, but after running pip install -r requirements.txt without any error, I cannot start preprocess.py without having:

Traceback (most recent call last):
  File "preprocess.py", line 12, in <module>
    import torch
  File "/home/jer/.local/lib/python2.7/site-packages/torch/__init__.py", line 80, in <module>
    from torch._C import *
ImportError: numpy.core.multiarray failed to import

I looked back and I can indeed find torch installed.

Collecting torch>=0.4.0 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/06/a7/6a173738dd6be014ebf9ba6f0b441d91b113b1506a98e10da4ff60994b54/torch-0.4.1-cp27-cp27mu-manylinux1_x86_64.whl (519.5MB)
    100% |████████████████████████████████| 519.5MB 3.5kB/s 
Successfully installed certifi-2018.8.24 chardet-3.0.4 future-0.16.0 idna-2.7 requests-2.19.1 six-1.11.0 torch-0.4.1 torchtext-0.3.0 tqdm-4.25.0 urllib3-1.23

Thanks for your help!