Approches d'ajustement fin

Introduction aux LLM avec Python

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Ajustement fin

 

Cas d'usage en chimie pour l'ajustement fin des LLM

Introduction aux LLM avec Python

Ajustement fin complet

 

  • Tous les poids du modèle sont mis à jour
  • Coûteux en calcul

 

Ajustement fin complet

Introduction aux LLM avec Python

Ajustement fin partiel

 

  • Certaines couches sont figées
  • Seules les couches propres à la tâche sont mises à jour

 

Ajustement fin partiel

Introduction aux LLM avec Python

Apprentissage par transfert

 

  • Un modèle préentraîné est adapté à une tâche différente mais connexe
  • Met à profit les connaissances d'un domaine vers un domaine lié

Le paradigme de l'apprentissage par transfert

Introduction aux LLM avec Python

Apprentissage N-shot

  • Zero-shot learning : aucun exemple
  • One-shot learning : un exemple
  • Few-shot learning : quelques exemples
Introduction aux LLM avec Python

One-shot learning

from transformers import pipeline

generator = pipeline(task="sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")

input_text = """
Classify the sentiment of this sentence as either Positive or Negative.
Example:
Text: "I'm feeling great today!" Sentiment: Positive
Text: "The weather today is lovely." Sentiment:
"""

result = generator(input_text, max_length=100)
print(result[0]["label"])
POSITIVE
Introduction aux LLM avec Python

Passons à la pratique !

Introduction aux LLM avec Python

Preparing Video For Download...