Get startedGet started for free

Transfer learning with one-shot learning

Transfer learning has many approaches, one of them being one-shot learning, where a model is trained using one example it has seen.

Set up a one-shot learning example for the model.

This exercise is part of the course

Introduction to LLMs in Python

View Course

Exercise instructions

  • Complete the one-shot learning example by showing the sample review is Positive.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Include an example in the input ext
input_text = """
Text: "The dinner we had was great and the service too."
Classify the sentiment of this sentence as either positive or negative.
Example:
Text: "The food was delicious"
____
Text: "The dinner we had was great and the service too."
Sentiment:
"""

# Apply the example to the model
result = model(____, max_length=100)

print(result[0]["label"])
Edit and Run Code