0
0
MLOpsdevops~10 mins

Hardware and framework version tracking 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 print the current GPU hardware version using the NVIDIA System Management Interface.

MLOps
import subprocess
result = subprocess.run(['nvidia-smi', '--query-gpu=hardware_version', '--format=csv,noheader'], capture_output=True, text=True)
print(result.[1])
Drag options to blanks, or click blank then click option'
Areturncode
Bstdout
Cstderr
Dargs
Attempts:
3 left
💡 Hint
Common Mistakes
Using stderr instead of stdout to get output.
2fill in blank
medium

Complete the code to get the installed TensorFlow version.

MLOps
import tensorflow as tf
print(tf.[1])
Drag options to blanks, or click blank then click option'
A__version__
Bversion
Cget_version
DVERSION
Attempts:
3 left
💡 Hint
Common Mistakes
Using version or get_version which do not exist.
3fill in blank
hard

Fix the error in the code to correctly log hardware and framework versions to a file.

MLOps
with open('version_log.txt', 'w') as f:
    f.write('GPU Version: ' + gpu_version + '\n')
    f.write('TensorFlow Version: ' + [1] + '\n')
Drag options to blanks, or click blank then click option'
Atf.__version__
Btf.version
Ctensorflow.version
Dtensorflow.__version__
Attempts:
3 left
💡 Hint
Common Mistakes
Using tf.version which is not a string.
4fill in blank
hard

Fill both blanks to create a dictionary that maps hardware and framework versions for tracking.

MLOps
version_info = {
    'gpu': [1],
    'framework': [2]
}
Drag options to blanks, or click blank then click option'
Agpu_version
Btf.__version__
C'unknown'
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Putting string literals instead of variables.
5fill in blank
hard

Fill all three blanks to write a function that returns hardware and framework versions as a dictionary.

MLOps
def get_versions():
    gpu = [1]
    framework = [2]
    return [3]
Drag options to blanks, or click blank then click option'
Agpu_version
Btf.__version__
C{'gpu': gpu, 'framework': framework}
Dversion_info
Attempts:
3 left
💡 Hint
Common Mistakes
Returning a variable that is not defined inside the function.