Skip to content

Commit fb792de

Browse files
committed
Update docs
1 parent db99efd commit fb792de

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

docs/apis/packaging-models.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ Reference your `model` in an API:
3131
Export your trained model to an ONNX model format. An example of an sklearn model being exported to ONNX is shown below:
3232
3333
```Python
34+
from sklearn.linear_model import LogisticRegression
35+
from onnxmltools import convert_sklearn
36+
from onnxconverter_common.data_types import FloatTensorType
37+
3438
...
35-
logreg_model = sklearn.linear_model.LogisticRegression(solver="lbfgs", multi_class="multinomial")
3639

37-
# Train the model
40+
logreg_model = LogisticRegression(solver="lbfgs", multi_class="multinomial")
3841
logreg_model.fit(X_train, y_train)
3942

4043
# Convert to ONNX model format
41-
onnx_model = onnxmltools.convert_sklearn(
42-
logreg_model, initial_types=[("input", onnxconverter_common.data_types.FloatTensorType([1, 4]))]
43-
)
44-
with open("model.onnx", "wb") as f:
44+
onnx_model = convert_sklearn(logreg_model, initial_types=[("input", FloatTensorType([1, 4]))])
45+
with open("sklearn.onnx", "wb") as f:
4546
f.write(onnx_model.SerializeToString())
4647
```
4748
@@ -63,6 +64,6 @@ Reference your `model` in an API:
6364
```yaml
6465
- kind: api
6566
name: my-api
66-
model_format: onnx
6767
model: s3://my-bucket/model.onnx
68+
model_format: onnx
6869
```

docs/apis/python-packages.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
# Python Packages
22

3-
Cortex allows you to install additional Python packages that can be made available to aggregators, transformers, and estimators.
3+
Cortex allows you to install additional Python packages to be used in any workload.
44

55
## PyPI Packages
66

7-
Cortex looks for a `requirements.txt` file in the top level cortex directory (in the same level as `cortex.yaml`). All packages listed in `requirements.txt` will be made available to aggregators, transformers, and estimators.
7+
Cortex looks for a `requirements.txt` file in the top level cortex directory (in the same level as `cortex.yaml`).
88

99
```text
1010
./iris/
1111
├── cortex.yaml
12-
├── requirements.txt
13-
├── samples.json
14-
├── implementations/
15-
└── resources/
12+
├── ...
13+
└── requirements.txt
1614
```
1715

1816
## Custom Packages
1917

2018
Cortex looks for your Python packages in the directory `./packages/<package name>`. The package must have a `setup.py` in the root of the package directory with the name set to your package name. Cortex will run `pip3 wheel -w wheelhouse ./packages/<package name>` to construct wheels for the Python Project.
2119

22-
Cortex Directory
23-
2420
```text
2521
./iris/
2622
├── cortex.yaml
27-
├── samples.json
28-
├── implementations/
29-
├── resources/
23+
├── ...
3024
└── packages
3125
└── acme-util
3226
├── acme-util/

examples/iris/keras/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
from sklearn.datasets import load_iris
32
from sklearn.model_selection import train_test_split
43
from keras.models import Sequential

examples/iris/sklearn/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
from sklearn.datasets import load_iris
32
from sklearn.model_selection import train_test_split
43
from sklearn.linear_model import LogisticRegression

examples/iris/xgboost/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy as np
21
import xgboost as xgb
32
from sklearn.datasets import load_iris
43
from sklearn.model_selection import train_test_split

0 commit comments

Comments
 (0)