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.

Feedback

The MLOPs Python client is currently in Beta. We welcome feedback and feature requests either in this repository's issue tracker or on our feedback issue

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.3.tar.gz (10.4 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.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitlab_mlops-0.2.3.tar.gz
  • Upload date:
  • Size: 10.4 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.3.tar.gz
Algorithm Hash digest
SHA256 7385a66a08b1beee13a6f3e11f6a7079ef10f1db0b5c69bd1340ba37447a2c0d
MD5 267f3721b254f4f80de3bba29f1fe0aa
BLAKE2b-256 1abcdcee35148cc036de0297d2e5f8463d634a3dcb14ac123e883e4aa3a18579

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gitlab_mlops-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4285338263d3b0ad21da3b844ae20f727d938ba0340a89d861981dba317afd00
MD5 88ff38bfc0ce1ef436aed0790236f7b6
BLAKE2b-256 ddfde37ad886f3a5588575f2ad677bcd614b889458d5bfdf4ae1937899a002c7

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