We have many pre trained model from tfhub which does not required any thing other than serving directly using any serving layer.To try the same I have used seldon core serving technique to make it available for serving layer.I tried to access the api by
{"status":{"code":-1,"info":"HTTPConnectionPool(host='0.0.0.0', port=2001): Max retries exceeded with url: /v1/models/embedding:predict (Caused by NewConnectionError('\u003curllib3.connection.HTTPConnection object at 0x7f69aeff2b10\u003e: Failed to establish a new connection: [Errno 111] Connection refused'))","reason":"MICROSERVICE_INTERNAL_ERROR","status":1}}
To reproduce
I have used multiple techniques below are the details:
This is where I have downloaded model from tfhub and serve that using below yaml
We have many pre trained model from tfhub which does not required any thing other than serving directly using any serving layer.To try the same I have used seldon core serving technique to make it available for serving layer.I tried to access the api by
however it error out with
To reproduce
I have used multiple techniques below are the details:
DAN_MODEL_URI = "https://tfhub.dev/google/universal-sentence-encoder/4"
class Embedding(object): """ Model template. You can load your model parameters in init from a location accessible at runtime """
seldon_core==1.14.1 numpy==1.23.4 tensorflow==2.8.3 tensorflow-hub==0.12.0
FROM python:3.9-slim
ARG TF_CACHE_DIR="/var/tmp/tfhub_modules"
WORKDIR /app
Install python packages
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN apt-get -y update && \ apt-get install -y screen && \ apt-get install -y curl && \ apt-get install -y wget && \ apt-get install -y tar
Copy source code
COPY . .
RUN mkdir -p /app${TF_CACHE_DIR} && \ chmod -R 777 /app
Define environment variables
ENV MODEL_NAME=Embedding ENV SERVICE_TYPE=MODEL ENV CUDA_VISIBLE_DEVICES=-1 ENV TFHUB_CACHE_DIR=${TF_CACHE_DIR}
RUN python -c "import tensorflow as tf; import tensorflow_hub as hub; hub.load('https://tfhub.dev/google/universal-sentence-encoder/4')" RUN ls -l $TFHUB_CACHE_DIR
Port for GRPC
EXPOSE 5001
Port for REST
EXPOSE 8000
Changing folder to default user
RUN chown -R 8888 /app
CMD exec seldon-core-microservice $MODEL_NAME --service-type $SERVICE_TYPE
apiVersion: machinelearning.seldon.io/v1 kind: SeldonDeployment metadata: name: embedding namespace: seldon spec: name: embedding predictors:
Environment
Seldon 1.14.1
Cloud Provider: AWS Kubernetes Cluster Version v1.21.1