Home > Blockchain >  TensorFlow Setting model_config_file runtime argument in YAML file for K8s
TensorFlow Setting model_config_file runtime argument in YAML file for K8s

Time:08-02

I've been having a hell of a time trying to figure-out how to serve multiple models using a yaml configuration file for K8s.

I can run directly in Bash using the following, but having trouble converting it to yaml.

docker run -p 8500:8500 -p 8501:8501 \
    [container id] \
    --model_config_file=/models/model_config.config \
    --model_config_file_poll_wait_seconds=60

I read that model_config_file can be added using a command element, but not sure where to put it, and I keep receiving errors around valid commands or not being able to find the file.

command:
- '--model_config_file=/models/model_config.config'
- '--model_config_file_poll_wait_seconds=60'

Sample YAML config below for K8s, where would the command go referencing the docker run command above?

---
apiVersion: v1
kind: Namespace
metadata:
  name: model-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tensorflow-test-rw-deployment
  namespace: model-test
spec:
  selector:
    matchLabels:
      app: rate-predictions-server
  replicas: 1
  template:
    metadata:
      labels:
        app: rate-predictions-server
    spec:
      containers:
      - name: rate-predictions-container
        image: aws-ecr-path
        command:
          - --model_config_file=/models/model_config.config
          - --model_config_file_poll_wait_seconds=60
        ports:
        #- grpc: 8500
        - containerPort: 8500
        - containerPort: 8501
---
apiVersion: v1
kind: Service
metadata:
  labels:
    run: rate-predictions-service
  name: rate-predictions-service
  namespace: model-test
spec:
  type: ClusterIP
  selector:
    app: rate-predictions-server
  ports:
  - port: 8501
    targetPort: 8501
  

CodePudding user response:

What you are passing on seems to be the arguments and not the command. Command should be set as the entrypoint in the container and arguments should be passed in args. Please see following link. https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/

  • Related