Skip to content

MLflow

The mlflow kind stores an MLflow model together with its flavor, configuration, input datasets, and signature metadata. Kind-specific fields are documented with the creation functions.

Create

Log

log_mlflow

Create and upload an MLflow model entity.

Parameters:

Name Type Description Default
project str

Project name.

required
name str

Entity name. If omitted, it is inferred from source.

None
source SourcesOrListOfSources

Local model source path or paths.

required
drop_existing bool

Whether to drop existing entity with the same name.

False
path str

Destination path. If omitted, it is generated.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
version str

Entity version.

None
framework str

Model framework.

None
algorithm str

Model algorithm.

None
parameters dict

Model parameters.

None
flavor str

MLflow model flavor.

None
model_config dict

MLflow model configuration.

None
input_datasets list[Dataset]

Datasets used as model inputs. Each dataset can include name, digest, profile, dataset_schema, source, and source_type.

None
signature Signature

MLflow model signature with inputs, outputs, and params.

None
**kwargs dict

Additional model specification parameters.

{}

Returns:

Type Description
ModelMlflow

Created MLflow model entity with uploaded files.

Examples:

Log an MLflow model from a local MLflow artifact directory:

import digitalhub as dh

model = dh.log_mlflow(
    project="my-project",
    name="fraud-detector",
    source="./mlruns/0/abc123/artifacts/model",
    flavor="sklearn",
)

Register

register_mlflow

Register an MLflow model entity for an existing source.

Parameters:

Name Type Description Default
project str

Project name.

required
source SourcesOrListOfSources

Path or URI of the existing model.

required
name str

Entity name. If omitted, it is inferred from source.

None
uuid str

Entity identifier.

None
version str

Entity version.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
embedded bool

Whether to embed the entity specification in the project specification.

False
extensions list[dict]

Entity extensions.

None
framework str

Model framework.

None
algorithm str

Model algorithm.

None
parameters dict

Model parameters.

None
flavor str

MLflow model flavor.

None
model_config dict

MLflow model configuration.

None
input_datasets list[Dataset]

Datasets used as model inputs. Each dataset can include name, digest, profile, dataset_schema, source, and source_type.

None
signature Signature

MLflow model signature with inputs, outputs, and params.

None
**kwargs dict

Additional model specification parameters.

{}

Returns:

Type Description
ModelMlflow

Registered MLflow model entity.

Examples:

Register an MLflow model that already exists in remote storage:

import digitalhub as dh

model = dh.register_mlflow(
    project="my-project",
    name="registered-fraud-detector",
    source="s3://my-bucket/models/fraud-detector",
    flavor="sklearn",
)

New

new_model

Create a new model entity in the backend.

Parameters:

Name Type Description Default
project str

Project name.

required
name str

Entity name.

required
kind str

Entity kind.

required
uuid str

Entity identifier.

None
version str

Entity version.

None
description str

Human-readable entity description.

None
labels list[str]

Entity labels.

None
embedded bool

Whether to embed the entity specification in the project specification.

False
path str

Entity path on the local file system or remote storage. It is also the destination path for uploads.

None
extensions list[dict]

Entity extensions.

None
**kwargs dict

Additional entity specification parameters.

{}

Returns:

Type Description
Model

Created model entity.

import digitalhub as dh

model = dh.new_model(
    project="my-project",
    name="fraud-detector",
    kind="mlflow",
    path="s3://my-bucket/models/fraud-detector",
    flavor="sklearn",
)

Retrieve and manage

Use the shared Model management reference to retrieve, update, or delete an MLflow Model.

See the ModelServe runtime and its MLflow serving action.