The MLflow Model Registry allows users to manage the full lifecycle of MLflow Models. It provides model lineage (which MLflow Experiment and Run produced the model), model versioning, stage transitions (for example from staging to production), and annotations. Users can use the MLflow Client API to interact with the Model Registry programmatically.
To move a model version from one stage to another, users can use the transition_model_version_stage method of the MLflow Client. This method takes the following parameters:
name: The name of the registered model.
version: The version number of the model.
stage: The name of the stage to transition the model version to.
archive_existing_versions: (Optional) If True, archive all other model versions in the same stage.
Therefore, to move the model version model_version for the model model from the Staging stage to the Production stage, and archive any existing model versions in the Production stage, the correct code block is:
PythonAI-generated code. Review and use carefully. More info on FAQ.
client.transition_model_version_stage(
name=model,
version=model_version,
stage="Production",
archive_existing_versions=True
)
References:
[MLflow Model Registry - Databricks]
[MLflow Client API - Databricks]
[MLflow Model Registry API - Databricks] Message has links.