0
0
TensorFlowml~10 mins

Model versioning in TensorFlow - Interactive Code Practice

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

Complete the code to save the TensorFlow model with a version number.

TensorFlow
model.save('model_v[1]')
Drag options to blanks, or click blank then click option'
Asave
Bversion
Clatest
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string like 'version' instead of a number.
Using 'latest' which is not a version number.
2fill in blank
medium

Complete the code to load a specific version of the saved TensorFlow model.

TensorFlow
loaded_model = tf.keras.models.load_model('model_v[1]')
Drag options to blanks, or click blank then click option'
A1
Bversion
Csave
Dlatest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'latest' which is not a folder name.
Using 'version' which is not a valid folder.
3fill in blank
hard

Fix the error in the code to save the model with versioning correctly.

TensorFlow
model.save('model_v[1]')
Drag options to blanks, or click blank then click option'
A1.0
Bv1
C1
Dversion1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v1' which duplicates the 'v' in the folder name.
Using '1.0' which can cause confusion in folder naming.
4fill in blank
hard

Fill both blanks to create a dictionary that maps model versions to their file paths.

TensorFlow
model_paths = {'v1': 'model_v[1]', 'v2': 'model_v[2]'}
Drag options to blanks, or click blank then click option'
A1
B2
C3
Dlatest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'latest' as a folder name which is not versioned.
Mixing up the version numbers in the dictionary.
5fill in blank
hard

Fill all three blanks to load a model, make a prediction, and print the result.

TensorFlow
model = tf.keras.models.load_model('model_v[1]')
prediction = model.predict([2])
print('Prediction:', [3])
Drag options to blanks, or click blank then click option'
A1
Binput_data
Cprediction
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'data' instead of 'input_data' for prediction input.
Printing 'data' instead of the prediction result.