Qu’est-ce que Llama ?

Travailler avec Llama 3

Imtihan Ahmed

Machine Learning Engineer

Faites connaissance avec l’instructeur

 

  • Imtihan Ahmed
  • Ingénieur ML
  • 6 ans d’expérience
  • IA à l’échelle

  Photo de profil de l’instructeur

Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

 

  • Résumé de texte

Capture d’écran 2025-02-19 à 11.01.25.png

Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

 

  • Résumé de texte

 

  • Analyse de données

Capture d’écran 2025-02-19 à 11.01.16.png

Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

 

  • Résumé de texte

 

  • Analyse de données

 

  • Assistant de code

Capture d’écran 2025-02-19 à 11.01.07.png

Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

Capture d’écran 2025-02-19 à 11.32.24.png

Llama 3 :

  • Développé par Meta
Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

Capture d’écran 2025-02-19 à 11.32.18.png

Llama 3 :

  • Développé par Meta
  • Génération de texte
Travailler avec Llama 3

Qu’est-ce que Llama 3 ?

Capture d’écran 2025-02-19 à 11.32.12.png

  • Développé par Meta
  • Génération de texte
  • Entraîné sur un jeu de données massif
    • Équivalent à 2 000 Wikipédias
  • Open source
Travailler avec Llama 3

Pourquoi exécuter Llama 3 en local

  • Exemple : automatisation industrielle
    • Llama prédit les besoins de maintenance

3.jpg

1 https://ai.meta.com/blog/aitomatic-built-with-llama/
Travailler avec Llama 3

Pourquoi exécuter Llama 3 en local

 

  • Confidentialité et sécurité

Capture d’écran 2025-02-19 à 11.48.10.png

Travailler avec Llama 3

Pourquoi exécuter Llama 3 en local

 

  • Confidentialité et sécurité

 

  • Maîtrise des coûts

Capture d’écran 2025-02-19 à 11.48.03.png

Travailler avec Llama 3

Pourquoi exécuter Llama 3 en local

 

  • Confidentialité et sécurité

 

  • Maîtrise des coûts

 

  • Personnalisation

Capture d’écran 2025-02-19 à 11.47.54.png

Travailler avec Llama 3

Utiliser Llama en local

  • Disponible en local si Python est installé

Capture d’écran 2025-02-19 à 11.54.07.png

  • Utilisable via la bibliothèque llama-cpp-python
  • Exécuter pip install
pip install llama-cpp-python
Travailler avec Llama 3

Poser des questions à Llama

from llama_cpp import Llama

llm = Llama(model_path = "path/to/model.gguf")
output = llm("What are some ways to improve customer retention?")
  • Importer la classe Llama
  • Initialiser le LLM
    • Envoyer des prompts et recevoir des réponses
    • Modèle au format GGUF
  • Poser une question au LLM
Travailler avec Llama 3

Poser des questions à Llama

 

  • Le modèle reçoit le prompt
  • Traite le prompt
  • Renvoie une réponse

prompting.jpg

Travailler avec Llama 3

Décomposer la sortie

  • La réponse est un dictionnaire
output
{'id': 'cmpl-af88304f-97b0-49f5-ba20-db87f86c4068',
 'object': 'text_completion',
 'created': 1715222298,
 'model': './Llama3-gguf-unsloth.Q4_K_M.gguf',
 'choices': [{'text': 'Improving customer retention is crucial for any business, as 
 it leads to increased revenue, positive word-of-mouth, and cost savings...'},
 ...]
}
Travailler avec Llama 3

Décomposer la sortie

  • Accéder à "text" dans l’élément 0 de "choices"
output["choices"][0]["text"]
'Improving customer retention is crucial for any business, as 
 it leads to increased revenue, positive word-of-mouth, and cost savings. 
 Here are some effective ways to boost customer retention:
 1. Personalize the Customer Experience
 Tailor your interactions with customers based on their preferences, behaviors, and 
 purchase history. Use data and analytics to create personalized offers, 
 recommendations, and communications.
 2. Foster Strong Relationships
 Build strong, human connections with your customers. Train your...'
Travailler avec Llama 3

Passons à la pratique !

Travailler avec Llama 3

Preparing Video For Download...