File size: 1,965 Bytes
40c5fa5 3c73836 40c5fa5 783ab34 3c73836 40c5fa5 5ec50bc 43b4bfe a2d869c 5ec50bc a2d869c 43b4bfe 783ab34 f337c19 783ab34 f337c19 783ab34 f337c19 783ab34 f337c19 783ab34 a12a22c 783ab34 f337c19 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
---
library_name: transformers
license: gemma
language:
- en
base_model:
- google/gemma-2-9b
---
**Authors**: aolans
# Model Card for gemma-2-9b_q4
<!-- Provide a quick summary of what the model is/does. -->
本モデルは、[google/gemma-2-9b](https://huggingface.co/google/gemma-2-9b) をUnslothを使用して量子化しただけのモデルです。
Unsloth版の「[Unsloth/gemma-2-9b](https://huggingface.co/Unsloth/gemma-2-9b)」が適用されないよう
ローカルにオリジナル版 google/gemma-2-9b をダウンロードした後に加工しています。
追加学習のベースとして利用します。
## Model Information
詳細は本家ページをご参照ください ⇒ [google/gemma-2-9b](https://huggingface.co/google/gemma-2-9b)
### Usage
```sh
pip install unsloth
pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
```
```python
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](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|