Skip to content

Instantly share code, notes, and snippets.

Masroor Hasan masroorhasan

View GitHub Profile
View prom-svc-monitors.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: ml-serving
namespace: default
labels:
infra: monitoring
spec:
selector:
matchLabels:
View prom-monitoring.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: prometheus
rules:
View resnet_serving_v1.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: resnet-serving
labels:
app: resnet-serving
version: v1
spec:
revisionHistoryLimit: 3
progressDeadlineSeconds: 30
View prediction_service.proto
syntax = "proto3";
package tensorflow.serving;
option cc_enable_arenas = true;
import "protos/tensorflow_serving/apis/predict.proto";
// open source marker; do not remove
// PredictionService provides access to machine-learned models loaded by
// model_servers.
service PredictionService {
View optimized_tf_serving_client.py
#!/usr/bin/env python
from __future__ import print_function
import argparse
import numpy as np
import time
tt = time.time()
import cv2
from grpc.beta import implementations
View build_tf_serving.sh
#!/bin/bash
USER=$1
TAG=$2
TF_SERVING_VERSION_GIT_BRANCH="r1.13"
git clone --branch="${TF_SERVING_VERSION_GIT_BRANCH}" https://github.com/tensorflow/serving
TF_SERVING_BUILD_OPTIONS="--copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2"
cd serving && \
docker build --pull -t $USER/tensorflow-serving-devel:$TAG \
View tf_serving_client.py
#!/usr/bin/env python
from __future__ import print_function
import argparse
import numpy as np
import time
tt = time.time()
import cv2
import tensorflow as tf
View build_image.sh
#!/bin/bash
TAG=$1
SELDON_WRAPPER_IMAGE_TAG=0.5-SNAPSHOT
s2i build \
-E ${ENV} . \
seldonio/seldon-core-s2i-python2:${SELDON_WRAPPER_IMAGE_TAG} \
masroor/housing-gb-serving:${TAG}
View rb-housing-serve-local-curl
curl -X POST localhost:5000/predict -d 'json={"data":{"tensor":{"shape":[1,37],"values":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0]}}}'
{
"data": {
"names": [
"t:0",
"t:1"
],
"tensor": {
"shape": [
1,
View ab-testing-housing-serve-curl
curl -X POST seldon-core-ambassador.ml-serving:80/seldon/ab-testing-housing-serve/api/v0.1/predictions -d '{"data":{"tensor":{"shape":[1,37],"values":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0]}}}' -H "Content-Type: application/json"
{
"meta": {
"puid": "l7h22gr2malu8hv5om8u4p4kcp",
"tags": {
},
"routing": {
"ab-test": 1
},
"requestPath": {
You can’t perform that action at this time.