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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitlab_mlops-0.2.2.tar.gz.
File metadata
- Download URL: gitlab_mlops-0.2.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/5.15.154+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fcd366d563662a27c5e9bb3eeffce10220d7eec702565c2709ee5c4506e8c31
|
|
| MD5 |
b381cad5d56b73033b559f29ded54f6c
|
|
| BLAKE2b-256 |
4f7d544a7985bec0cec93fbcb9aa61f5723cf5f137778f3b7c73dd17896e9776
|
File details
Details for the file gitlab_mlops-0.2.2-py3-none-any.whl.
File metadata
- Download URL: gitlab_mlops-0.2.2-py3-none-any.whl
- Upload date:
- Size: 13.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b73d852abc8d7cd60f7150811384527390bb297b98e840c2598016b46b865dc
|
|
| MD5 |
a2bbefafc0ae8477ffd737d2c10281c4
|
|
| BLAKE2b-256 |
43cb341071b7f03d2d17dbd7c587070c23cc3832afae3d879b1d2b17ffe95755
|