Sign inSign up

nlpub/word2vec-pyro4

By nlpub

Updated over 4 years ago

Word Vectors Served via Pyro4.

Image
0

1.1K

nlpub/word2vec-pyro4 repository overview

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:

Note that the Docker image is based on Anaconda 3 for performance reasons. 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 (c) 2017–2019 Dmitry Ustalov. See LICENSE for details.

Tag summary

Content type

Image

Digest

Size

343.5 MB

Last updated

over 4 years ago

docker pull nlpub/word2vec-pyro4