IniziaInizia gratis

Transfer learning con one-shot learning

Il transfer learning ha molti approcci; uno è il one-shot learning, in cui un modello viene addestrato usando un solo esempio già visto.

Imposta un esempio di one-shot learning per il modello.

Questo esercizio fa parte del corso

Introduzione agli LLM in Python

Visualizza il corso

Istruzioni dell'esercizio

  • Completa l'esempio di one-shot learning indicando che la recensione di esempio è Positive.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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"])
Modifica ed esegui il codice