CommencerCommencer gratuitement

Apprentissage par transfert avec apprentissage one-shot

L'apprentissage par transfert permet plusieurs approches, dont l'apprentissage one-shot, où un modèle est formé à partir d'un seul exemple qu'il a observé.

Configurez un exemple d'apprentissage one-shot pour le modèle.

Cet exercice fait partie du cours

Introduction aux LLM en Python

Afficher le cours

Instructions

  • Complétez l'exemple d'apprentissage one-shot en indiquant que l'exemple de révision est Positive.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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"])
Modifier et exécuter le code