🚀 LLaMA-3.1-8B-Instruct-Uz
LLaMA-3.1-8B-Instruct-Uzモデルは、公開されているデータと合成データを用いて調整され、ウズベク語と英語の自然言語処理タスクをサポートします。翻訳、要約、対話システムなどのタスクで堅牢な性能を発揮します。
🚀 クイックスタート
LLaMA-3.1-8B-Instruct-Uzモデルは、transformers
ライブラリと元のllama
コードベースで使用できます。
✨ 主な機能
- ウズベク語と英語の自然言語処理タスクをサポート
- 機械翻訳、要約、対話システムなどのタスクで堅牢な性能を発揮
📦 インストール
transformers
を使用する場合は、以下のコマンドでインストールを更新してください。
pip install --upgrade transformers
💻 使用例
基本的な使用法
import transformers
import torch
model_id = "behbudiy/Llama-3.1-8B-Instruct-Uz"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "Berilgan gap bo'yicha hissiyot tahlilini bajaring."},
{"role": "user", "content": "Men bu filmni yaxshi ko'raman!"},
]
outputs = pipeline(
messages,
max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])
高度な使用法
詳細なレシピやローカルでの使用方法、torch.compile()
、アシスト生成、量子化などの情報は、huggingface-llama-recipes
を参照してください。
📚 ドキュメント
モデルの説明
LLaMA-3.1-8B-Instruct-Uzモデルは、公開されているデータと合成データを用いて調整され、元の知識を維持しながら能力を向上させています。このモデルは、機械翻訳、要約、対話システムなどのウズベク語の自然言語処理タスクをサポートするように設計されています。
📊 性能比較:
モデル名 |
BLEU Uz-En (One-shot) |
BLEU En-Uz (One-shot) |
COMET (Uz-En) |
COMET (Ez-Un) |
ウズベク語感情分析 |
ウズベク語ニュース分類 |
MMLU (英語) (5-shot) |
Llama-3.1 8B Instruct |
23.74 |
6.72 |
84.30 |
82.70 |
68.96 |
55.41 |
65.77 |
Llama-3.1 8B Instruct Uz |
27.42 |
11.58 |
85.63 |
86.53 |
82.42 |
60.84 |
62.78 |
Mistral 7B Instruct |
7.47 |
0.67 |
68.14 |
45.58 |
62.02 |
47.52 |
61.07 |
Mistral 7B Instruct Uz |
29.39 |
16.77 |
86.91 |
88.75 |
79.13 |
59.38 |
55.72 |
Mistral Nemo Instruct |
25.68 |
9.79 |
85.56 |
85.04 |
72.47 |
49.24 |
67.62 |
Mistral Nemo Instruct Uz |
30.49 |
15.52 |
87.04 |
88.01 |
82.05 |
58.2 |
67.36 |
Google Translate |
41.18 |
22.98 |
89.16 |
90.67 |
— |
— |
— |
結果から、ウズベク語向けに最適化されたモデルは、翻訳ベンチマーク(BLEUとCOMET)、ウズベク語の感情分析、ニュース分類で、ベースモデルを上回る性能を示しています。また、英語の複数のタスクで一般的な言語理解を測定するMMLUベンチマークでも、ファインチューニングされたモデルは大幅な性能低下を示さなかった。
評価方法の情報
翻訳タスクの評価には、FLORES+ Uz-En / En-Uzデータセットを使用し、開発セットとテストセットを統合して、Uz-EnとEn-Uzのサブセットごとにより大きな評価データを作成しました。
ウズベク語の感情分析では、risqaliyevds/uzbek-sentiment-analysisデータセットを使用し、GPT-4o APIを使用してバイナリラベル(0: ネガティブ、1: ポジティブ)を作成しました。
ウズベク語のニュース分類では、risqaliyevds/uzbek-zero-shot-classificationデータセットを使用し、以下のプロンプトを使用してニュースのカテゴリを予測するようにモデルに要求しました。
MMLUでは、以下のテンプレートを使用して5ショット評価を行い、精度を測定するためにモデルが生成した最初のトークンを抽出しました。
評価用のプロンプト例
翻訳評価用プロンプト
prompt = f'''You are a professional Uzbek-English translator. Your task is to accurately translate the given Uzbek text into English.
Instructions:
1. Translate the text from Uzbek to English.
2. Maintain the original meaning and tone.
3. Use appropriate English grammar and vocabulary.
4. If you encounter an ambiguous or unfamiliar word, provide the most likely translation based on context.
5. Output only the English translation, without any additional comments.
Example:
Uzbek: "Bugun ob-havo juda yaxshi, quyosh charaqlab turibdi."
English: "The weather is very nice today, the sun is shining brightly."
Now, please translate the following Uzbek text into English:
"{sentence}"
'''
ウズベク語感情分析用プロンプト
prompt = f'''Given the following text, determine the sentiment as either 'Positive' or 'Negative.' Respond with only the word 'Positive' or 'Negative' without any additional text or explanation.
Text: {text}"
'''
ウズベク語ニュース分類用プロンプト
prompt = f'''Classify the given Uzbek news article into one of the following categories. Provide only the category number as the answer.
Categories:
0 - Politics (Siyosat)
1 - Economy (Iqtisodiyot)
2 - Technology (Texnologiya)
3 - Sports (Sport)
4 - Culture (Madaniyat)
5 - Health (Salomatlik)
6 - Family and Society (Oila va Jamiyat)
7 - Education (Ta'lim)
8 - Ecology (Ekologiya)
9 - Foreign News (Xorijiy Yangiliklar)
Now classify this article:
"{text}"
Answer (number only):"
'''
MMLU評価用テンプレート
template = "The following are multiple choice questions (with answers) about [subject area].
[Example question 1]
A. text
B. text
C. text
D. text
Answer: [Correct answer letter]
.
.
.
[Example question 5]
A. text
B. text
C. text
D. text
Answer: [Correct answer letter]
Now, let's think step by step and then provide only the letter corresponding to the correct answer for the below question, without any additional explanation or comments.
[Actual MMLU test question]
A. text
B. text
C. text
D. text
Answer:"
🔧 技術詳細
- ライセンス: llama3.1
- サポート言語:
- ベースモデル: models/Meta-Llama-3.1-8B-Instruct
- ライブラリ名: transformers
- タグ:
- llama
- text-generation-inference
- summarization
- translation
- question-answering
- データセット:
- yahma/alpaca-cleaned
- behbudiy/alpaca-cleaned-uz
- behbudiy/translation-instruction
- 評価指標:
- パイプラインタグ: text-generation
📄 ライセンス
このモデルはllama3.1ライセンスの下で提供されています。
その他
詳細と例については、以下のベースモデルを参照してください。
https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct