CLIP-as-service is a low-latency high-scalability service for embedding images and text. It can be easily integrated as a microservice into neural search solutions.
⚡ Fast: Serve CLIP models with TensorRT, ONNX runtime and PyTorch w/o JIT with 800QPS[*]. Non-blocking duplex streaming on requests and responses, designed for large data and long-running tasks.
🫐 Elastic: Horizontally scale up and down multiple CLIP models on single GPU, with automatic load balancing.
🐥 Easy-to-use: No learning curve, minimalist design on client and server. Intuitive and consistent API for image and sentence embedding.
👒 Modern: Async client support. Easily switch between gRPC, HTTP, WebSocket protocols with TLS and compression.
🍱 Integration: Smooth integration with neural search ecosystem including Jina and DocArray. Build cross-modal and multi-modal solutions in no time.
[*] with default config (single replica, PyTorch no JIT) on GeForce RTX 3090.
Make sure you are using Python 3.7+. You can install the client and server independently. It is not required to install both: e.g. you can install clip_server on a GPU machine and clip_client on a local laptop.
After installing, you can run the following commands for a quick connectivity check.
Start the server
Start PyTorch Server
python -m clip_server
Start ONNX Server
python -m clip_server onnx-flow.yml
Start TensorRT Server
python -m clip_server tensorrt-flow.yml
At the first time starting the server, it will download the default pretrained model, which may take a while depending on your network speed. Then you will get the address information similar to the following:
This means the server is ready to serve. Note down the three addresses shown above, you will need them later.
Connect from client
{tip}
1Depending on the location of the client and server. You may use different IP addresses:
2- Client and server are on the same machine: use local address, e.g. `0.0.0.0`
3- Client and server are connected to the same router: use private network address, e.g. `192.168.3.62`
4- Server is in public network: use public network address, e.g. `87.105.159.191`