Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to load a pre-trained model for fine-tuning.
Prompt Engineering / GenAI
model = load_model('[1]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a model without prior training like 'random-model'.
✗ Incorrect
We start fine-tuning from a base-model that already learned general knowledge.
2fill in blank
mediumComplete the code to prepare domain-specific data for fine-tuning.
Prompt Engineering / GenAI
domain_data = load_data('[1]')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using general or unrelated data files for fine-tuning.
✗ Incorrect
Fine-tuning uses domain_corpus.txt to adapt the model to the specific domain.
3fill in blank
hardFix the error in the fine-tuning loop by completing the missing method call.
Prompt Engineering / GenAI
for batch in domain_data: loss = model.[1](batch) loss.backward()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' or 'evaluate' which are for inference, not training.
✗ Incorrect
The forward method computes the output and loss during training.
4fill in blank
hardFill both blanks to update the model parameters during fine-tuning.
Prompt Engineering / GenAI
optimizer.[1]() optimizer.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling 'backward' or 'forward' on optimizer which is incorrect.
✗ Incorrect
First, zero_grad() clears old gradients. Then, step() updates model weights.
5fill in blank
hardFill all three blanks to create a dictionary of fine-tuned model metrics.
Prompt Engineering / GenAI
metrics = {'loss': [1], 'accuracy': [2], 'epoch': [3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using model output instead of metric values.
✗ Incorrect
We store the current loss_value, acc_value, and current_epoch in the metrics dictionary.