Skip to content

Commit e4052f0

Browse files
authored
Fix inconsistencies in model deployment documentation (#197)
1 parent 468ef8c commit e4052f0

File tree

12 files changed

+103
-78
lines changed

12 files changed

+103
-78
lines changed

ads/model/deployment/model_deployment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ModelDeployment(Builder):
165165
166166
Examples
167167
--------
168-
Build model deployment from builder apis:
168+
>>> # Build model deployment from builder apis:
169169
>>> ds_model_deployment = (ModelDeployment()
170170
... .with_display_name("TestModelDeployment")
171171
... .with_description("Testing the test model deployment")
@@ -211,7 +211,7 @@ class ModelDeployment(Builder):
211211
>>> ds_model_deployment.list(status="ACTIVE")
212212
>>> ds_model_deployment.delete()
213213
214-
Build model deployment from yaml
214+
>>> # Build model deployment from yaml
215215
>>> ds_model_deployment = ModelDeployment.from_yaml(uri=<path_to_yaml>)
216216
"""
217217

ads/model/generic_model.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ def deploy(
19901990
19911991
Example
19921992
-------
1993-
# This is an example to deploy model on container runtime
1993+
>>> # This is an example to deploy model on container runtime
19941994
>>> model = GenericModel(estimator=estimator, artifact_dir=tempfile.mkdtemp())
19951995
>>> model.summary_status()
19961996
>>> model.prepare(
@@ -2851,10 +2851,11 @@ def upload_artifact(
28512851
----------
28522852
uri: str
28532853
The destination location for the model artifacts, which can be a local path or
2854-
OCI object storage URI.
2855-
Examples:
2854+
OCI object storage URI. Examples:
2855+
28562856
>>> upload_artifact(uri="/some/local/folder/")
28572857
>>> upload_artifact(uri="oci://bucket@namespace/prefix/")
2858+
28582859
auth: (Dict, optional). Defaults to `None`.
28592860
The default authetication is set using `ads.set_auth` API. If you need to override the
28602861
default, use the `ads.common.auth.api_keys` or `ads.common.auth.resource_principal` to create appropriate

docs/source/user_guide/model_registration/_template/deploy.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
You can use the ``.deploy()`` method to deploy a model. You must first save the model to the model catalog, and then deploy it.
22

3+
.. admonition:: Deployment with Flex shape
4+
:class: note
5+
6+
It is mandatory to provide ``ocpus`` and ``memory_in_gb`` values, when deploy with Flex instance shapes. They are set in ``deployment_ocpus`` and ``deployment_memory_in_gbs`` of the ``deploy()`` method.
7+
38
The ``.deploy()`` method returns a ``ModelDeployment`` object. Specify deployment attributes such as display name, instance type, number of instances, maximum router bandwidth, and logging groups. The API takes the following parameters:
49

510
See `API documentation <../../ads.model.html#id1>`__ for more details about the parameters.

docs/source/user_guide/model_registration/frameworks/genericmodel.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ By default, the ``GenericModel`` serializes to a pickle file. The following exam
7777
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
7878
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
7979
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
80+
# Shape config details mandatory for flexible shapes:
81+
# deployment_instance_shape="VM.Standard.E4.Flex",
82+
# deployment_ocpus=<number>,
83+
# deployment_memory_in_gbs=<number>,
8084
)
8185
8286
print(f"Endpoint: {generic_model.model_deployment.url}")

docs/source/user_guide/model_registration/frameworks/huggingfacemodel.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,19 @@ Deploy and Generate Endpoint
105105

106106
.. code-block:: python3
107107
108-
>>> # Deploy and create an endpoint for the huggingface_pipeline_model
109-
>>> huggingface_pipeline_model.deploy(
110-
... display_name="HuggingFace Pipeline Model For Image Segmentation",
111-
... deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
112-
... deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
113-
... deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
114-
... )
115-
>>> print(f"Endpoint: {huggingface_pipeline_model.model_deployment.url}")
108+
# Deploy and create an endpoint for the huggingface_pipeline_model
109+
huggingface_pipeline_model.deploy(
110+
display_name="HuggingFace Pipeline Model For Image Segmentation",
111+
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
112+
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
113+
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
114+
# Shape config details mandatory for flexible shapes:
115+
# deployment_instance_shape="VM.Standard.E4.Flex",
116+
# deployment_ocpus=<number>,
117+
# deployment_memory_in_gbs=<number>,
118+
)
119+
print(f"Endpoint: {huggingface_pipeline_model.model_deployment.url}")
120+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
116121
117122
Run Prediction against Endpoint
118123
===============================

docs/source/user_guide/model_registration/frameworks/lightgbmmodel.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ Deploy and Generate Endpoint
9595

9696
.. code-block:: python3
9797
98-
>>> # Deploy and create an endpoint for the LightGBM model
99-
>>> lightgbm_model.deploy(
100-
display_name="LightGBM Model For Classification",
101-
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
102-
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
103-
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
104-
)
105-
106-
107-
>>> print(f"Endpoint: {lightgbm_model.model_deployment.url}")
108-
109-
https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
110-
98+
# Deploy and create an endpoint for the LightGBM model
99+
lightgbm_model.deploy(
100+
display_name="LightGBM Model For Classification",
101+
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
102+
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
103+
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
104+
# Shape config details mandatory for flexible shapes:
105+
# deployment_instance_shape="VM.Standard.E4.Flex",
106+
# deployment_ocpus=<number>,
107+
# deployment_memory_in_gbs=<number>,
108+
)
109+
print(f"Endpoint: {lightgbm_model.model_deployment.url}")
110+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
111111
112112
Run Prediction against Endpoint
113113
===============================

docs/source/user_guide/model_registration/frameworks/pytorchmodel.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,19 @@ Deploy and Generate Endpoint
215215

216216
.. code-block:: python3
217217
218-
>>> # Deploy and create an endpoint for the PyTorch model
219-
>>> pytorch_model.deploy(
220-
display_name="PyTorch Model For Classification",
221-
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
222-
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
223-
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
224-
)
225-
226-
227-
>>> print(f"Endpoint: {pytorch_model.model_deployment.url}")
228-
229-
https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
218+
# Deploy and create an endpoint for the PyTorch model
219+
pytorch_model.deploy(
220+
display_name="PyTorch Model For Classification",
221+
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
222+
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
223+
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
224+
# Shape config details mandatory for flexible shapes:
225+
# deployment_instance_shape="VM.Standard.E4.Flex",
226+
# deployment_ocpus=<number>,
227+
# deployment_memory_in_gbs=<number>,
228+
)
229+
print(f"Endpoint: {pytorch_model.model_deployment.url}")
230+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
230231
231232
Run Prediction against Endpoint
232233
===============================

docs/source/user_guide/model_registration/frameworks/sklearnmodel.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,19 @@ Deploy and Generate Endpoint
9090

9191
.. code-block:: python3
9292
93-
>>> # Deploy and create an endpoint for the Random Forest model
94-
>>> sklearn_model.deploy(
95-
display_name="Random Forest Model For Classification",
96-
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
97-
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
98-
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
99-
)
100-
>>> print(f"Endpoint: {sklearn_model.model_deployment.url}")
101-
https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
102-
93+
# Deploy and create an endpoint for the Random Forest model
94+
sklearn_model.deploy(
95+
display_name="Random Forest Model For Classification",
96+
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
97+
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
98+
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
99+
# Shape config details mandatory for flexible shapes:
100+
# deployment_instance_shape="VM.Standard.E4.Flex",
101+
# deployment_ocpus=<number>,
102+
# deployment_memory_in_gbs=<number>,
103+
)
104+
print(f"Endpoint: {sklearn_model.model_deployment.url}")
105+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
103106
104107
Run Prediction against Endpoint
105108
===============================

docs/source/user_guide/model_registration/frameworks/sparkpipelinemodel.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,19 @@ Deploy and Generate Endpoint
117117

118118
.. code-block:: python3
119119
120+
# Deploy and create an endpoint for the Spark Pipeline model
120121
spark_model.deploy(
121122
display_name="Spark Pipeline Model For Classification",
122123
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
123124
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
124125
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
126+
# Shape config details mandatory for flexible shapes:
127+
# deployment_instance_shape="VM.Standard.E4.Flex",
128+
# deployment_ocpus=<number>,
129+
# deployment_memory_in_gbs=<number>,
125130
)
126-
127131
print(f"Endpoint: {spark_model.model_deployment.url}")
128-
129-
# https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
130-
132+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
131133
132134
Run Prediction against Endpoint
133135
===============================

docs/source/user_guide/model_registration/frameworks/tensorflowmodel.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,19 @@ Deploy and Generate Endpoint
9494

9595
.. code-block:: python3
9696
97-
>>> # Deploy and create an endpoint for the TensorFlow model
98-
>>> tensorflow_model.deploy(
99-
display_name="TensorFlow Model For Classification",
100-
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
101-
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
102-
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
103-
)
104-
105-
106-
>>> print(f"Endpoint: {tensorflow_model.model_deployment.url}")
107-
108-
https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
109-
97+
# Deploy and create an endpoint for the TensorFlow model
98+
tensorflow_model.deploy(
99+
display_name="TensorFlow Model For Classification",
100+
deployment_log_group_id="ocid1.loggroup.oc1.xxx.xxxxx",
101+
deployment_access_log_id="ocid1.log.oc1.xxx.xxxxx",
102+
deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
103+
# Shape config details mandatory for flexible shapes:
104+
# deployment_instance_shape="VM.Standard.E4.Flex",
105+
# deployment_ocpus=<number>,
106+
# deployment_memory_in_gbs=<number>,
107+
)
108+
print(f"Endpoint: {tensorflow_model.model_deployment.url}")
109+
# Output: "Endpoint: https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx"
110110
111111
Run Prediction against Endpoint
112112
===============================

0 commit comments

Comments
 (0)