Model Registry contribute
Model registry is the component in the MLOps lifecycle responsible for managing model versions. Beyond tracking just artifacts, it is responsible to track the metadata associated to each model, like:
- Performance
- Parameters
- Data lineage
Data topology
All entities belong to a project, and only users with access to the project can interact with the entities.
Ml::Model
- Holds general information about a model, like name and description.
- Each model as a default
Ml::Experiment
with the same name where candidates are logged to. - Has many
Ml::ModelVersion
.
Ml::ModelVersion
- Is a version of the model.
- Links to a
Packages::Package
with the same project, name, and version. - Version must use semantic versioning.
Ml::Experiment
- Collection of comparable
Ml::Candidates
.
Ml::Candidate
- A candidate to a model version.
- Can have many parameters (
Ml::CandidateParams
), which are usually configuration variables passed to the training code. - Can have many performance indicators (
Ml::CandidateMetrics
). - Can have many user defined metadata (
Ml::CandidateMetadata
).
MLflow compatibility layer
To make it easier for Data Scientists with GitLab Model registry, we provided a compatibility layer to MLflow client. We do not provide an MLflow instance with GitLab. Instead, GitLab itself acts as an instance of MLflow. This method stores data on the GitLab database, which improves user reliability and functionality. See the user documentation about the compatibility layer.
The compatibility layer is implemented by replicating the MLflow rest API
in lib/api/ml/mlflow
.
Some terms on MLflow are named differently in GitLab:
- An MLflow
Run
is a GitLabCandidate
. - An MLflow
Registered model
is a GitLabModel
.
Setting up for testing
To test the an script with MLflow with GitLab as the backend:
Install MLflow:
mkdir mlflow-compatibility cd mlflow-compatibility pip install mlflow jupyterlab
In the directory, create a Python file named
mlflow_test.py
with the following code:import mlflow import os from mlflow.tracking import MlflowClient os.environ["MLFLOW_TRACKING_TOKEN"]='<TOKEN>' os.environ["MLFLOW_TRACKING_URI"]='<your gitlab endpoint>/api/v4/projects/<your project id>/ml/mlflow' client = MlflowClient() client.create_experiment("My first experiment")
Run the script:
python mlflow_test.py
Go to the project
/-/ml/experiments
. An experiment should have been created.
You can edit the script to call the client methods we are trying to implement. See GitLab Model experiments example for a more complete example.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support