CLI tool for hydro-serving.
pip install hs
Since 0.1.0 the tool uses configurable endpoints called cluster: They can be managed with:
hs cluster
- shows default clusterhs cluster add --name local --server http://localhost
- creates entry with namelocal
and addresshttp://localhost
.hs cluster use local
- uses the previously createdlocal
cluster as defaulths cluster rm local
- removeslocal
cluster entry
The default cluster is used as endpoint for all API calls made from the CLI tool.
When you use hs upload
, the tool looks for serving.yaml
file in current dir.
serving.yaml
defines model metadata and contract
kind: Model
name: "example_model"
install-command: "pip install requirements.txt" # if you need to run additional command before deployment
runtime: "hydrosphere/serving-runtime-python:3.6-latest"
payload:
- "saved_model.pb"
- "variables/"
monitoring:
- name: ks
kind: KSMetricSpec
config:
input: client_profile_42
with-health: true
- name: gan
kind: GANMetricSpec
with-health: true
config:
input: feature
application: claims-gan-app
- name: autoencoder
kind: AEMetricSpec
with-health: true
config:
application: claims-autoencoder-app
input: feature
threshold: 69
contract:
name: detect # the name of signature
inputs: # signature input fields
image_b64:
type: string
outputs: # signature output fields
scores:
shape: [-1]
type: double
classes:
shape: [-1]
type: string
The command takes -f
path parameter to yaml file or directory containing yaml files.
Then, it will read the yaml documents and apply them sequentially.
These files can contain definition of a resource defined below:
The model definition is the same as in serving.yaml
file.
Example of a selector definition:
kind: HostSelector
name: xeon-cpu
node_selector: "/* INSTANCE SELECTOR */"
Note that selector is a string that defines platform specific filter on instances.
For the sake of simplicity CLI provides simplified structures for major use cases:
- Single model app:
kind: Application
name: demo-app
singular:
model: demo_model:2
- Pipeline app
kind: Application
name: demo-pipeline-app
pipeline:
- - model: claims-preprocessing:1
- - model: claims-model:1
weight: 80
- model: claims-model:2
weight: 20