GNES

GNES [jee-nes] is Generic Neural Elastic Search, a cloud-native semantic search system based on deep neural network.

GNES enables large-scale index and semantic search for text-to-text, image-to-image, video-to-video and any-to-any content form.

☁️

Cloud-Native & Elastic

?

Easy-to-Use

?

State-of-the-Art

GNES is all-in-microservice! Encoder, indexer, preprocessor and router are all running in their own containers. They communicate via versioned APIs and collaborate under the orchestration of Docker Swarm/Kubernetes etc. Scaling, load-balancing, automated recovering, they come off-the-shelf in GNES. How long would it take to deploy a change that involves just switching a layer in VGG? In GNES, this is just one line change in a YAML file. We abstract the encoding and indexing logic to a YAML config, so that you can change or stack encoders and indexers without even touching the codebase. Taking advantage of fast-evolving AI/ML/NLP/CV communities, we learn from best-of-breed deep learning models and plug them into GNES, making sure you always enjoy the state-of-the-art performance.

?

Generic & Universal

?

Model as Plugin

?

Best Practice

Searching for texts, image or even short-videos? Using Python/C/Java/Go/HTTP as the client? Doesn't matter which content form you have or which language do you use, GNES can handle them all. When built-in models do not meet your requirments, simply build your own with GNES Hub. Pack your model as a docker container and use it as a plugin. We love to learn the best practice from the community, helping our GNES to achieve the next level of availability, resiliency, performance, and durability. If you have any ideas or suggestions, feel free to contribute.

Overview

component overview

GNES Hub

component overview

GNES Hub ship AI/ML models as Docker containers and use Docker containers as plugins. It offers a clean and sustainable way to port external algorithms (with the dependencies) into the GNES framework.

GNES Hub is hosted on the Docker Hub.

Install GNES

There are two ways to get GNES, either as a Docker image or as a PyPi package. For cloud users, we highly recommend using GNES via Docker.

Run GNES as a Docker Container

docker run gnes/gnes:latest-alpine

This command downloads the latest GNES image (based on Alpine Linux) and runs it in a container. When the container runs, it prints an informational message and exits.

? Choose the right GNES image

Besides the alpine image optimized for the space, we also provide Buster (Debian 10.0), Ubuntu 18.04 and Ubuntu 16.04-based images. The table below summarizes all available GNES tags. One can fill in {ver} with latest, stable or v0..xx. latest refers to the latest master of this repository, which may not be stable. We recommend you to use an official release by changing the latest to a version number, say v0.0.24, or simply using stable for the last release, e.g. gnes:stable-ubuntu

Tag Size and layers Description
{ver}-alpine based on Alpine Linux;
no deep learning libraries;
extremely lightweight and portable, enables fast scaling on even edge devices.
{ver}-buster based on Debian 10.0;
no deep learning libraries;
recommended for building or extending a GNES-Hub image.
{ver}-ubuntu18 based on Ubuntu 18.04;
no deep learning libraries.
{ver}-full based on Ubuntu 16.04;
python-3.6.8, cuda-10.0, tf1.14, pytorch1.1, faiss, multiple pretrained models;
heavy but self-contained, useful in testing GNES end-to-endly.

⚠️ Since 2019/10/21, we have stopped hosting the public mirror Tencent Cloud. The old Docker images still exist, but there won't be new images available on Tencent Cloud anymore.

We also provide a public mirror Github packages. Select the mirror that serves you well.

docker login --username=xxx docker.pkg.github.com/gnes-ai/gnes  # login to github package so that we can pull from it
docker run docker.pkg.github.com/gnes-ai/gnes/gnes:latest-alpine

The table below shows the status of the build pipeline.

RegistryBuild status
Docker Hub
gnes/gnes:[tag]
Github Package
docker.pkg.github.com/gnes-ai/gnes/gnes:[tag]

Install GNES via pip

Python >=3.7 is required.

You can also install GNES as a Python3 package via:

pip install gnes

Note that this will only install a "barebone" version of GNES, consists of the minimal dependencies for running GNES. No third-party pretrained models, deep learning/NLP/CV packages will be installed. We make this setup as the default installation behavior, as a model interested to NLP engineers may not be interested to CV engineers. In GNES, models serve as Docker plugins.

? Tensorflow, Pytorch and torchvision are not part of GNES installation. Depending on your model, you may have to install them in advance.

Though not recommended, you can install GNES with full dependencies via:

pip install gnes[all]
? Or cherry-picking the dependencies according to the table below: (click to expand...)
pip install gnes[bert]
bert-serving-server>=1.8.6, bert-serving-client>=1.8.6
pip install gnes[flair]
flair>=0.4.1
pip install gnes[annoy]
annoy==1.15.2
pip install gnes[chinese]
jieba
pip install gnes[vision]
opencv-python>=4.0.0, imagehash>=4.0
pip install gnes[leveldb]
plyvel>=1.0.5
pip install gnes[test]
pylint, memory_profiler>=0.55.0, psutil>=5.6.1, gputil>=1.4.0
pip install gnes[transformers]
pytorch-transformers
pip install gnes[onnx]
onnxruntime
pip install gnes[audio]
librosa>=0.7.0
pip install gnes[scipy]
scipy
pip install gnes[nlp]
bert-serving-server>=1.8.6, pytorch-transformers, flair>=0.4.1, bert-serving-client>=1.8.6
pip install gnes[cn_nlp]
pytorch-transformers, bert-serving-client>=1.8.6, bert-serving-server>=1.8.6, jieba, flair>=0.4.1
pip install gnes[all]
pylint, psutil>=5.6.1, pytorch-transformers, annoy==1.15.2, bert-serving-client>=1.8.6, gputil>=1.4.0, bert-serving-server>=1.8.6, imagehash>=4.0, onnxruntime, memory_profiler>=0.55.0, jieba, flair>=0.4.1, librosa>=0.7.0, scipy, plyvel>=1.0.5, opencv-python>=4.0.0

A good way to cherry-pick dependencies is following the example in GNES Hub and building you own GNES image.

Either way, if you end up reading the following message after $ gnes or $ docker run gnes/gnes, then you are ready to go!

install-success

GitHub