Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func describeAPI(name string, resourcesRes *schema.GetResourcesResponse, flagVer

out += fmt.Sprintf("\n%s curl %s?debug=true -X POST -H \"Content-Type: application/json\" -d @sample.json", console.Bold("curl:"), apiEndpoint)

if api.TensorFlow != nil || api.ONNX != nil {
if api.Predictor.Type == userconfig.TensorFlowPredictorType || api.Predictor.Type == userconfig.ONNXPredictorType {
out += "\n\n" + describeModelInput(groupStatus, apiEndpoint)
}

Expand Down
10 changes: 6 additions & 4 deletions docs/deployments/onnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ You can deploy ONNX models as web services by defining a class that implements C
- kind: api
name: <string> # API name (required)
endpoint: <string> # the endpoint for the API (default: /<deployment_name>/<api_name>)
onnx:
predictor:
type: onnx
path: <string> # path to a python file with an ONNXPredictor class definition, relative to the Cortex root (required)
model: <string> # S3 path to an exported model (e.g. s3://my-bucket/exported_model.onnx) (required)
predictor: <string> # path to a python file with an ONNXPredictor class definition, relative to the Cortex root (required)
config: <string: value> # dictionary passed to the constructor of a Predictor (optional)
python_path: <string> # path to the root of your Python folder that will be appended to PYTHONPATH (default: folder containing cortex.yaml)
env: <string: string> # dictionary of environment variables
Expand All @@ -36,9 +37,10 @@ See [packaging ONNX models](../packaging-models/onnx.md) for information about e
```yaml
- kind: api
name: my-api
onnx:
predictor:
type: onnx
path: predictor.py
model: s3://my-bucket/my-model.onnx
predictor: predictor.py
compute:
gpu: 1
```
Expand Down
5 changes: 3 additions & 2 deletions docs/deployments/prediction-monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ For classification models, the tracker should be configured with `model_type: cl
```yaml
- kind: api
name: iris
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
tracker:
model_type: classification
```
5 changes: 3 additions & 2 deletions docs/deployments/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ In addition to supporting Python models via the Python Predictor interface, Cort
- kind: api
name: <string> # API name (required)
endpoint: <string> # the endpoint for the API (default: /<deployment_name>/<api_name>)
python:
predictor: <string> # path to a python file with a PythonPredictor class definition, relative to the Cortex root (required)
predictor:
type: python
path: <string> # path to a python file with a PythonPredictor class definition, relative to the Cortex root (required)
config: <string: value> # dictionary passed to the constructor of a Predictor (optional)
python_path: <string> # path to the root of your Python folder that will be appended to PYTHONPATH (default: folder containing cortex.yaml)
env: <string: string> # dictionary of environment variables
Expand Down
10 changes: 6 additions & 4 deletions docs/deployments/tensorflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ You can deploy TensorFlow models as web services by defining a class that implem
- kind: api
name: <string> # API name (required)
endpoint: <string> # the endpoint for the API (default: /<deployment_name>/<api_name>)
tensorflow:
predictor:
type: tensorflow
path: <string> # path to a python file with a TensorFlowPredictor class definition, relative to the Cortex root (required)
model: <string> # S3 path to an exported model (e.g. s3://my-bucket/exported_model) (required)
predictor: <string> # path to a python file with a TensorFlowPredictor class definition, relative to the Cortex root (required)
signature_key: <string> # name of the signature def to use for prediction (required if your model has more than one signature def)
config: <string: value> # dictionary that can be used to configure custom values (optional)
python_path: <string> # path to the root of your Python folder that will be appended to PYTHONPATH (default: folder containing cortex.yaml)
Expand All @@ -37,9 +38,10 @@ See [packaging TensorFlow models](../packaging-models/tensorflow.md) for how to
```yaml
- kind: api
name: my-api
tensorflow:
predictor:
type: tensorflow
path: predictor.py
model: s3://my-bucket/my-model
predictor: predictor.py
compute:
gpu: 1
```
Expand Down
3 changes: 2 additions & 1 deletion docs/packaging-models/onnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Reference your model in an `api`:
```yaml
- kind: api
name: my-api
onnx:
predictor:
type: onnx
model: s3://my-bucket/model.onnx
predictor: predictor.py
```
6 changes: 4 additions & 2 deletions docs/packaging-models/tensorflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Reference your model in an `api`:
```yaml
- kind: api
name: my-api
tensorflow:
predictor:
type: tensorflow
model: s3://my-bucket/bert
predictor: predictor.py
```
Expand All @@ -56,7 +57,8 @@ Reference the zipped model in an `api`:
```yaml
- kind: api
name: my-api
tensorflow:
predictor:
type: tensorflow
model: s3://my-bucket/bert.zip
predictor: predictor.py
```
5 changes: 3 additions & 2 deletions examples/pytorch/answer-generator/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: generator
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
device: cuda # use "cpu" to run on CPUs
compute:
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/image-classifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
compute:
cpu: 1
gpu: 1
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/iris-classifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
model: s3://cortex-examples/pytorch/iris-classifier/weights.pth
tracker:
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/language-identifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: identifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
tracker:
model_type: classification
compute:
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/reading-comprehender/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: comprehender
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
compute:
cpu: 1
gpu: 1
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/search-completer/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: completer
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
compute:
cpu: 1
gpu: 1
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/text-generator/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: generator
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
num_words: 50
device: cuda # use "cpu" to run on CPUs
Expand Down
5 changes: 3 additions & 2 deletions examples/pytorch/text-summarizer/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

- kind: api
name: summarizer
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
compute:
mem: 4G
40 changes: 24 additions & 16 deletions examples/sklearn/iris-classifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ Create a `cortex.yaml` file and add the configuration below. A `deployment` spec

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand Down Expand Up @@ -178,8 +179,9 @@ Add a `tracker` to your `cortex.yaml` and specify that this is a classification

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand Down Expand Up @@ -221,8 +223,9 @@ This model is fairly small but larger models may require more compute resources.

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand Down Expand Up @@ -267,8 +270,9 @@ If you trained another model and want to A/B test it with your previous model, s

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand All @@ -280,8 +284,9 @@ If you trained another model and want to A/B test it with your previous model, s

- kind: api
name: another-classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/another-model.pkl
Expand Down Expand Up @@ -353,8 +358,9 @@ Next, add the `api` to `cortex.yaml`:

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand All @@ -366,8 +372,9 @@ Next, add the `api` to `cortex.yaml`:

- kind: api
name: another-classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/another-model.pkl
Expand All @@ -380,8 +387,9 @@ Next, add the `api` to `cortex.yaml`:

- kind: api
name: batch-classifier
python:
predictor: batch-predictor.py
predictor:
type: python
path: batch-predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand Down
15 changes: 9 additions & 6 deletions examples/sklearn/iris-classifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand All @@ -18,8 +19,9 @@

- kind: api
name: another-classifier
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/another-model.pkl
Expand All @@ -31,8 +33,9 @@

- kind: api
name: batch-classifier
python:
predictor: batch-predictor.py
predictor:
type: python
path: batch-predictor.py
config:
bucket: cortex-examples
key: sklearn/iris-classifier/model.pkl
Expand Down
5 changes: 3 additions & 2 deletions examples/sklearn/mpg-estimator/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

- kind: api
name: estimator
python:
predictor: predictor.py
predictor:
type: python
path: predictor.py
config:
model: s3://cortex-examples/sklearn/mpg-estimator/linreg
5 changes: 3 additions & 2 deletions examples/tensorflow/image-classifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

- kind: api
name: classifier
tensorflow:
predictor:
type: tensorflow
path: predictor.py
model: s3://cortex-examples/tensorflow/image-classifier/inception
predictor: predictor.py
tracker:
model_type: classification
compute:
Expand Down
5 changes: 3 additions & 2 deletions examples/tensorflow/iris-classifier/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

- kind: api
name: classifier
tensorflow:
predictor:
type: tensorflow
path: predictor.py
model: s3://cortex-examples/tensorflow/iris-classifier/nn
predictor: predictor.py
tracker:
model_type: classification
5 changes: 3 additions & 2 deletions examples/tensorflow/sentiment-analyzer/cortex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

- kind: api
name: analyzer
tensorflow:
predictor:
type: tensorflow
path: predictor.py
model: s3://cortex-examples/tensorflow/sentiment-analyzer/bert
predictor: predictor.py
tracker:
model_type: classification
compute:
Expand Down
Loading