Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a prompt that asks the model to summarize text.
Prompt Engineering / GenAI
prompt = "Summarize the following text: [1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'model' or 'tokenizer' instead of the actual text input.
Leaving the prompt incomplete without the text.
✗ Incorrect
The prompt should include the input text to be summarized.
2fill in blank
mediumComplete the code to load a pre-trained model for fine-tuning.
Prompt Engineering / GenAI
model = AutoModelForSequenceClassification.from_pretrained([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tokenizer' or other unrelated strings.
Not providing any model name.
✗ Incorrect
The model name or path is needed to load the pre-trained model.
3fill in blank
hardFix the error in the code to fine-tune the model on new data.
Prompt Engineering / GenAI
optimizer = AdamW(model.parameters(), lr=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer values like 5.
Passing learning rate as a string.
✗ Incorrect
Learning rate should be a small float like 0.001, not an integer or string.
4fill in blank
hardFill both blanks to create a prompt template and insert the user input.
Prompt Engineering / GenAI
template = "Answer the question: [1]" prompt = template.format([2]=user_question)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '{}' for placeholders but trying to use named format keys.
Using wrong placeholder syntax.
✗ Incorrect
The template uses named placeholders and the format keyword should match the placeholder name.
5fill in blank
hardFill all three blanks to prepare data for fine-tuning with labels.
Prompt Engineering / GenAI
dataset = [{'[1]': text, '[2]': label} for text, label in zip([3], labels)] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys like 'data' or 'labels' as keys.
Using 'data' instead of 'texts' for input list.
✗ Incorrect
The dictionary keys should be 'text' and 'label', and the list of texts is 'texts'.