Downloads · 30 days
15
22% of all-time downloads
aolans/gemma-2-9b_q4
gemma-2-9b_q4 is a text generation model from aolans. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
Downloads · 30 days
15
22% of all-time downloads
All-time downloads
67
Public
Parameters
9.2B
25 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors25 GB · 100%
From the Hugging Face model README
Authors: aolans
本モデルは、google/gemma-2-9b をUnslothを使用して量子化しただけのモデルです。
Unsloth版の「Unsloth/gemma-2-9b」が適用されないよう
ローカルにオリジナル版 google/gemma-2-9b をダウンロードした後に加工しています。
追加学習のベースとして利用します。
詳細は本家ページをご参照ください ⇒ google/gemma-2-9b
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.