Skip to content

Commit

Permalink
Set flags for TrainedModelSpec to be included in openapi-gen (kubeflo…
Browse files Browse the repository at this point in the history
…w#1302)

* Included openapi-gen for Trained Model Spec

* Generated python file for trained model spec

* Result of openapi-gen

* Revert "Result of openapi-gen"

This reverts commit 4ddf01777e3e408e43ae268a20e9411ad242bc04.

* Result of openapi-gen

* Included modelspec with openapi-gen

* Client gen for model spec

* Added correct parameters

* Added dummy model to parameter

* Imported V1alpha1TrainedModel

* Removed invalid character

* Add correct parameters

* Fixing invalid syntax
  • Loading branch information
abchoo authored Jan 15, 2021
1 parent b8b3584 commit b5f5fa2
Show file tree
Hide file tree
Showing 19 changed files with 734 additions and 56 deletions.
1 change: 1 addition & 0 deletions hack/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ API rule violation: list_type_missing,./pkg/apis/serving/v1beta1,PodSpec,InitCon
API rule violation: list_type_missing,./pkg/apis/serving/v1beta1,PodSpec,ReadinessGates
API rule violation: list_type_missing,./pkg/apis/serving/v1beta1,PodSpec,Tolerations
API rule violation: list_type_missing,./pkg/apis/serving/v1beta1,PodSpec,Volumes
API rule violation: names_match,./pkg/apis/serving/v1alpha1,ModelSpec,StorageURI
API rule violation: names_match,./pkg/apis/serving/v1beta1,AlibiExplainerSpec,StorageURI
API rule violation: names_match,./pkg/apis/serving/v1beta1,ComponentExtensionSpec,TimeoutSeconds
API rule violation: names_match,./pkg/apis/serving/v1beta1,ExplainerConfig,ContainerImage
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/serving/v1alpha1/trained_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type TrainedModelList struct {
}

// TrainedModelSpec defines the trained model spec
// +k8s:openapi-gen=true
type TrainedModelSpec struct {
// parent inference service to deploy to
// +required
Expand All @@ -57,6 +58,7 @@ type TrainedModelSpec struct {
}

// ModelSpec describes a trained model
// +k8s:openapi-gen=true
type ModelSpec struct {
// Storage URI for the model repository
StorageURI string `json:"storageUri"`
Expand Down
67 changes: 67 additions & 0 deletions pkg/apis/serving/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions pkg/apis/serving/v1beta1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@
},
"paths": {},
"definitions": {
"v1alpha1.ModelSpec": {
"description": "ModelSpec describes a trained model",
"type": "object",
"required": [
"storageUri",
"framework"
],
"properties": {
"framework": {
"description": "Machine Learning \u003cframework name\u003e The values could be: \"tensorflow\",\"pytorch\",\"sklearn\",\"onnx\",\"xgboost\", \"myawesomeinternalframework\" etc.",
"type": "string"
},
"memory": {
"description": "Maximum memory this model will consume, this field is used to decide if a model server has enough memory to load this model.",
"$ref": "#/definitions/resource.Quantity"
},
"storageUri": {
"description": "Storage URI for the model repository",
"type": "string"
}
}
},
"v1alpha1.TrainedModel": {
"description": "TrainedModel is the Schema for the TrainedModel API",
"type": "object",
Expand Down Expand Up @@ -57,6 +79,24 @@
}
}
},
"v1alpha1.TrainedModelSpec": {
"description": "TrainedModelSpec defines the trained model spec",
"type": "object",
"required": [
"inferenceService",
"model"
],
"properties": {
"inferenceService": {
"description": "parent inference service to deploy to",
"type": "string"
},
"model": {
"description": "Predictor model spec",
"$ref": "#/definitions/v1alpha1.ModelSpec"
}
}
},
"v1beta1.AIXExplainerSpec": {
"description": "AIXExplainerSpec defines the arguments for configuring an AIX Explanation Server",
"type": "object",
Expand Down
13 changes: 13 additions & 0 deletions python/kfserving/docs/V1alpha1ModelSpec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# V1alpha1ModelSpec

ModelSpec describes a trained model
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**framework** | **str** | Machine Learning <framework name> The values could be: \"tensorflow\",\"pytorch\",\"sklearn\",\"onnx\",\"xgboost\", \"myawesomeinternalframework\" etc. |
**memory** | [**ResourceQuantity**](ResourceQuantity.md) | | [optional]
**storage_uri** | **str** | Storage URI for the model repository |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


12 changes: 12 additions & 0 deletions python/kfserving/docs/V1alpha1TrainedModelSpec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# V1alpha1TrainedModelSpec

TrainedModelSpec defines the trained model spec
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**inference_service** | **str** | parent inference service to deploy to |
**model** | [**V1alpha1ModelSpec**](V1alpha1ModelSpec.md) | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


7 changes: 4 additions & 3 deletions python/kfserving/docs/V1beta1ComponentStatusSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ ComponentStatusSpec describes the state of the component
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**address** | [**KnativeAddressable**](KnativeAddressable.md) | | [optional]
**latest_created_revision** | **str** | Latest revision name that is in created | [optional]
**latest_created_revision** | **str** | Latest revision name that is created | [optional]
**latest_ready_revision** | **str** | Latest revision name that is in ready state | [optional]
**previous_ready_revision** | **str** | Previous revision name that is in ready state | [optional]
**traffic_percent** | **int** | Traffic percent on the latest ready revision | [optional]
**latest_rolledout_revision** | **str** | Latest revision name that is rolled out with 100 percent traffic | [optional]
**previous_rolledout_revision** | **str** | Previous revision name that is rolled out with 100 percent traffic | [optional]
**traffic** | [**list[KnativeDevServingPkgApisServingV1TrafficTarget]**](KnativeDevServingPkgApisServingV1TrafficTarget.md) | Traffic holds the configured traffic distribution for latest ready revision and previous rolled out revision. | [optional]
**url** | [**KnativeURL**](KnativeURL.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
2 changes: 1 addition & 1 deletion python/kfserving/docs/V1beta1TorchServeSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Name | Type | Description | Notes
**image_pull_policy** | **str** | Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images | [optional]
**lifecycle** | [**V1Lifecycle**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Lifecycle.md) | | [optional]
**liveness_probe** | [**V1Probe**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Probe.md) | | [optional]
**model_class_name** | **str** | Defaults PyTorch model class name to 'PyTorchModel' | [optional]
**model_class_name** | **str** | When this field is specified KFS chooses the KFServer implementation, otherwise KFS uses the TorchServe implementation | [optional]
**name** | **str** | Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated. | [optional]
**ports** | [**list[V1ContainerPort]**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ContainerPort.md) | List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated. | [optional]
**protocol_version** | **str** | Protocol version to use by the predictor (i.e. v1 or v2) | [optional]
Expand Down
2 changes: 2 additions & 0 deletions python/kfserving/kfserving/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
from __future__ import absolute_import

# import models into model package
from kfserving.models.v1alpha1_model_spec import V1alpha1ModelSpec
from kfserving.models.v1alpha1_trained_model import V1alpha1TrainedModel
from kfserving.models.v1alpha1_trained_model_list import V1alpha1TrainedModelList
from kfserving.models.v1alpha1_trained_model_spec import V1alpha1TrainedModelSpec
from kfserving.models.v1beta1_aix_explainer_spec import V1beta1AIXExplainerSpec
from kfserving.models.v1beta1_art_explainer_spec import V1beta1ARTExplainerSpec
from kfserving.models.v1beta1_alibi_explainer_spec import V1beta1AlibiExplainerSpec
Expand Down
Loading

0 comments on commit b5f5fa2

Please sign in to comment.