Skip to content

Commit

Permalink
Trained model api (kubeflow#1009)
Browse files Browse the repository at this point in the history
* trained model api

* remove frameworks' version information
  • Loading branch information
yuzliu authored Aug 10, 2020
1 parent 42653a1 commit bf7b559
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/apis/serving/v1beta1/trained_model.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package v1beta1

import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
type TrainedModel struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TrainedModelSpec `json:"spec,omitempty"`
Status TrainedModelStatus `json:"status,omitempty"`
}

// TrainedModelList contains a list of TrainedModel
// +kubebuilder:object:root=true
type TrainedModelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// +listType=set
Items []TrainedModel `json:"items"`
}

type TrainedModelSpec struct {
// Required field for parent inference service
InferenceService string `json:"inferenceService"`
// Predictor model spec
PredictorModel ModelSpec `json:"predictorModel"`
}
type ModelSpec struct {
// Storage URI for the model repository
StorageURI string `json:"storageUri"`
// Machine Learning <framework name>
// The values could be: "tensorflow","pytorch","sklearn","onnx","xgboost", "myawesomeinternalframework" etc.
Framework string `json:"framework"`
// Maximum memory this model will consume, this field is used to decide if a model server has enough memory to load this model.
Memory resource.Quantity `json:"memory,omitempty"`
}
13 changes: 13 additions & 0 deletions pkg/apis/serving/v1beta1/trained_model_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package v1beta1

import (
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
)

type TrainedModelStatus struct {
// Condition for "Deployed"
duckv1beta1.Status `json:",inline"`
// Addressable endpoint for the deployed trained model
// http://<inferenceservice.metadata.name>/v1/models/<trainedmodel>.metadata.name
Address *duckv1beta1.Addressable `json:"address,omitempty"`
}

0 comments on commit bf7b559

Please sign in to comment.