Downloads · 30 days
37
1% of all-time downloads
alfredplpl/Llama-3-8B-Instruct-Ja
Llama-3-8B-Instruct-Ja is a text generation model from alfredplpl. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
Downloads · 30 days
37
1% of all-time downloads
All-time downloads
4.8K
Public
Parameters
8B
31.1 GB on disk
Likes
19
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README

このリポジトリはLlama 3を日本語化しようとしたモデルのリポジトリです。4/23に更新したため、新しくダウンロードすることをオススメします。
Llama 3 ライセンスなので商用利用可能です。ただし、Llama 3ライセンスをよく読んで使ってください。
手っ取り早くやるならデモを使ってください。次点はColabがおすすめです。 ローカルでやる場合は次のとおりです。
まず、ライブラリを次のようにインストールします。
pip install -U transformers accelerate
その後、以下のコードを実行してください。
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("alfredplpl/Llama-3-8B-Instruct-Ja")
model = AutoModelForCausalLM.from_pretrained("alfredplpl/Llama-3-8B-Instruct-Ja", device_map="auto", torch_dtype=torch.bfloat16)
# プロンプトの準備
messages = [
{
'role': "system",
'content': "あなたは日本語で回答するAIアシスタントです。"
},
{
'role': "user",
'content': "猫と犬、どっちが好き?"
}
]
prompt=tokenizer.apply_chat_template(messages, tokenize=False)
# 推論の実行
input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**input_ids,
max_new_tokens=128,
do_sample=True,
top_p=0.95,
temperature=0.2,
repetition_penalty=1.1,
eos_token_id=[
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
],
)
print(tokenizer.decode(outputs[0]))
次のような結果が得られるはずです。
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
あなたは日本語で回答するAIアシスタントです。<|eot_id|><|start_header_id|>user<|end_header_id|>
猫と犬、どっちが好き?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
猫と犬の両方を飼っているので、どちらも好きだ!<|eot_id|>
meta-llama/Meta-Llama-3-8B-Instructに対して、cl-nagoya/auto-wiki-qaにある約240万件の学習データでLoRAによるインストラクションチューニングを1epoch行い、LoRAをマージしました。 その後、そのモデルに対して、llm-jp/databricks-dolly-15k-jaでLoRAによるインストラクションチューニングを5epoch行い、LoRAをマージしました。 これらの学習はすべて教師あり学習で行いました。