Llama とは?

Llama 3 を使いこなす

Imtihan Ahmed

Machine Learning Engineer

講師の紹介

 

  • Imtihan Ahmed
  • 機械学習エンジニア
  • 経験6年
  • 大規模AI

  講師プロフィール写真

Llama 3 を使いこなす

Llama 3 とは?

 

  • 要約

スクリーンショット 2025-02-19 11.01.25.png

Llama 3 を使いこなす

Llama 3 とは?

 

  • 要約

 

  • データ分析

スクリーンショット 2025-02-19 11.01.16.png

Llama 3 を使いこなす

Llama 3 とは?

 

  • 要約

 

  • データ分析

 

  • コーディング支援

スクリーンショット 2025-02-19 11.01.07.png

Llama 3 を使いこなす

Llama 3 とは?

スクリーンショット 2025-02-19 11.32.24.png

Llama 3:

  • Meta によって開発
Llama 3 を使いこなす

Llama 3 とは?

スクリーンショット 2025-02-19 11.32.18.png

Llama 3:

  • Meta によって開発
  • テキスト生成
Llama 3 を使いこなす

Llama 3 とは?

スクリーンショット 2025-02-19 11.32.12.png

  • Meta によって開発
  • テキスト生成
  • 大規模データで学習
    • Wikipedia 約2000冊分に相当
  • オープンソース
Llama 3 を使いこなす

Llama 3 をローカルで動かす理由

  • 例: 産業オートメーション
    • Llama で保全ニーズを予測

3.jpg

1 https://ai.meta.com/blog/aitomatic-built-with-llama/
Llama 3 を使いこなす

Llama 3 をローカルで動かす理由

 

  • プライバシーとセキュリティ

スクリーンショット 2025-02-19 11.48.10.png

Llama 3 を使いこなす

Llama 3 をローカルで動かす理由

 

  • プライバシーとセキュリティ

 

  • コスト効率

スクリーンショット 2025-02-19 11.48.03.png

Llama 3 を使いこなす

Llama 3 をローカルで動かす理由

 

  • プライバシーとセキュリティ

 

  • コスト効率

 

  • カスタマイズ性

スクリーンショット 2025-02-19 11.47.54.png

Llama 3 を使いこなす

Llama をローカルで使う

  • Python があればローカルで利用可能

スクリーンショット 2025-02-19 11.54.07.png

  • llama-cpp-python ライブラリで使用
  • pip でインストール
pip install llama-cpp-python
Llama 3 を使いこなす

Llama に質問する

from llama_cpp import Llama

llm = Llama(model_path = "path/to/model.gguf")
output = llm("What are some ways to improve customer retention?")
  • Llama クラスをインポート
  • LLM を初期化
    • プロンプトを送り応答を取得
    • モデルは GGUF 形式
  • 質問を LLM に渡す
Llama 3 を使いこなす

Llama に質問する

 

  • モデルがプロンプトを受け取る
  • プロンプトを処理
  • 応答を返す

プロンプト処理の流れ

Llama 3 を使いこなす

出力の確認

  • 応答は辞書形式
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...'},
 ...]
}
Llama 3 を使いこなす

出力の確認

  • "choices"0 要素の "text" を取得
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...'
Llama 3 を使いこなす

Passons à la pratique !

Llama 3 を使いこなす

Preparing Video For Download...