0
0
MLOpsdevops~10 mins

Promoting models between stages in MLOps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to promote a model to the 'Staging' stage using MLflow.

MLOps
mlflow_client.transition_model_version_stage(name='my_model', version=[1], stage='Staging')
Drag options to blanks, or click blank then click option'
A'production'
B'latest'
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using stage names instead of version number
Using strings like 'latest' instead of version number
2fill in blank
medium

Complete the code to check the current stage of a model version.

MLOps
model_version = mlflow_client.get_model_version(name='my_model', version=[1])
current_stage = model_version.[2]
Drag options to blanks, or click blank then click option'
A1
Bstage
Cstatus
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using attribute names instead of version number
Using stage names instead of version number
3fill in blank
hard

Fix the error in the code to promote a model version to 'Production' stage.

MLOps
mlflow_client.transition_model_version_stage(name='my_model', version=2, stage=[1])
Drag options to blanks, or click blank then click option'
A'Production'
B'staging'
C'production'
Dproduction
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'production'
Using unquoted stage names
4fill in blank
hard

Fill both blanks to create a dictionary mapping model versions to their stages.

MLOps
version_stage_map = {mv.version: mv.[1] for mv in mlflow_client.search_model_versions('name="my_model"') if mv.[2] != 'Archived'}
Drag options to blanks, or click blank then click option'
Astage
Bstatus
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' instead of 'stage'
Using 'version' instead of 'stage'
5fill in blank
hard

Fill all three blanks to promote all 'Staging' models to 'Production' stage.

MLOps
for mv in mlflow_client.search_model_versions('name="my_model"'):
    if mv.[1] == '[2]':
        mlflow_client.transition_model_version_stage(name='my_model', version=mv.[3], stage='Production')
Drag options to blanks, or click blank then click option'
Astage
BStaging
Cversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' instead of 'stage'
Using 'stage' as version
Using unquoted stage names