stardust-coder
commited on
Commit
•
55fc1e4
1
Parent(s):
608d894
Upload model
Browse files- README.md +1 -77
- adapter_config.json +3 -3
- adapter_model.bin +1 -1
README.md
CHANGED
@@ -1,82 +1,6 @@
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
-
license: llama2
|
4 |
-
datasets:
|
5 |
-
- izumi-lab/llm-japanese-dataset
|
6 |
-
language:
|
7 |
-
- ja
|
8 |
-
pipeline_tag: text-generation
|
9 |
---
|
10 |
-
## AIgroup-CVM-utokyohospital/Llama-2-70b-chat-4bit-japanese
|
11 |
-
|
12 |
-
This model is Llama-2-Chat 70B fine-tuned with a part of the following Japanese dataset.
|
13 |
-
|
14 |
-
[https://huggingface.co/datasets/izumi-lab/llm-japanese-dataset](https://huggingface.co/datasets/izumi-lab/llm-japanese-dataset)
|
15 |
-
|
16 |
-
```
|
17 |
-
from datasets import load_dataset
|
18 |
-
dataset = load_dataset("izumi-lab/llm-japanese-dataset", revision="main")
|
19 |
-
```
|
20 |
-
|
21 |
-
- 1000 steps
|
22 |
-
- batch_size = 4
|
23 |
-
|
24 |
-
|
25 |
-
## Copyright Notice
|
26 |
-
|
27 |
-
This model is built on the copyright of Meta's LLaMA series.
|
28 |
-
|
29 |
-
Users of this model must also agree to Meta's license.
|
30 |
-
|
31 |
-
[https://ai.meta.com/llama/](https://ai.meta.com/llama/)
|
32 |
-
|
33 |
-
|
34 |
-
## How to use
|
35 |
-
|
36 |
-
```
|
37 |
-
import os
|
38 |
-
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3"
|
39 |
-
import torch
|
40 |
-
torch.cuda.empty_cache()
|
41 |
-
from peft import PeftModel
|
42 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, AutoConfig
|
43 |
-
|
44 |
-
#Load model
|
45 |
-
model_id = "meta-llama/Llama-2-70b-chat-hf"
|
46 |
-
bnb_config = BitsAndBytesConfig(
|
47 |
-
load_in_4bit=True,
|
48 |
-
bnb_4bit_use_double_quant=True,
|
49 |
-
bnb_4bit_quant_type="nf4",
|
50 |
-
bnb_4bit_compute_dtype=torch.bfloat16
|
51 |
-
)
|
52 |
-
config = AutoConfig.from_pretrained(model_id)
|
53 |
-
config.pretraining_tp = 1
|
54 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
55 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config,
|
56 |
-
device_map="auto")
|
57 |
-
|
58 |
-
#Load weights
|
59 |
-
peft_name = "AIgroup-CVM-utokyohospital/Llama-2-70b-chat-4bit-japanese"
|
60 |
-
model_peft = PeftModel.from_pretrained(
|
61 |
-
model,
|
62 |
-
peft_name,
|
63 |
-
device_map="auto"
|
64 |
-
)
|
65 |
-
model_peft.eval()
|
66 |
-
|
67 |
-
|
68 |
-
device = "cuda:0"
|
69 |
-
|
70 |
-
text = "### Human: 東京大学の住所は? ### Assistant: "
|
71 |
-
inputs = tokenizer(text, return_tensors="pt").to(device)
|
72 |
-
with torch.no_grad():
|
73 |
-
outputs = model.generate(**inputs, max_new_tokens=100)
|
74 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
75 |
-
|
76 |
-
### Human: 東京大学の住所は? ### Assistant: 東京大学の住所は、東京都文京区本郷7丁目3番1号です。
|
77 |
-
```
|
78 |
-
|
79 |
-
|
80 |
## Training procedure
|
81 |
|
82 |
|
@@ -93,4 +17,4 @@ The following `bitsandbytes` quantization config was used during training:
|
|
93 |
### Framework versions
|
94 |
|
95 |
|
96 |
-
- PEFT 0.4.0
|
|
|
1 |
---
|
2 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
## Training procedure
|
5 |
|
6 |
|
|
|
17 |
### Framework versions
|
18 |
|
19 |
|
20 |
+
- PEFT 0.4.0
|
adapter_config.json
CHANGED
@@ -14,13 +14,13 @@
|
|
14 |
"r": 64,
|
15 |
"revision": null,
|
16 |
"target_modules": [
|
|
|
17 |
"o_proj",
|
18 |
-
"up_proj",
|
19 |
"v_proj",
|
20 |
-
"q_proj",
|
21 |
"gate_proj",
|
|
|
22 |
"down_proj",
|
23 |
-
"
|
24 |
],
|
25 |
"task_type": "CAUSAL_LM"
|
26 |
}
|
|
|
14 |
"r": 64,
|
15 |
"revision": null,
|
16 |
"target_modules": [
|
17 |
+
"q_proj",
|
18 |
"o_proj",
|
|
|
19 |
"v_proj",
|
|
|
20 |
"gate_proj",
|
21 |
+
"k_proj",
|
22 |
"down_proj",
|
23 |
+
"up_proj"
|
24 |
],
|
25 |
"task_type": "CAUSAL_LM"
|
26 |
}
|
adapter_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 3313905157
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bec19307c7b9c4fab1b1a24910f91845ab3f837f2d0d59de53b346da1edd056f
|
3 |
size 3313905157
|