Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a smaller AI model for edge devices.
Prompt Engineering / GenAI
model = SmallModel(input_size=128, output_size=10, [1]=2)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing training parameters like epochs or batch size with model architecture.
✗ Incorrect
The 'layers' parameter defines how many layers the smaller model has, which is key for edge AI.
2fill in blank
mediumComplete the code to quantize the model for efficient edge deployment.
Prompt Engineering / GenAI
quantized_model = quantize(model, [1]='int8')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'format' or 'type' which are not the correct parameter names here.
✗ Incorrect
The 'precision' parameter specifies the number format, such as int8, to reduce model size.
3fill in blank
hardFix the error in the code to deploy the model on an edge device.
Prompt Engineering / GenAI
device = get_device('[1]') model.to(device)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gpu' or 'tpu' which are not commonly available on edge devices.
✗ Incorrect
Edge devices often use CPUs, so 'cpu' is the correct device string for deployment.
4fill in blank
hardFill both blanks to create a dictionary of model sizes and their latency on edge devices.
Prompt Engineering / GenAI
results = { [1]: [2] for [1], [2] in zip(sizes, latencies) } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural variable names as keys or values, which causes errors.
✗ Incorrect
The dictionary keys and values should be the singular 'size' and 'latency' from the zipped lists.
5fill in blank
hardFill all three blanks to filter models smaller than 10MB and with latency under 50ms.
Prompt Engineering / GenAI
filtered = { [1]: [2] for [1], [2] in models.items() if [3] < 10 and [2] < 50 } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up keys and values or using wrong variable names in the condition.
✗ Incorrect
Keys are size, values are latency, and size is used in the condition to filter models.