Skip to main content

No project description provided

Project description

GitLab MLOps Python Client

A Python client for integrating GitLab's MLOps features, specifically designed to leverage GitLab's experiment tracking and model registry capabilities. This client simplifies the management of machine learning workflows by combining MLflow's flexibility with GitLab's powerful MLOps tools.

Build Status Latest Release

Features

  • GitLab Experiment Tracking: Easily track machine learning experiments within GitLab.
  • Model Registry Integration: Register and manage models in GitLab's model registry.
  • Experiment Management: Create and manage experiments directly from the client.
  • Run Tracking: Initiate and monitor training runs with ease.
  • Model Lifecycle Management: Promote runs to model versions effortlessly.

Installation

Install the client using pip:

pip install gitlab-mlops

Alternatively, to install the latest version from the source, use Poetry:

# Clone the repository
git clone https://gitlab.com/gitlab-org/modelops/mlops/gitlab-mlops.git
cd gitlab-mlops

# Install dependencies
poetry install

Usage

Configuration

Configure the client using environment variables or initialization arguments.

Using Environment Variables:

export MLFLOW_TRACKING_URI="https://gitlab.com/api/v4/projects/<project_id>/mlflow"
export MLFLOW_TRACKING_TOKEN="your_access_token"
from gitlab_mlops import Client

client = Client()

Using Initialization Arguments:

from gitlab_mlops import Client

client = Client(
    tracking_uri="https://gitlab.com/api/v4/projects/<project_id>/mlflow",
    gitlab_token="your_access_token"
)

Create a New Experiment

from gitlab_mlops import Client

client = Client()
experiment = client.create_experiment("Experiment Name")

Create a New Run

from gitlab_mlops import Client

client = Client()
experiment = client.get_experiment(name="Experiment Name")
run = experiment.create_run()

Log Parameters, Metrics, and Model artifacts

from gitlab_mlops import Client

client = Client()

run = client.get_run(run_id="19e547d3-8de7-42c3-9575-fae1142dec69")

run.log_param(key="param_name", value="value")
run.log_metric(key="metric_name", value=0.95)
run.log_artifact(
    local_path="<path to the model file or directory>",
    artifact_path="<optional relative path to log the artifact(s) at>"
)

Create a New Model

from gitlab_mlops import Client

client = Client()
model = client.create_model(name="Model Name", description="Model Description")

Create a New Model Version

from gitlab_mlops import Client

client = Client()

model = client.get_model(name="Model Name")

model_version = model.create_version(description="New version", version="1.0.0")

model_version.log_param(key="param_name", value="value")
model_version.log_text("How to run this model [...]", "README.md")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitlab_mlops-0.2.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitlab_mlops-0.2.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file gitlab_mlops-0.2.1.tar.gz.

File metadata

  • Download URL: gitlab_mlops-0.2.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/5.15.154+

File hashes

Hashes for gitlab_mlops-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b80923fd44f1bc825b338d3675d99042bcf9850295ec430f1588a1a099abc1af
MD5 57de6525e5b37a419a4750067af28e12
BLAKE2b-256 8000556c9693917fe4c8c0d770c59732bfb87a28afed450054db50680760c61a

See more details on using hashes here.

File details

Details for the file gitlab_mlops-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: gitlab_mlops-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/5.15.154+

File hashes

Hashes for gitlab_mlops-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77d99be4ae7dd7a9c2be88febc805e39f47ee5968084dee2c6f8630bfa09e135
MD5 ce8ce86cd0bdff07b922ac6a207470e7
BLAKE2b-256 c4c061b48e02a74a9213abf070b421b130809016c8219d163f58d390642bcb26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page