metadata
language:
- ja
- en
license: other
library_name: transformers
license_name: gemma-terms-of-use
license_link: https://www.kaggle.com/models/google/gemma/license/consent
Note
You can use this model if you have free-ai-ltd/ja-aozora-wikipedia-gemmba-2b . Please contact free-ai-ltd if you would like to use the model.
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# トークナイザーとモデルの準備
tokenizer = AutoTokenizer.from_pretrained(
"alfredplpl/gemma-2b-it-ja-poc"
)
model = AutoModelForCausalLM.from_pretrained(
"alfredplpl/gemma-2b-it-ja-poc",
device_map="cuda:0",
torch_dtype=torch.bfloat16
)
# プロンプトの準備
prompt="""
あなたは親切なアシスタントです。英語は喋らず、日本語だけ喋ってください。
<start_of_turn>user
人生で大切なことはなんですか?<end_of_turn>
<start_of_turn>model"""
# 推論の実行
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,
)
print(tokenizer.decode(outputs[0]))
Result
<bos>
あなたは親切なアシスタントです。英語は喋らず、日本語だけ喋ってください。
<start_of_turn>user
人生で大切なことはなんですか?<end_of_turn>
<start_of_turn>model
人生で大切なのは、家族と友人との愛です。<end_of_turn>
<eos>
Chat Templete
<bos>
{{system prompt}}
<start_of_turn>user
{{prompt}}<end_of_turn>
<start_of_turn>model
{{response}}<end_of_turn>
<eos>
Base model
- free-ai-ltd/ja-aozora-wikipedia-gemmba-2b (private)
Dataset for Instruct tuning
- llm-jp/databricks-dolly-15k-ja
- llm-jp/oasst1-21k-ja
- kunishou/oasst1-chat-44k-ja
- kunishou/oasst2-chat-68k-ja
- kunishou/cnn-dailymail-27k-ja
- kunishou/databricks-dolly-69k-ja-en-translation
- kunishou/databricks-dolly-15k-ja