feat(import): add MLFlow import support (kit import mlflow://)#1124
Open
akagami-harsh wants to merge 8 commits intokitops-ml:mainfrom
Open
feat(import): add MLFlow import support (kit import mlflow://)#1124akagami-harsh wants to merge 8 commits intokitops-ml:mainfrom
akagami-harsh wants to merge 8 commits intokitops-ml:mainfrom
Conversation
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Contributor
Author
|
tested on local setup:
(venv) harshvir@msi:~/kitops$ mlflow server --host 0.0.0.0 --port 5000
Backend store URI not provided. Using sqlite:///mlflow.db
Registry store URI not provided. Using backend store URI.
[MLflow] Security middleware enabled with default settings (localhost-only). To allow connections from other hosts, use --host 0.0.0.0 and configure --allowed-hosts and --cors-allowed-origins.
INFO: Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
INFO: Started parent process [82500]
2026/03/17 15:41:36 INFO mlflow.server.jobs.utils: Starting huey consumer for job function invoke_scorer
2026/03/17 15:41:36 INFO mlflow.server.jobs.utils: Starting huey consumer for job function run_online_trace_scorer
(venv) harshvir@msi:~/kitops$ python3 testrun.py
Run ID: 2de0dbba9b164eee9a6a27551afb6502
🏃 View run test-model at: http://localhost:5000/#/experiments/0/runs/2de0dbba9b164eee9a6a27551afb6502
🧪 View experiment at: http://localhost:5000/#/experiments/0
(venv) harshvir@msi:~/kitops$ ./kit import mlflow://runs/2de0dbba9b164eee9a6a27551afb6502 -t my-test-raw
:v1
Connecting to MLFlow tracking server http://localhost:5000
Found run "test-model" (experiment 0) — status FINISHED
Found 1 artifact file(s) for run 2de0dbba9b164eee9a6a27551afb6502
Downloading artifact model.pkl
Generated Kitfile:
manifestVersion: 1.0.0
package:
name: test-model
authors: [mlflow-exp0]
model:
name: model
path: model.pkl
Would you like to edit Kitfile before packing? (y/N):
Updated Kitfile with MLFlow provenance:
manifestVersion: 1.0.0
package:
name: test-model
version: "20260317082144"
description: Imported from MLFlow run 2de0dbba9b164eee9a6a27551afb6502 — (test-model) — tracking server http://localhost:5000
authors: [mlflow-exp0]
model:
name: model
path: model.pkl
parameters:
mlflow_provenance:
mlflow_end_time: "2026-03-17T08:21:44Z"
mlflow_experiment_id: "0"
mlflow_metrics:
accuracy: 0.95
mlflow_params:
learning_rate: "0.01"
mlflow_run_id: 2de0dbba9b164eee9a6a27551afb6502
mlflow_run_name: test-model
mlflow_run_status: FINISHED
mlflow_start_time: "2026-03-17T08:21:44Z"
mlflow_tracking_uri: http://localhost:5000
Packing model to my-test-raw:v1
Already saved model layer: sha256:81a20b25d26d08405a4cfb7e10862c400cb1792cff58d08b928c3a3428fbf77c
Saved configuration: sha256:d2437f172bf3eff84f8cbc29a14dd672e22cde50593bd139358f6be5f80943f3
Saved manifest to storage: sha256:771f1f22f20fcbdbe07a4604544d7d02bdebc72dd2f4f079aa80c19dfa8045df
Model is packed as my-test-raw:v1
(venv) harshvir@msi:~/kitops$ ./kit list
REPOSITORY TAG MAINTAINER NAME SIZE DIGEST
model v1 mlflow-exp0 test-model 2.0 KiB sha256:9a8d2e31045803d283e382895d9689dce663071b27e8ac7c4d9803e45cd15b54
my-test-model v5 mlflow-exp0 test-model 2.0 KiB sha256:9a8d2e31045803d283e382895d9689dce663071b27e8ac7c4d9803e45cd15b54
my-test-model <none> mlflow-exp0 test-model 2.0 KiB sha256:d72828c4ff7377e2eaf22ae030f3d5dd93a1b355ae87d9326f26d3f9deca1e48
my-test-model v1 mlflow-exp0 test-model 2.0 KiB sha256:e63c69003ab40166f64cf286610bfc57db1f83b71cdc18e845177073cacf18da
my-test-raw v1 mlflow-exp0 test-model 2.0 KiB sha256:771f1f22f20fcbdbe07a4604544d7d02bdebc72dd2f4f079aa80c19dfa8045df |
gorkem
requested changes
Mar 17, 2026
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Signed-off-by: Harshvir Potpose <hpotpose62@gmail.com>
Contributor
Author
|
@gorkem, Could you please take a look again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds MLFlow as an import source for
kit import, us to package MLFlow experiment runs as ModelKits in a single command. Supports three URI forms:mlflow://host/experiments/{id}/runs/{id},mlflow://experiments/{id}/runs/{id}, and the shortmlflow://runs/{id}. The tracking server is resolved from the URI host, theMLFLOW_TRACKING_URIenv var, or defaults tohttp://localhost:5000. Authentication is handled via--tokenflag orMLFLOW_TRACKING_TOKENenv var. OnlyFINISHEDruns can be importedRUNNING,FAILED, andKILLEDruns are rejected with a clear error. Artifacts are downloaded concurrently through the tracking server's artifact proxy, a Kitfile is auto-generated (or a user-provided one is used), and MLFlow provenance metadata (run ID, experiment ID, metrics, params, timestamps) is injected intomodel.parametersbefore packing.Resolves #1014
Linked issues
kit import mlflow://for experiment-to-ModelKit workflow #1014AI-Assisted Code