Model Registry provides a single pane of glass for ML model developers to index and manage models, versions, and ML artifacts metadata. It fills a gap between model experimentation and production activities. It provides a central interface for all stakeholders in the MLOps lifecycle to collaborate on ML models.
Go to file
Dhiraj Bokde 659ec4e776
Refactor model registry openapi definition. (#66)
* Refactor openapi definition

* Add name query parameter for model_version url, fix Artifact oneOf definition

* Added sortOrder query param

* Fix allOf composites for BaseArtifactUpdate and ModelArtifactUpdate

* Add model-serving metadata resources, openapi-generator-cli, and generated model, server, and proxy cmd

* Fix allOf types for InferenceServiceCreate and InferenceServiceUpdate
2023-10-18 09:15:17 -07:00
.github Enhance GHA to check uncommitted changes (#63) 2023-10-15 22:09:01 -07:00
api Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
bin Fixes #35, refactor DB schema 2023-09-28 18:52:41 -07:00
cmd Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
config/metadata-library Fixed mock graphql schemas 2023-09-15 16:12:11 -07:00
internal Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
test/python Fix failing assertion in python test 2023-09-28 18:52:41 -07:00
.gitignore Removed generated gRPC go model in .gitignore 2023-09-20 14:30:59 -07:00
.openapi-generator-ignore Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
Dockerfile Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
LICENSE Initial commit 2023-09-15 12:55:39 -05:00
Makefile Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
README.md Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
go.mod Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
go.sum Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
gqlgen.yml Made pkg code private 2023-09-20 14:30:59 -07:00
main.go Fixes #37, add pprof support 2023-10-05 10:33:19 -07:00
openapitools.json Refactor model registry openapi definition. (#66) 2023-10-18 09:15:17 -07:00
tools.go Fixed metadata library properties parsing 2023-09-15 16:12:11 -07:00

README.md

Model Registry

build checks status

A go based server that implements a gRPC interface for ml_metadata library. It adds other features on top of the functionality offered by the gRPC interface.

Pre-requisites:

Building

Run the following command to build the server binary:

make build

The generated binary uses spf13 cmdline args. More information on using the server can be obtained by running the command:

./model-registry --help

OpenAPI Proxy Server

Starting the OpenAPI Proxy Server

Run the following command to start the OpenAPI proxy server:

make run/proxy &

The proxy service implements the OpenAPI defined in model-registry.yaml to create an Open Data Hub specific REST API that stores metadata in an ml-metadata CPP server.

Server

Creating/Migrating Server DB

The server uses a local SQLite DB file (metadata.sqlite.db by default), which can be configured using the -d cmdline option. The following command creates the DB:

./model-registry migrate

Loading metadata library

Run the following command to load a metadata library:

./model-registry migrate -m config/metadata-library

Note that currently no duplicate detection is done as the implementation is a WIP proof of concept. Running this command multiple times will create duplicate metadata types. To clear the DB simply delete the SQLite DB file metadata.sqlite.db.

Starting the Server

Run the following command to start the server:

make run/server &

Clients

Running Python ml-metadata test client

Before running the test client, install the required Python libraries (using a python venv, if using one) using the command:

pip install ml_metadata grpcio

Run the following command to run the ml-metadata Python test client:

make run/client

Running GraphQL Playground

This project includes support for a GraphiQL playground, which supports interactive query design. It can be reached by opening the following URL in a web browser:

http://localhost:8080/

Where, 8080 is the default port that the server listens on. This port can be changed with the -p option.

Clean

Run the following command to clean the server binary, generated gRPC and GraphQL models, etc.:

make clean

Docker Image

Building the Docker Image

The following command builds a docker image for the server with the tag `model-registry``:

docker build -t model-registry .

Note that the first build will be longer as it downloads the build tool dependencies. Subsequent builds will re-use the cached tools layer.

Creating/Migrating Server DB

The following command migrates or creates a DB for the server:

docker run -it --user <uid>:<gid> -v <host-path>:/var/db model-registry migrate -d /var/db/metadata.sqlite.db -m /config/metadata-library

Where, <uid> and <gid> are local user and group ids on the host machine to allow volume mapping for the DB files. And, <host-path> is the path on the local directory writable by the <uid>:<gid> user.

Running the Server

The following command starts the server:

docker run -d -p <hostname>:<port>:8080 --user <uid>:<gid> -v <host-path>:/var/db --name server model-registry serve -n 0.0.0.0 -d /var/db/metadata.sqlite.db

Where, <uid>, <gid>, and <host-path> are the same as in the migrate command above. And <hostname> and <port> are the local ip and port to use to expose the container's default 8080 listening port. The server listens on localhost by default, hence the -n 0.0.0.0 option allows the server port to be exposed.

Once the server has started, test clients and playground can be used as described in the above sections.