Complete the code to approve a model version using MLflow.
client = mlflow.tracking.MlflowClient() client.[1](name="MyModel", version=1, stage="Production")
The transition_model_version_stage method moves a model version to a new stage like Production.
Complete the code to fetch approved model versions.
client = mlflow.tracking.MlflowClient() model_versions = client.search_model_versions("name = 'MyModel'") approved_versions = [mv for mv in model_versions if mv.[1] == 'Production']
The current_stage attribute shows the stage of the model version, like 'Production'.
Fix the error in the code to reject a model version by moving it to 'Archived' stage.
client = mlflow.tracking.MlflowClient() client.transition_model_version_stage(name="MyModel", version=2, stage=[1])
The stage name must be a string with quotes, and 'Archived' is the correct stage to reject a model.
Fill both blanks to create a dictionary of model versions with their stages for 'MyModel'.
client = mlflow.tracking.MlflowClient() model_versions = client.search_model_versions("name = 'MyModel'") version_stage_map = { [1]: mv.[2] for mv in model_versions }
Use mv.version as the key and mv.current_stage as the value to map versions to stages.
Fill all three blanks to filter and list model versions in 'Staging' stage.
client = mlflow.tracking.MlflowClient() model_versions = client.search_model_versions("name = 'MyModel'") staging_versions = [mv.[1] for mv in model_versions if mv.[2] == [3]]
Extract version for each model version where current_stage equals the string "Staging".