Authors: aolans
Model Card for gemma-2-9b_q4
本モデルは、google/gemma-2-9b をUnslothを使用して量子化しただけのモデルです。
Unsloth版の「Unsloth/gemma-2-9b」が適用されないよう
ローカルにオリジナル版 google/gemma-2-9b をダウンロードした後に加工しています。
追加学習のベースとして利用します。
Model Information
詳細は本家ページをご参照ください ⇒ google/gemma-2-9b
Usage
pip install unsloth
pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
from unsloth import FastLanguageModel
# unslothのFastLanguageModelで元のモデルをロード。
dtype = None # Noneにしておけば自動で設定
load_in_4bit = True # 今回は13Bモデルを扱うためTrue
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="aolans/gemma-2-9b_q4",
dtype=dtype,
load_in_4bit=load_in_4bit,
trust_remote_code=True,
)
# 推論するためにモデルのモードを変更
FastLanguageModel.for_inference(model)
input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))
This gemma2 model was trained 2x faster with Unsloth and Huggingface's TRL library.
- Downloads last month
- 4