Spaces:
Running
on
Zero
Running
on
Zero
update docs
Browse files
docs/model_registration_guide.md
CHANGED
@@ -32,39 +32,8 @@ tokenizer_config.jsonで正しくchat_templateが設定されている必要が
|
|
32 |
|
33 |
## 量子化サンプルコード
|
34 |
|
35 |
-
|
36 |
|
37 |
-
```
|
38 |
-
# python 3.10
|
39 |
-
pip install bitsandbytes==0.44.1
|
40 |
-
pip install accelerate==1.2.1
|
41 |
-
pip install transformers==4.50.0
|
42 |
-
pip install huggingface_hub[cli]
|
43 |
-
```
|
44 |
-
```
|
45 |
-
# アクセストークンを入力してログイン
|
46 |
-
huggingface-cli login
|
47 |
-
```
|
48 |
-
```python
|
49 |
-
import torch
|
50 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
51 |
-
|
52 |
-
model_id = "google/gemma-2-2b-it"
|
53 |
-
repo_id = "xxxxx/gemma-2-2b-it-bnb-4bit"
|
54 |
-
|
55 |
-
bnb_config = BitsAndBytesConfig(
|
56 |
-
load_in_4bit=True,
|
57 |
-
bnb_4bit_quant_type="nf4",
|
58 |
-
bnb_4bit_compute_dtype=torch.bfloat16
|
59 |
-
)
|
60 |
-
|
61 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
62 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map="auto")
|
63 |
-
|
64 |
-
tokenizer.push_to_hub(repo_id)
|
65 |
-
model.push_to_hub(repo_id)
|
66 |
-
|
67 |
-
```
|
68 |
量子化後のモデルIDは任意の名前が可能ですが、以下の形式を推奨します。
|
69 |
|
70 |
* BitsAndBytesの4bit量子化の場合
|
|
|
32 |
|
33 |
## 量子化サンプルコード
|
34 |
|
35 |
+
サンプルコードは[こちら](https://huggingface.co/fukugawa/gemma-2-9b-finetuned-bnb-4bit)
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
量子化後のモデルIDは任意の名前が可能ですが、以下の形式を推奨します。
|
38 |
|
39 |
* BitsAndBytesの4bit量子化の場合
|