Downloads · 30 days
2
6% of all-time downloads
alfredplpl/gemma-2b-it-ja-poc-2
gemma-2b-it-ja-poc-2 is a machine learning model from alfredplpl. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as other.
Downloads · 30 days
2
6% of all-time downloads
All-time downloads
33
Public
Repo size
78.5 MB
Likes
2
Public
Click a slice to open those files.
.safetensors78.5 MB · 100%
From the Hugging Face model README
なんか日本語が話せる商用利用可能なAIです。 Google Colab
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
from peft import PeftModel
# トークナイザーとモデルの準備
tokenizer = AutoTokenizer.from_pretrained("alfredplpl/ja-aozora-wikipedia-gemmba-2b")
model = AutoModelForCausalLM.from_pretrained("alfredplpl/ja-aozora-wikipedia-gemmba-2b")
model = PeftModel.from_pretrained(model = model, model_id = "alfredplpl/gemma-2b-it-ja-poc-2")
# プロンプトの準備
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]))
<bos>
あなたは親切なアシスタントです。英語は喋らず、日本語だけ喋ってください。
<start_of_turn>user
人生で大切なことはなんですか?<end_of_turn>
<start_of_turn>model
人生で大切なのは、幸せになることです。<end_of_turn>
<eos>
<bos>
{{system prompt}}
<start_of_turn>user
{{prompt}}<end_of_turn>
<start_of_turn>model
{{response}}<end_of_turn>
<eos>