mantik.mlflow¶
Attributes¶
Functions¶
|
Get the currently active run, or None if no such run exists. |
|
A general function to call any given MLflow method. |
|
Not supported: only permitted via the Mantik platform. |
|
Not supported: only permitted via the Mantik platform. |
|
Not supported: only permitted via the Mantik platform. |
|
Delete a tag. |
|
End an active MLflow run. |
Get the MLflow local backend config run id environment variable. |
|
|
Get the MLflow tracking URI set as MLFLOW_TRACKING_URI. |
|
Attempts to initialize tracking to Mantik, emits warning if it fails. |
|
Log a local file or directory as an artifact of the currently |
|
Log all the contents of a local directory as artifacts of the run. |
|
Log a JSON/YAML-serializable object (e.g. dict) as an artifact. |
|
Log a figure as an artifact. |
|
Log an image as an artifact. |
|
Log a metric for the current run. |
|
Log a batch of metrics for the current run. |
|
Log a parameter (e.g. model hyperparameter) for the current run. |
|
Log a batch of params for the current run. |
|
Log text as an artifact. |
|
Create a new model version in the model registry. |
|
Log a tag for the current run. |
|
Log a batch of tags for the current run. |
|
Set the tracking server URI (MLFLOW_TRACKING_URI environment |
|
Start a new MLflow run or pick up the run specified as MLFLOW_RUN_ID, |
Module Contents¶
- mantik.mlflow.active_run() mlflow.ActiveRun | None [source]¶
Get the currently active run, or None if no such run exists.
- mantik.mlflow.call_method(method: Callable | str, *args, **kwargs) Any [source]¶
A general function to call any given MLflow method.
- Parameters:
method (Callable or str) –
MLflow method to invoke.
If str, only the method name is requried, e.g. for mlflow.log_param, method=”log_param” is required.
args – Passed to the MLflow method.
kwargs – Passed to the MLflow method.
Examples
With the mlflow method:
>>> import mantik.mlflow >>> import mlflow >>> mantik.mlflow.call_method(mlflow.log_param, key="<name>", value="<value>") # noqa: E501
or with a str:
>>> import mantik.mlflow as mlflow >>> mlflow.call_method("log_param", key="<name>", value="<value>") # noqa: E501
- Return type:
The returned instance of the MLflow method.
- mantik.mlflow.create_experiment(name: str, artifact_location: str | None = None, tags: Dict[str, Any] | None = None) None [source]¶
Not supported: only permitted via the Mantik platform.
- mantik.mlflow.delete_experiment(experiment_id: int) None [source]¶
Not supported: only permitted via the Mantik platform.
- mantik.mlflow.delete_run(run_id: str) None [source]¶
Not supported: only permitted via the Mantik platform.
- mantik.mlflow.end_run(status: str = mlflow.entities.RunStatus.to_string(mlflow.entities.RunStatus.FINISHED)) None [source]¶
End an active MLflow run.
- mantik.mlflow.get_local_backend_config_run_id_env_var() str [source]¶
Get the MLflow local backend config run id environment variable.
- mantik.mlflow.get_tracking_uri() str [source]¶
Get the MLflow tracking URI set as MLFLOW_TRACKING_URI.
- mantik.mlflow.init_tracking() mantik.tracking.environment.Environment [source]¶
Attempts to initialize tracking to Mantik, emits warning if it fails.
If successful, this sets the MLFLOW_TRACKING_TOKEN environment variable to the access token retrieved from the Mantik API.
- Returns:
Holds the access token for the Mantik and MLflow API.
- Return type:
- mantik.mlflow.log_artifact(local_path: str, artifact_path: str | None = None) None [source]¶
Log a local file or directory as an artifact of the currently active run.
- mantik.mlflow.log_artifacts(local_dir: str, artifact_path: str | None = None) None [source]¶
Log all the contents of a local directory as artifacts of the run.
- mantik.mlflow.log_dict(dictionary: Any, artifact_file: str) Any [source]¶
Log a JSON/YAML-serializable object (e.g. dict) as an artifact.
- mantik.mlflow.log_metric(key: str, value: float, step: int | None = None) None [source]¶
Log a metric for the current run.
- mantik.mlflow.log_metrics(metrics: Dict[str, float], step: int | None = None) None [source]¶
Log a batch of metrics for the current run.
- mantik.mlflow.log_param(key: str, value: Any) Any [source]¶
Log a parameter (e.g. model hyperparameter) for the current run.
- mantik.mlflow.log_params(params: Dict[str, Any]) None [source]¶
Log a batch of params for the current run.
- mantik.mlflow.register_model(model_uri, name, *, tags: Dict[str, Any] | None = None) mlflow.entities.model_registry.ModelVersion [source]¶
Create a new model version in the model registry.
- mantik.mlflow.set_tags(tags: Dict[str, Any]) None [source]¶
Log a batch of tags for the current run.
- mantik.mlflow.set_tracking_uri(uri: str | pathlib.Path) None [source]¶
Set the tracking server URI (MLFLOW_TRACKING_URI environment variable).
- mantik.mlflow.start_run(run_id: str = None, experiment_id: str | None = None, run_name: str | None = None, nested: bool = False, tags: Dict[str, Any] | None = None, description: str | None = None) mlflow.ActiveRun [source]¶
Start a new MLflow run or pick up the run specified as MLFLOW_RUN_ID, which is set by the Mantik Compute Backend when submitting a run.