Knowledge Graph
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    Model Store Service versions the machine learning models including their ingredients like code, data, config,environment and to track ML metadata across the model lifecycle. Use Model Repository Service in order to: * Make ML models reproducible * Register, track, Manage, and version your trained, deployed, and retired models in a central repository that is organized and searchable. * Store the metadata for your trained models, as well as their runtime dependencies so the deployment process is eased. * Build automated pipelines that make continuous integration, delivery, and training of your production model possible. * Compare models running in production (champion models) to freshly trained models (or challenger models) in the staging environment. The model repository **should be able to**: * **Register** the model, * **Assign** a version to it, * Note **the version of the dataset** the model was trained on, * Add **annotations** and **tags**, * Retrieve **the parameters, validation results** (including metrics and visualizations), and **other relevant model metadata** on the model from the experiment management system. * Integrate with existing CI/CD pipelines like Jenkins, Chef, and so on. * Use webhooks to trigger downstream actions for model validation and deployment. * Automatically track model versions and tagged releases. To **make** **collaboration** **easier**, the repository design will include details such * The model owner or developer, * Experiment run id the model was trained under, * Versioned model source code, * Environment runtime dependencies used to train the model (and the versions), * Comments and model change history, * And the model documentation **Requirements / Features** of ModelRepository Design : * Model Validation * Model Versioning * Model Storage : Database for logging model metadata details. * Artifact Storage : Object storage for models and artifacts. * Model Tracing * Model Discovery * Event Hooks for notifying Model Deployment * API integration for both receiving models, promoting models across various environments and collecting model information from the different environments. * User interface (UI) for ML teams to interact with a visual workflow. ## Model Repository ### Proto Definitions ```protobuf= /* CortexModelSchema is define by Data Scientist */ message CortexModel { Token model_id = 1; // generated by IdentityService Todo Token api_id = 2; CortexModelSchema model_schema = 3; } /* CortexModelSchema is define by Data Scientist */ message CortexModelSchema { CortexModelStatus status = 1; // Current status of ``model_status`` repeated CortexModelTag tags = 2; // Tags: Additional metadata key-value pairs for this ``model_version``. CortexModelAlgorithm model_algorithm = 3; // e.g. decision trees, SVM’s, etc. CortexModelHyperParameter model_hyper_parameter = 4; CortexModelSignature model_signature = 5; CortexModelDeploymentUnit deployment_unit = 6; CortexModelMetrics metrics = 7; int64 created_on = 8; // Timestamp recorded when this ``model `` was created. int64 last_updated_on = 9; // Timestamp recorded when metadata for this ``model `` was last updated. } enum CortexModelStatus { MODEL_STATUS_PENDING_REGISTRATION = 0; // Request to register a new model version is pending as server performs background tasks. MODEL_STATUS_FAILED_REGISTRATION = 1; // Request to register a new model version has failed. MODEL_STATUS_READY = 2; // The tag value. } message CortexModelTag { // The tag key. optional string key = 1; // The tag value. optional string value = 2; } // A Specific algorithm used such that it has a unique set of hyper-parameters enum CortexModelAlgorithm { CORTEX_MODEL_ALGORITHM_ML_DECISION_TREE = 0; CORTEX_MODEL_ALGORITHM_ML_RANDOM_FORREST = 1; CORTEX_MODEL_ALGORITHM_ML_SUPPORT_VECTOR_MACHINES = 2; } message CortexModelHyperParameter { CortexModelAlgorithm algorithm = 1; // SVM // CORTEX_MODEL_HYPER_PARAMETERS_SVM_C = 0; // CORTEX_MODEL_HYPER_PARAMETERS_SVM_GAMMA = 11; // DT // CORTEX_MODEL_HYPER_PARAMETERS_DECISION_TREE_DEPTH = 12; map<string, string> key_value_schema = 2; // key = BrainQuantitySymbolicSchema - ex. Collection : // /common/quantity/symbolic/model/svm_hyperparameter [C, GAMMA] // value = schema of the value for the key ex. /common/quantity/symbolic/model/svm_hyperparameter/gamma // can take values btw 0-1, // /common/quantity/symbolic/model/decision_tree_hyperparameter/depth can take between 0-100 etc } // The Model signature defines the schema of a model’s inputs and outputs. // Model inputs and outputs can be either column-based or tensor-based. message CortexModelSignature { // {"/healthcare/patient/attribute/weight": "1", "/healthcare/patient/attribute/age": "0", "/healthcare/patient/feature/sugar_level": "2"} map<string, string> input_feature_to_index_mapping = 1; repeated string input_schema = 2; // subset of input feature from CortexAPI, derived and transformed features // bmi = [weight/height] CortexModelPreprocessor model_preprocessors = 3; CortexModelPostprocessor model_postprocessors = 4; CortexModelImagePreprocessor model_image_preprocessor = 5; telos.cortex.common.CortexApiOutputSchema output_schema = 6; } // This is a function of CortexApiInputType message CortexModelPreprocessor { telos.proto.core.expressions.TelosCoreExpression transformations = 1; } message CortexModelPostprocessor { oneof post_processor { BrainImageResizer resizer = 1; } telos.proto.core.expressions.TelosCoreExpression transformations = 2; } message CortexModelImagePreprocessor { oneof pre_processor { BrainImageResizer resizer = 1; BrainImageColorConversion color_conversion = 2; BrainImageCropping cropping = 3; BrainImageAdjustment adjustment = 4; BrainImageTranspose transpose = 5; } } message BrainImageResizer { uint32 height = 1; uint32 width = 2; uint32 padding = 3; } message BrainImageColorConversion { BrainImageColorConversionType source = 1; BrainImageColorConversionType target = 2; } enum BrainImageColorConversionType { BRAIN_IMAGE_COLOR_TYPE_RGB = 0; BRAIN_IMAGE_COLOR_TYPE_GRAY_SCALE = 1; BRAIN_IMAGE_COLOR_TYPE_HSV = 2; BRAIN_IMAGE_COLOR_TYPE_YIQ = 3; BRAIN_IMAGE_COLOR_TYPE_YUV = 4; } message BrainImageCropping { uint32 x_coordinate = 1; uint32 y_coordinate = 2; uint32 height = 3; uint32 width = 4; } message BrainImageAdjustment { // Todo } message BrainImageTranspose { // Todo } //// Multi-variate //message CortexModelMultiVariatePreprocessor { // BrainExpressionProgram transformations = 1 ; //} ////Todo //message CortexModelTimeSeriesPreprocessor { // BrainExpressionProgram transformations = 1 ; //} // ////Todo //message CortexModelTextTweetPreprocessor { // BrainExpressionProgram transformations = 1 ; //} message CortexModelDeploymentUnit { CortexModelVariant model_variant = 1; //variant name(MODEL_FRAMEWORK_SKLEARN) & variantVersion(0.24.2) CortexModelSerializationFormat serialize_format = 2; //lib(MODEL_SERIALIZATION_PICKLE) and version("4.0") telos.cortex.common.CortexModelArtifactStoreRequest model_artifact = 3;// Artifact Information CortexModelDependencies dependencies = 4; CortexModelCompute compute_dependencies = 5; CortexModelDeploymentStage deployment_stage = 6; } message CortexModelVariant { CortexModelFramework framework = 1; // "scikit-learn" string framework_version = 2; //0.24.2 } enum CortexModelFramework { MODEL_FRAMEWORK_SKLEARN_DEFAULT = 0; MODEL_FRAMEWORK_SKLEARN = 1; MODEL_FRAMEWORK_TENSORFLOW = 2; MODEL_FRAMEWORK_PYTORCH = 3; MODEL_FRAMEWORK_MXNET = 4; MODEL_FRAMEWORK_CAFFE = 5; } message CortexModelSerializationFormat { CortexModelSerialization serialization_lib = 1; //pickle string serialization_lib_version = 2; //pickle 1.0 } enum CortexModelSerialization{ MODEL_SERIALIZATION_PICKLE_DEFAULT = 0; MODEL_SERIALIZATION_PICKLE = 1; MODEL_SERIALIZATION_JOB_LIB = 2; MODEL_SERIALIZATION_H5 = 3; } message CortexModelDependencies { string name = 1; string version = 2; } message CortexModelCompute { // TODO discuss with team oneof compute_type { CortexModelCPUCompute cpu = 1; CortexModelGPUCompute gpu = 2; } } message CortexModelCPUCompute { CortexCpuType cpu_type = 1; int32 no_of_cores = 2; float ram = 3; } enum CortexGpuType { CORTEX_GPU_TYPE_NVIDIA_DEFAULT = 0; CORTEX_GPU_TYPE_NVIDIA = 1; CORTEX_GPU_TYPE_AMD = 2; } enum CortexCpuType { CORTEX_CPU_TYPE_INTEL_DEFAULT = 0; CORTEX_CPU_TYPE_INTEL = 1; CORTEX_CPU_TYPE_AMD = 2; CORTEX_CPU_TYPE_M1 = 3; CORTEX_CPU_TYPE_M2 = 4; } message CortexModelGPUCompute { // TODO discuss with team CortexGpuType gpu_type = 1; } message CortexModelMetrics{ string key = 1; string value = 2; } enum CortexModelDeploymentStage { CORTEX_MODEL_DEPLOYMENT_STAGE_DEVELOPMENT = 0; // still under development CORTEX_MODEL_DEPLOYMENT_STAGE_TRUST = 1; // privacy and fairness review pending CORTEX_MODEL_DEPLOYMENT_STAGE_BENCHMARKING = 2; // on benchmark data CORTEX_MODEL_DEPLOYMENT_STAGE_CHALLENGER = 3;// partial traffic coming to this CORTEX_MODEL_DEPLOYMENT_STAGE_PRODUCTION = 4;// full traffic coming to this } /***************************************** * * CortexApiSchema is define by SME * *****************************************/ message CortexApi { Token api_id = 1; // /healthcare/patient/heart/risk-prediction --> 1 //Todo CortexApiSchema api_schema = 2; } /* CortexApiSchema is define by SME */ message CortexApiSchema { // Allow search, browse, storage directory, string-key creation etc. based on… CortexApiType api_type = 1; RecordKeySchema record = 2; // `entity/healthcare/patients`, cell X customer CortexApiInputSchema input_schema = 3 ; CortexApiOutputSchema output_schema = 4 ; } enum CortexApiType { CORTEX_API_TYPE_CLASSIFICATION = 0; CORTEX_API_TYPE_CLASSIFICATION_BINARY = 1; CORTEX_API_TYPE_CLASSIFICATION_MULTIVARIATE = 2; CORTEX_API_TYPE_REGRESSION = 3; } /* CortexRecordKeySchema list the record type on which CortexAPI will work */ message RecordKeySchema { TelOsEntityStoreSchema entity = 1; // cell X customer // key = mid(/m/<vertical>/<domain>/<event>/<context>) - // do we need event in definition map<string, TelOsEventContextSchema> context = 2; } message CortexApiInputSchema { CortexApiInputType input_type = 1; oneof input_schema { CortexApiMultivariateInputSchema multivariate_input_schema = 2; // add others based on CortexApiInputType } } message CortexApiMultivariateInputSchema { repeated Token input = 1; // it can be a raw features, attribute and inference // ex. /healthcare/patient/attribute/age, /healthcare/patient/feature/sugar_level /healthcare/patient/inference/is_diabetic // token to key, key to token } message CortexApiOutputSchema { CortexApiOutputType output_type = 1; oneof output_schema { // CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_BINARY CortexApiOutputBinaryClassificationSchema binary_classification_schema = 2; //CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_MULTI_CLASS CortexApiOutputMultiClassClassificationSchema multiclass_classification_schema = 3; // CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_MULTI_LABEL // CORTEX_API_OUTPUT_TYPE_REGRESSION, CORTEX_API_OUTPUT_TYPE_REGRESSION_MSE, CORTEX_API_OUTPUT_TYPE_REGRESSION_SSE, CORTEX_API_OUTPUT_TYPE_REGRESSION_R2 // CortexRegressionSchema regression_schema = 4; // TODO - add other type of output type schema based on each CortexApiInputType } } /* "BrainQuantitySymbolicSchema", "BrainQuantitySchema" ==> /common/quantity/numeric/probability */ message CortexApiOutputBinaryClassificationSchema { //TODO How to save only positive class value DistributionQuantitySchema class_probability = 1; // set of class labels possible // /common/quantity/numeric/probability 0-1 // Distribution // /common/quantity/symbolic/heart_risk_class [YES, NO, UNKNOWN] } message CortexApiOutputMultiClassClassificationSchema { DistributionQuantitySchema class_probability = 1; // set of class labels possible // /common/quantity/numeric/probability 0-1 // Distribution // /common/quantity/symbolic/heart_risk_class [YES, NO, UNKNOWN] } //message RegressionSchema { // string predicted_variable = 2; // target_variable // QuantityNumericSchema regression_value_schema = 1; // /common/quantity/numeric/score //} // TODO: Include all the input types enum CortexApiInputType { CORTEX_API_INPUT_TYPE_MULTIVARIATE = 0; CORTEX_API_INPUT_TYPE_TIME_SERIES = 1; CORTEX_API_INPUT_TYPE_TEXT_TWEET = 2; CORTEX_API_INPUT_TYPE_TEXT_NEWS = 3; CORTEX_API_INPUT_TYPE_IMAGE_NORMAL = 4; CORTEX_API_INPUT_TYPE_IMAGE_XRAY_CHEST_FRONT = 5; CORTEX_API_INPUT_TYPE_FACE = 6; CORTEX_API_INPUT_TYPE_REMOTE_SENSING_HYPER_SPECTRAL = 7; CORTEX_API_INPUT_TYPE_VIDEO_NORMAL = 8; CORTEX_API_INPUT_TYPE_VIDEO_THERMAL = 9; } // TODO: Include all the output types enum CortexApiOutputType { CORTEX_API_OUTPUT_TYPE_PROJECTION_PCA = 0; CORTEX_API_OUTPUT_TYPE_PROJECTION_FISHER = 1; CORTEX_API_OUTPUT_TYPE_PROJECTION_MDS = 3; CORTEX_API_OUTPUT_TYPE_PROJECTION_SOM = 4; CORTEX_API_OUTPUT_TYPE_CLUSTERING_PARTITION = 5; CORTEX_API_OUTPUT_TYPE_CLUSTERING_SPECTRAL = 6; CORTEX_API_OUTPUT_TYPE_CLUSTERING_HIERARCHICAL = 7; CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_BINARY = 8; CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_MULTI_CLASS = 9; CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_MULTI_LABEL = 10; CORTEX_API_OUTPUT_TYPE_CLASSIFICATION_EXTREME = 11; CORTEX_API_OUTPUT_TYPE_RECOMMENDATION = 12; CORTEX_API_OUTPUT_TYPE_FORECASTING = 13; CORTEX_API_OUTPUT_TYPE_ANOMALY = 14; CORTEX_API_OUTPUT_TYPE_OPTIMIZATION = 15; CORTEX_API_OUTPUT_TYPE_REGRESSION = 16; CORTEX_API_OUTPUT_TYPE_REGRESSION_MSE = 17; CORTEX_API_OUTPUT_TYPE_REGRESSION_SSE = 18; CORTEX_API_OUTPUT_TYPE_REGRESSION_R2 = 19; } /** * *Artifact Proto,Validator Proto * **/ message CortexModelArtifactStoreRequest { ArtifactStoreType store_type = 1; string uri = 2; ArtifactTypeEnum.ArtifactType artifact_type = 3; } message CortexModelArtifactStoreResponse { string cloud_file_key = 1; string cloud_file_uri = 2; } enum ArtifactStoreType { ARTIFACT_STORE_TYPE_AZURE_BLOB_DEFAULT = 0; ARTIFACT_STORE_TYPE_AZURE_BLOB = 1; ARTIFACT_STORE_TYPE_S3 = 2; ARTIFACT_STORE_TYPE_GCS = 3; } message ArtifactTypeEnum{ enum ArtifactType { IMAGE = 0; MODEL = 1; TENSORBOARD = 2; DATA = 3; BLOB = 4; STRING = 5; CODE = 6; CONTAINER = 7; } } message CortexModelArtifactResponse { string artifact_store_key = 1; string artifact_store_path = 2; } /** * * Validator Proto **/ // Note: 50000 is the beginning of the range of proto extension values for //use by applications. extend google.protobuf.FieldOptions { // This annotation indicates that certain fields must be supplied for the // request to be carried // out successfully. // A request field may go from being required to optional over time, but a field may not // go from being optional to required, for backwards compatiblity reasons. // Request RPCs are validated automatically prior to processing for required fields, but // returned values are not validated in any way. optional bool validate_required = 50000; } enum ErrorCode { // // Internal, system-level error codes, which generally cannot be // resolved by the user, but // instead are due to service issues. // // Generic internal error occurred. INTERNAL_ERROR = 0; // An internal system could not be contacted due to a period of unavailability. TEMPORARILY_UNAVAILABLE = 1; // Indicates that an IOException has been internally thrown. IO_ERROR = 2; // The request is invalid. BAD_REQUEST = 3; } ``` ### Service Definitions #### ModelRepository Service * Save a Model * Rename a Model * Update a Model * Delete a Model * Get a Model * Search Models ```protobuf= /* * * ModelRepository Service */ service ModelRepositoryService { rpc saveModel (SaveModelRequest) returns (SaveModelResponse) {} rpc renameModel (RenameModelRequest) returns (RenameModelResponse) {} rpc updateModel (UpdateModelRequest) returns (UpdateModelResponse) {} rpc deleteModel (DeleteModelRequest) returns (DeleteModelResponse) {} rpc getModel (GetModelRequest) returns (GetModelResponse) {} rpc search(SearchModelRequest) returns (SearchModelResponse) {} } message SaveModelRequest { telos.cortex.common.CortexModel model_meta_data = 1; } message SaveModelResponse { telos.cortex.common.CortexModel model_meta_data = 1; //BrainStatus status = 2; ToDo } message RenameModelRequest { // Registered model unique name identifier. optional string name = 1; // If provided, updates the name for this ``registered_model``. optional string new_name = 2; } message RenameModelResponse { optional RegisteredModel registered_model = 1; } message UpdateModelRequest { // Registered model unique name identifier. optional string name = 1 ; // If provided, updates the description for this ``registered_model``. optional string description = 2; } message UpdateModelResponse { optional RegisteredModel registered_model = 1; } message DeleteModelRequest { // Registered model unique name identifier. optional string name = 1 ; optional string model_id =2; } message DeleteModelResponse { optional bool deleted =1; } message GetModelRequest { // Registered model unique name identifier. optional string name = 1 ; } message GetModelResponse { // Registered model unique name identifier. telos.cortex.common.CortexModelSchema cortex_model=1; } message SearchModelRequest { // String filter condition, like "name LIKE 'my-model-name'". // Interpreted in the backend automatically as "name LIKE '%my-model-name%'". // Single boolean condition, with string values wrapped in single quotes. optional string filter = 1; // Maximum number of registered models desired. Max threshold is 1000. optional int64 max_results = 2 ; // List of columns for ordering search results, which can include model name and last updated // timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default. // Tiebreaks are done by model name ASC. repeated string order_by = 3; // Pagination token to go to the next page based on a previous search query. optional string page_token = 4; } message SearchModelResponse { repeated telos.cortex.common.CortexModelSchema model_schema =1; // Registered Models that match the search criteria. repeated RegisteredModel registered_models = 2; // Pagination token to request next page of models for the same query. string next_page_token = 3; } message RegisteredModel { // Unique name for the model. string name = 1; int32 model_id =2; // Timestamp recorded when this ``registered_model`` was created. optional int64 creation_timestamp = 3; // Timestamp recorded when metadata for this ``registered_model`` was last updated. optional int64 last_updated_timestamp = 4; // User that created this ``registered_model`` // NOTE: this field is not currently returned. optional string user_id = 5; // Description of this ``registered_model``. optional string description = 6; optional string model_version = 7; } ``` #### ArtifactStoreService * storeArtifact * storeArtifactWithStream * getArtifact * deleteArtifact ```protobuf= /* * ArtifactStore Service and its entities.. */ service ArtifactStore { rpc storeArtifact(telos.cortex.common.CortexModelArtifactStoreRequest) returns (telos.cortex.common.CortexModelArtifactStoreResponse) {} rpc storeArtifactWithStream(ModelArtifactWithStreamRequest) returns (ModelArtifactWithStreamResponse) {} rpc getArtifact(GetArtifactRequest) returns (GetArtifactResponse) {} rpc deleteArtifact(DeleteArtifactRequest) returns (DeleteArtifactResponse) {} } message ModelArtifactWithStreamRequest { string key = 1; bytes client_file = 2; } message ModelArtifactWithStreamResponse { string cloud_file_key = 1; string cloud_file_path = 2; } message GetArtifactRequest { string key = 1; } message GetArtifactResponse { bytes contents = 1; } message DeleteArtifactRequest { string key = 1; } message DeleteArtifactResponse { bool status = 1; } // sentiment analsysis // classfication // multi class classficication // works on TEXT // tag : inputtype : text , sentiment // sklearn 1.0 // pickle 1.1 // svm // params beta = 1 // hyper_params gamma = auto // Sign // Feature = 1 // tweet, movie_desc // ClassficiationModelOutput // // // run = 1 // path = /sentiment/classification/multiclass/text/sklearn/1.0/pickle/1.1/svm/model_zzzzz.pkl // accur = 90 // f1= 0.8 // // generatingPath() { //} // Doubts //3. Model Ontolgy idea ``` #### CortexModelVersionService * createModelVersion * getLatestVersions * updateModelVersion * deleteModelVersion * searchModelVersions * getModelVersionDownloadUri ```protobuf= service CortexModelVersionService{ rpc createModelVersion (CreateModelVersionRequest) returns (CreateModelVersionResponse); rpc getLatestVersions (GetLatestVersionsRequest) returns (GetLatestVersionsResponse); rpc updateModelVersion (UpdateModelVersionRequest) returns (UpdateModelVersionResponse); rpc deleteModelVersion (DeleteModelVersionRequest) returns (DeleteModelVersionResponse); rpc searchModelVersions(SearchModelVersionsRequest)returns(SearchModelVersionsResponse); rpc getModelVersionDownloadUri (GetModelVersionDownloadUriRequest) returns (GetModelVersionDownloadUriResponse); } //Model Version Proto's message CreateModelVersionRequest { // Register model under this name optional string name = 1 [(telos.cortex.common.validate_required) = true]; // URI indicating the location of the model artifacts. optional string source = 2 [(telos.cortex.common.validate_required) = true]; // Additional metadata for model version. repeated CortexModelVersionTag tags = 3; // Optional description for model version. optional string description = 4; } message CreateModelVersionResponse { // Return new version number generated for this model in registry. optional CortexModelVersion model_version = 1; } message CortexModelVersion { // Unique name of the model optional string name = 1; // Model's version number. optional string version = 2; // Timestamp recorded when this ``model_version`` was created. optional int64 creation_timestamp = 3; // Timestamp recorded when metadata for this ``model_version`` was last updated. optional int64 last_updated_timestamp = 4; // User that created this ``model_version``. optional string user_id = 5; // Current stage for this ``model_version``. optional string current_stage = 6; // Description of this ``model_version``. optional string description = 7; // URI indicating the location of the source model artifacts, used when creating ``model_version`` optional string source = 8; // The run ID used when creating ``model_version``, if ``source`` was generated by an // experiment run stored optional string run_id = 9; // Current status of ``model_version`` optional telos.cortex.common.CortexModelStatus status = 10; // Details on current ``status``, if it is pending or failed. optional string status_message = 11; // Tags: Additional metadata key-value pairs for this ``model_version``. repeated CortexModelVersionTag tags = 12; } // Tag for a model version. message CortexModelVersionTag { // The tag key. optional string key = 1; // The tag value. optional string value = 2; } message GetLatestVersionsRequest { // Registered model unique name identifier. optional string name = 1 [(telos.cortex.common.validate_required) = true]; // List of stages. repeated string stages = 2; } message GetLatestVersionsResponse { // Latest version models for each requests stage. Only return models with current ``READY`` status. // If no ``stages`` provided, returns the latest version for each stage, including ``"None"``. repeated CortexModelVersion model_versions = 1; } message UpdateModelVersionRequest { // Name of the registered model optional string name = 1 [(telos.cortex.common.validate_required) = true]; // Model version number optional string version = 2 [(telos.cortex.common.validate_required) = true]; // If provided, updates the description for this ``registered_model``. optional string description = 3; } message UpdateModelVersionResponse { // Return new version number generated for this model in registry. optional CortexModelVersion model_version = 1; } message DeleteModelVersionRequest { // Name of the registered model optional string name = 1 [(telos.cortex.common.validate_required) = true]; // Model version number optional string version = 2 [(telos.cortex.common.validate_required) = true]; } message DeleteModelVersionResponse{ bool is_deleted = 1; } message SearchModelVersionsRequest { // String filter condition, like "name='my-model-name'". // Must be a single boolean condition, // with string values wrapped in single quotes. optional string filter = 1; // Maximum number of models desired. Max threshold is 200K. optional int64 max_results = 2 ; // List of columns to be ordered by including model name, version, stage with an // optional "DESC" or "ASC" annotation, where "ASC" is the default. // Tiebreaks are done by latest stage transition timestamp, // followed by name ASC, followed by // version DESC. repeated string order_by = 3; // Pagination token to go to next page based on previous search query. optional string page_token = 4; } message SearchModelVersionsResponse { // Models that match the search criteria repeated CortexModelVersion model_versions = 1; // Pagination token to request next page of models for the same search query. optional string next_page_token = 2; } message GetModelVersionDownloadUriRequest { // Name of the registered model optional string name = 1 [(telos.cortex.common.validate_required) = true]; // Model version number optional string version = 2 [(telos.cortex.common.validate_required) = true]; } message GetModelVersionDownloadUriResponse { // URI corresponding to where artifacts for this model version are stored. optional string artifact_uri = 1; } ``` #### ApiRepositoryService * saveApi * updateApi * deleteApi * searchApi * getApiDetails ```protobuf= service ApiRepositoryService{ rpc saveApi(SaveApiRequest) returns (SaveApiResponse); rpc updateApi (UpdateApiRequest) returns (UpdateApiResponse); rpc deleteApi (DeleteApiRequest) returns (DeleteApiResponse); rpc searchApi (SearchApiRequest) returns (SearchApiResponse); rpc getApiDetails (GetApiRequest) returns (GetApiResponse); } message SaveApiRequest { telos.cortex.common.CortexApi api_meta_data = 1; } message SaveApiResponse { telos.cortex.common.CortexApi api_meta_data = 1; int64 created_on = 2; // Timestamp recorded when this ``Api `` was Saved. int64 last_updated_on = 3; // Timestamp recorded when metadata for this ``Api `` was last updated. } message UpdateApiRequest { // Unique name for the model. telos.cortex.common.CortexApi cortexApi = 1; // Timestamp recorded when this ``api`` was created. optional int64 creation_timestamp = 3; // Timestamp recorded when metadata for this ``api`` was last updated. optional int64 last_updated_timestamp = 4; // User that created this ``registered_model`` // NOTE: this field is not currently returned. optional string user_id = 5; // Description of this ``registered_model``. optional string description = 6; } message UpdateApiResponse { bool is_updated = 1; int64 last_updated_on = 2; // Timestamp recorded when metadata for this ``Api `` was last updated. } message DeleteApiRequest{ Token api_id = 1; } message DeleteApiResponse{ bool is_deleted = 1; } message SearchApiRequest{ // String filter condition, like "name LIKE 'my-api-name'". // Interpreted in the backend automatically as "name LIKE '%my-api-name%'". // Single boolean condition, with string values wrapped in single quotes. optional string filter = 1; // Maximum number of registered models desired. Max threshold is 1000. optional int64 max_results = 2 ; // List of columns for ordering search results, which can include model name and last updated // timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default. // Tiebreaks are done by model name ASC. repeated string order_by = 3; // Pagination token to go to the next page based on a previous search query. optional string page_token = 4; } message SearchApiResponse{ // Registered Api that match the search criteria. repeated telos.cortex.common.CortexApi api_meta_data = 1; // Pagination token to request next page of api for the same query. string next_page_token = 2; } message GetApiRequest{ Token api_id = 1; } message GetApiResponse{ telos.cortex.common.CortexApi api_meta_data = 1; } ``` ### CortexModelRepositoryAPI #### SaveModel API |**Endpoint**|/api/v1/repository/models/save| | -: | :- | |**API Name**|**saveModel**| |**Description**|Registers a Model in the repository by saving its meta data.| |**Request**|SaveModelRequest| |**Response**|SaveModelResponse| |**Errors**|*Throws RESOURCE_ALREADY_EXISTS if a registered model with the given name exists.*| |**Http Method**|**POST**| ------ #### Rename Model API |**Endpoint**|/api/v1/repository/models/rename| | -: | :- | |**API Name**|**renameModel**| |**Description**|Renames a registered /saved Model in the repository| |**Request**|RenameModelRequest| |**Response**|RenameModelResponse| |**Errors**|*Throws RESOURCE_ALREADY_EXISTS if a registered model with the given name exists.*| |**Http Method**|**POST**| ------ #### Update Model API |**Endpoint**|/api/v1/repository/models/update| | -: | :- | |**API Name**|**updateModel**| |**Description**|Updates the metadata of a registered Model in the repository | |**Request**|UpdateModelRequest| |**Response**|UpdateModelResponse| |**Http Method**|**PATCH**| ------ #### Delete Model API |**Endpoint**|/api/v1/repository/models/delete| | -: | :- | |**API Name**|**deleteModel**| |**Description**|Delete a Model from the repository| |**Request**|DeleteModelRequest| |**Response**|DeleteModelResponse| |**Http Method**|**DELETE**| ------ #### Get Model API |**Endpoint**|/api/v1/repository/models/get| | -: | :- | |**API Name**|**getModel**| |**Description**|Gets a registered Model from the repository| |**Request**|GetModelRequest| |**Response**|GetModelResponse| |**Http Method**|**GET**| ------ #### Search a Model API |**Endpoint**|/api/v1/repository/models/search| | -: | :- | |**API Name**|**searchModel**| |**Description**|Search Models from the repository| |**Request**|SearchModelRequest| |**Response**|SearchModelResponse| |**Errors**|*Throws NOT_FOUND Message if a model with the given name doesn't exists.*| |**Http Method**|**GET**| ------ ### CortexModelVersion API #### CreateModelVersion API |**Endpoint**|/api/v1/repository/model/versions/create | -: | :- | |**API Name**|**createModelVersion**| |**Description**|Creates a Model version in the repository by saving its meta data.| |**Request**|CreateModelVersionRequest| |**Response**|CreateModelVersionResponse| |**Errors**|*Throws RESOURCE_ALREADY_EXISTS if a registered model version with the given version exists.*| |**Http Method**|**POST**| ------ #### GetLatestVersions Model API |**Endpoint**|/api/v1/repository/model/versions/get| | -: | :- | |**API Name**|**getLatestVersions**| |**Description**|Fetches the latest versions of a registered /saved Model in the repository| |**Request**|GetLatestVersionsRequest| |**Response**|GetLatestVersionsResponse| |**Errors**|*Throws RESOURCE_NOT_FOUND if a registered model with the given name does not exists.*| |**Http Method**|**GET**| ------ #### UpdateModelVersion API |**Endpoint**|/api/v1/repository/model/versions/update| | -: | :- | |**API Name**|**updateModelVersion**| |**Description**|Updates the version information of a registered Model in the repository | |**Request**|UpdateModelVersionRequest| |**Response**|UpdateModelVersionResponse| |**Http Method**|**PATCH**| ------ #### DeleteModelVersion API |**Endpoint**|/api/v1/repository/model/versions/delete| | -: | :- | |**API Name**|**deleteModelVersion**| |**Description**|Delete a ModelVersion from the repository| |**Request**|DeleteModelVersionRequest| |**Response**|DeleteModelVersionResponse| |**Http Method**|**DELETE**| ------ #### SearchModelVersions API |**Endpoint**|/api/v1/repository/model/versions/search| | -: | :- | |**API Name**|**searchModelVersions**| |**Description**|Search and display the specified model version from the repository| |**Request**|SearchModelVersionsRequest| |**Response**|SearchModelVersionsResponse| |**Errors**|*Throws NOT_FOUND Message if a modelversion doesn't exists.*| |**Http Method**|**GET**| ------ #### GetModelVersionDownloadUri API |**Endpoint**|/api/v1/repository/model/versions/download/uri| | -: | :- | |**API Name**|**getModelVersionDownloadUri**| |**Description**|Search Models from the repository| |**Request**|GetModelVersionDownloadUriRequest| |**Response**|GetModelVersionDownloadUriResponse| |**Errors**|*Throws NOT_FOUND Message if a modelversion doesn't exists.*| |**Http Method**|**GET**| ------ ### ArtifactRepositoryAPI #### StoreArtifact API |**Endpoint**|/api/v1/repository/models/artifact/store| | -: | :- | |**API Name**|**storeArtifact**| |**Description**|uploads a Model's artifact in the ArtifactStore .| |**Request**|CortexModelArtifactStoreRequest| |**Response**|CortexModelArtifactStoreResponse| |**Http Method**|**POST**| ------ #### StoreArtifactAsStream API |**Endpoint**|/api/v1/repository/models/artifact/store/withStream| | -: | :- | |**API Name**|**storeArtifactWithStream**| |**Description**|uploads a Model's artifact in the ArtifactStore in streaming fashion .| |**Request**|ModelArtifactWithStreamRequest| |**Response**|ModelArtifactWithStreamResponse| |**Http Method**|**POST**| ------ #### GetArtifact API |**Endpoint**|/api/v1/repository/models/artifact/get| | -: | :- | |**API Name**|**getArtifact**| |**Description**|Gets an existing artifact from the store | |**Request**|GetArtifactRequest| |**Response**|GetArtifactResponse| |**Http Method**|**GET**| ------ #### DeleteArtifact API |**Endpoint**|/api/v1/repository/models/artifact/delete| | -: | :- | |**API Name**|**deleteArtifact**| |**Description**|Delets an existing artifact from the artifact store . | |**Request**|DeleteArtifactRequest| |**Response**|DeleteArtifactResponse| |**Http Method**|**DELETE**| ------ ### ApiRepositoryService API #### SaveApi |**Endpoint**|/api/v1/repository/model/apis/save| | -: | :- | |**API Name**|**saveApi**| |**Description**|Saves the Apis metadata to the Model Repository .| |**Request**|SaveApiRequest| |**Response**|SaveApiResponse| |**Http Method**|**POST**| ------ #### UpdateApi |**Endpoint**|/api/v1/repository/model/apis/update| | -: | :- | |**API Name**|**updateApi**| |**Description**|Updates an existing onboarded api metadata| |**Request**|UpdateApiRequest| |**Response**|UpdateApiResponse| |**Http Method**|**POST**| ------ #### DeleteApi API |**Endpoint**|/api/v1/repository/model/apis/delete| | -: | :- | |**API Name**|**deleteApi**| |**Description**|Deletes an existing api metada from the repository | |**Request**|DeleteApiRequest| |**Response**|DeleteApiResponse| |**Http Method**|**DELETE**| ------ #### SearchApi |**Endpoint**|/api/v1/repository/model/apis/search| | -: | :- | |**API Name**|**searchApi**| |**Description**|Search for an existing onboarded api for its metadata information in the model repository. | |**Request**|SearchApiRequest| |**Response**|SearchApiResponse| |**Http Method**|**GET**| ------ #### GetApiDetails aPI |**Endpoint**|/api/v1/repository/model/apis/get| | -: | :- | |**API Name**|**getModelApi**| |**Description**|Search for an API from the repository| |**Request**|GetApiRequest| |**Response**|GetApiResponse| |**Errors**|*Throws NOT_FOUND Message if a API with the given id doesn't exists.*| |**Http Method**|**GET**| ------ //API Table - Each record is an API { "api_id" : "1" "domain_name" : "healthcare" "api_name" : "heart_attack_risk_prediction" "record_type" : "/entity/healthcare/patient" "input_type" : "multivariate" "model_type" : "classifier" "model_sub_type" : "binary_classifier" "output_type" : "class_probability" "current_model_id" : "abc" } // API to feature ID table // Feature to Transformation 1 >> f1, f2, f3, f4 f1 > t1 f2 > t2 //Feature Schema //Todo : Feature Transformation # Schema Service: [ "api_id" : "1", "model_id" : "abc" { "name": "/attribute/healthcare/patient/age", "description": "age of the patient" }, { "name": "/attribute/healthcare/patient/sex", "description": "gender of the patient" }, { "name": "/attribute/healthcare/patient/vessels", "description": "number of major vessels of the patient" }, { "name": "/feature/healthcare/patient/chestpaintype", "description": "chest pain type the patient having" }, { "name": "/feature/healthcare/patient/bloodpressure", "description": "Resting blood pressure of the patient" }, { "name": "/feature/healthcare/patient/cholestoral", "description": "cholestoral level of the patient" }, { "name": "/feature/healthcare/patient/fastingbloodsugar", "description": "fastign blood sugar of the patient" }, { "name": "/feature/healthcare/patient/electrocardiographic", "description": "resting electrocardiographic of the patient" }, { "name": "/feature/healthcare/patient/maxheartrate", "description": "maximum heart rate achieved of the patient" }, { "name": "/feature/healthcare/patient/oldheartpeak", "description": "previous heart peak of the patient" }, { "name": "/feature/healthcare/patient/slope", "description": "Slope of the patient" }, { "name": "/feature/healthcare/patient/thaliumstreerate", "description": "thalium stress result of the patient" }, { "name": "/feature/healthcare/patient/inducedangina", "description": "Exercise induced angina of the patient" }, ] --- ## Model Store Architechture ![](https://hackmd.io/_uploads/SkI2elxY2.png) ![](https://i.imgur.com/AQfrfdG.png) ## Model Ontology Service https://hackmd.io/EDVd4cxeRwWsROK1T2MMRg?view ## Model Definition ``` Model Ontology Knowledge Onboarding ``` ![](https://i.imgur.com/lOWXuz8.png) ![](https://i.imgur.com/YnsBUo3.png) ## Model Storage Repo interface with Cortex Model Deployment ### Proto Definitions ```protobuf= message ModelMetaData { uint32 apiId = 1;//ref to APISchema string model_name = 2; string model_version = 3; // Model's version number uint32 modelId = 4; unint32 provider_id = 5; //image creation ModelDepolymentUnit deploy =6; ModelSignature signature =7; int64 created_on = 8;// Timestamp recorded when this ``model_version`` was created.    int64 last_updated_on = 9; // Timestamp recorded when metadata for // this``model_version`` was last updated.    string provider_id = 10;// User that created this ``model_version``.   string model_type = 11; //e.g : logistic_regression } message ModelDepolymentUnit { ModelSource model_source = 1; //variantname(MODEL_FRAMEWORK_SKLEARN) & variantVersion(0.24.2) ModelSerializationFormat serz_details = 2; //lib(MODEL_SERIALIZATION_PICKLE) and version("4.0") ArtifactPath artifact_path = 3; ModelDependencies dependency = 4; } message ModelDependencies { string name = 1; string version = 2; } message ArtifactPath { //can be expanded later to support additional mechanisms string file_path = 1; } message ModelSource { ModelFramework model_framework = 1; // "scikit-learn" string framework_version = 2; //0.24.2 } enum ModelFramework { MODEL_FRAMEWORK_SKLEARN_DEFAULT = 0 MODEL_FRAMEWORK_SKLEARN = 1; MODEL_FRAMEWORK_TENSORFLOW = 2; MODEL_FRAMEWORK_PYTORCH = 3; MODEL_FRAMEWORK_MXNET = 4; MODEL_FRAMEWORK_CAFFE = 5; } message ModelSerializationFormat { ModelSerialization serialization_lib = 1; //pickle string serialization_lib_version = 2; //pickle 1.0 } enum ModelSerialization{ MODEL_SERIALIZATION_PICKLE_DEFAULT = 0; MODEL_SERIALIZATION_PICKLE = 1; MODEL_SERIALIZATION_JOBLIB = 2; MODEL_SERIALIZATION_H5 = 3; } //SUPERVISED_MODEL_DEFAULT=0; // UNSUPERVISED_MODEL=1 // REINFORCEMENT_MODEL=2; // REGRESSION_MODEL=3; // CLUSTERING_MODEL=4; // DIMENSIONALITY_MODEL=5; //message ModelType { // map<string,string> modelTypes = 1; //} { Feature Lake Mode Lake } >> Brain Lake >> [TraningPart of Cortex] >> Traning Config training data >> batch mode (training config) >> model comes out >> model repository [10% features, subset of feature] [model centric feature store] - model_id is linked with API_ID >> feature --> BrainExpress(Transformation) CortexInferencingEnginer - latest model INIT - BrainInferProcess Model Build Process >>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully