0
0
TensorFlowml~10 mins

SavedModel format 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 a TensorFlow model in SavedModel format.

TensorFlow
model.save('[1]')
Drag options to blanks, or click blank then click option'
Asaved_model/my_model
Bmodel.h5
Ccheckpoint.ckpt
Dmodel.json
Attempts:
3 left
💡 Hint
Common Mistakes
Using a filename with .h5 extension which saves in HDF5 format, not SavedModel.
Using checkpoint or JSON filenames which are not for SavedModel format.
2fill in blank
medium

Complete the code to load a TensorFlow model saved in SavedModel format.

TensorFlow
loaded_model = tf.keras.models.[1]('saved_model/my_model')
Drag options to blanks, or click blank then click option'
Asave_weights
Bload_weights
Csave_model
Dload_model
Attempts:
3 left
💡 Hint
Common Mistakes
Using load_weights which only loads weights, not the full model.
Using save_model or save_weights which are for saving, not loading.
3fill in blank
hard

Fix the error in the code to save the model in SavedModel format.

TensorFlow
model.save('my_model[1]')
Drag options to blanks, or click blank then click option'
A.h5
B/
C.json
D.ckpt
Attempts:
3 left
💡 Hint
Common Mistakes
Adding file extensions which save in other formats.
Not specifying a folder path causes errors or saves in wrong format.
4fill in blank
hard

Fill both blanks to save a model and then load it back correctly.

TensorFlow
model.save('[1]')
loaded_model = tf.keras.models.[2]('[1]')
Drag options to blanks, or click blank then click option'
Asaved_model/my_model
Bload_model
Cload_weights
Dmodel.h5
Attempts:
3 left
💡 Hint
Common Mistakes
Using different paths for saving and loading.
Using load_weights instead of load_model for loading.
5fill in blank
hard

Fill all three blanks to save a model, load it, and evaluate it on test data.

TensorFlow
model.save('[1]')
loaded_model = tf.keras.models.[2]('[1]')
loss, accuracy = loaded_model.evaluate([3])
Drag options to blanks, or click blank then click option'
Asaved_model/my_model
Bload_model
Ctest_data
Dload_weights
Attempts:
3 left
💡 Hint
Common Mistakes
Using load_weights instead of load_model before evaluation.
Passing training data instead of test data to evaluate.