Model Staging¶
Once a model is registered (we have a new version of it: 1, 2, 3...) we can transition it from development to production. This means that we can tell MLflow that we want to use a specific version of the model for production. This way we can keep developing new versions of the model and testing them, while the production version is still being used by the API.
🏷️ Select a specific version for production¶
In [2]:
Copied!
import mlflow
MODEL_NAME = "demo-linear-regression" # ❗ make sure this model exists
MODEL_VERSION = 1 # change this to the version of your model
MODEL_STAGE = "Production" # model will promote to this stage
# stage model
client = mlflow.MlflowClient()
info = client.transition_model_version_stage(
name=MODEL_NAME,
version=MODEL_VERSION,
stage=MODEL_STAGE
)
# check current stage
print(info.current_stage)
import mlflow
MODEL_NAME = "demo-linear-regression" # ❗ make sure this model exists
MODEL_VERSION = 1 # change this to the version of your model
MODEL_STAGE = "Production" # model will promote to this stage
# stage model
client = mlflow.MlflowClient()
info = client.transition_model_version_stage(
name=MODEL_NAME,
version=MODEL_VERSION,
stage=MODEL_STAGE
)
# check current stage
print(info.current_stage)
Production