0
0
Prompt Engineering / GenAIml~10 mins

Pre-training and fine-tuning concept in Prompt Engineering / GenAI - Interactive Code Practice

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

Complete the code to load a pre-trained model.

Prompt Engineering / GenAI
model = load_model('[1]')
Drag options to blanks, or click blank then click option'
Arandom_weights
Bpretrained_weights
Cuntrained_model
Dempty_model
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing random or empty weights which means no prior learning.
2fill in blank
medium

Complete the code to fine-tune the model on new data.

Prompt Engineering / GenAI
model.train(new_data, epochs=[1])
Drag options to blanks, or click blank then click option'
A1000
B0
C-1
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero epochs means no training.
Using very large epochs may overfit the model.
3fill in blank
hard

Fix the error in the code to freeze pre-trained layers before fine-tuning.

Prompt Engineering / GenAI
for layer in model.layers:
    layer.[1] = False
Drag options to blanks, or click blank then click option'
Atrainable
Bfrozen
Clocked
Dfixed
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent properties like 'frozen' or 'locked'.
4fill in blank
hard

Fill both blanks to create a fine-tuning loop that updates only unfrozen layers.

Prompt Engineering / GenAI
for layer in model.layers:
    if layer.[1] == [2]:
        update(layer)
Drag options to blanks, or click blank then click option'
Atrainable
BTrue
CFalse
Dfrozen
Attempts:
3 left
💡 Hint
Common Mistakes
Checking for 'frozen' property which does not exist.
Using False instead of True to update layers.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that stores layer names and their trainable status.

Prompt Engineering / GenAI
layer_status = {layer.[1]: layer.[2] for layer in model.[3]
Drag options to blanks, or click blank then click option'
Aname
Btrainable
Clayers
Dweights
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'weights' instead of 'layers' to iterate.
Mixing up 'name' and 'trainable' properties.