nlpub / word2vec-pyro4

Word Vectors Served via Pyro4.

Home Page:https://nlpub.ru/Watasense

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Word Vectors Served via Pyro4

This is a simple network service that serves the Gensim's KeyedVectors via Pyro4.

Docker Hub

Running

$ ./server.py
usage: server.py [--id ID] [--no-sims] [-h HOST] [-p PORT] w2v

The only mandatory parameter, w2v, specifies the path to the word vectors in the word2vec format. By default, the server listens to any network interface on the port 9090.

For instance, the following pre-trained vectors are available:

The image is designed under the assumption that the vectors are mounted as /usr/src/app/w2v.bin.

Accessing

import Pyro4

Pyro4.config.SERIALIZER = 'pickle' # see the Disclaimer

w2v = Pyro4.Proxy('PYRO:w2v@localhost:9090')

w2v.word_vec('cat') # => array([…], dtype=float32)

Disclaimer

Note that this service should be running in a trusted environment since it uses the pickle serializer to handle the NumPy arrays. This makes the system extremely vulnerable and even allows arbitrary code execution, which is not recommended by the Pyro4 developers.

Copyright

Copyright (c) 2017–2021 Dmitry Ustalov. See LICENSE for details.

About

Word Vectors Served via Pyro4.

https://nlpub.ru/Watasense

License:MIT License


Languages

Language:Python 84.9%Language:Dockerfile 15.1%