Downloads · 30 days
0
Norimasa/gemma-2-9b-it-jp-1209
gemma-2-9b-it-jp-1209 is a machine learning model from Norimasa. 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 transformers. The card lists the license as gemma.
- Developed by: Norimasa - License: gemma - Finetuned from model : google/gemma-2-9b This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
Downloads · 30 days
0
Access
Public
Updated Dec 25, 2024
Repo size
209 MB
Likes
0
Public
Click a slice to open those files.
.safetensors209 MB · 100%
From the Hugging Face model README
東大松尾岩澤研究室の講義で、最終課題として与えられた大言語モデルの改良を行ったもの。 gemma-2-9bをベースにしてmagpieデータでSFTを行った。
Python環境があること(例: Google ColabのT4で動作確認) Hugging Faceのアクセストークン (HF_TOKEN) が取得済みであること
%%capture
!pip install unsloth
!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
Hugging Faceのトークンを取得していることを確認してください。以下はGoogle Colabでuserdataを使う例です(実行環境に合わせて適宜変更してください)。
from google.colab import userdata
HF_TOKEN = userdata.get('HF_TOKEN')
# モデル名
model_name = "Norimasa/gemma-2-9b-it-jp-1209"
# モデルとトーカナイザーのロード
import os
max_seq_length = 2048
dtype = None
load_in_4bit = True
HF_TOKEN = os.environ.get("LLM_Write") # Replace "HF_TOKEN" with the actual environment variable name if different.
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_name,
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
token = HF_TOKEN,
)
FastLanguageModel.for_inference(model)
input_text = "新しい年にふさわしい詩"
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=200)
print(tokenizer.decode(outputs[0]))