youjunhyeok
commited on
Commit
•
615d113
1
Parent(s):
2abbbd0
Update README.md
Browse files
README.md
CHANGED
@@ -2,199 +2,186 @@
|
|
2 |
library_name: transformers
|
3 |
tags:
|
4 |
- llama-factory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
##
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
[More Information Needed]
|
179 |
-
|
180 |
-
**APA:**
|
181 |
-
|
182 |
-
[More Information Needed]
|
183 |
-
|
184 |
-
## Glossary [optional]
|
185 |
-
|
186 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
187 |
-
|
188 |
-
[More Information Needed]
|
189 |
-
|
190 |
-
## More Information [optional]
|
191 |
-
|
192 |
-
[More Information Needed]
|
193 |
-
|
194 |
-
## Model Card Authors [optional]
|
195 |
-
|
196 |
-
[More Information Needed]
|
197 |
-
|
198 |
-
## Model Card Contact
|
199 |
-
|
200 |
-
[More Information Needed]
|
|
|
2 |
library_name: transformers
|
3 |
tags:
|
4 |
- llama-factory
|
5 |
+
license: other
|
6 |
+
datasets:
|
7 |
+
- jojo0217/korean_rlhf_dataset
|
8 |
+
- jojo0217/korean_safe_conversation
|
9 |
+
- HAERAE-HUB/qarv-instruct-ko
|
10 |
+
- HAERAE-HUB/Korean-Human-Judgements
|
11 |
+
- HAERAE-HUB/K2-Feedback
|
12 |
+
- changpt/ko-lima-vicuna
|
13 |
+
language:
|
14 |
+
- ko
|
15 |
---
|
16 |
|
17 |
+
## Model
|
18 |
+
- base model: [THUDM/glm-4v-9b](https://huggingface.co/THUDM/glm-4v-9b)
|
19 |
+
|
20 |
+
## Dataset
|
21 |
+
- [jojo0217/korean_rlhf_dataset](https://huggingface.co/datasets/jojo0217/korean_rlhf_dataset)
|
22 |
+
- [jojo0217/korean_safe_conversation](https://huggingface.co/datasets/jojo0217/korean_safe_conversation)
|
23 |
+
- [HAERAE-HUB/qarv-instruct-ko](https://huggingface.co/datasets/HAERAE-HUB/qarv-instruct-ko)
|
24 |
+
- [HAERAE-HUB/Korean-Human-Judgements](https://huggingface.co/datasets/HAERAE-HUB/Korean-Human-Judgements)
|
25 |
+
- [HAERAE-HUB/K2-Feedback](https://huggingface.co/datasets/HAERAE-HUB/K2-Feedback)
|
26 |
+
- [changpt/ko-lima-vicuna](https://huggingface.co/datasets/changpt/ko-lima-vicuna)
|
27 |
+
|
28 |
+
## Load Model
|
29 |
+
|
30 |
+
Use the following Python code to load the model:
|
31 |
+
|
32 |
+
```python3
|
33 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
34 |
+
|
35 |
+
path = 'youjunhyeok/glm4-9b-ko-v1'
|
36 |
+
|
37 |
+
model = AutoModelForCausalLM.from_pretrained(path, trust_remote_code=True)
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
|
39 |
+
model.to('cuda')
|
40 |
+
```
|
41 |
+
|
42 |
+
## Chat
|
43 |
+
|
44 |
+
```python3
|
45 |
+
def chat(message):
|
46 |
+
messages = [
|
47 |
+
{"role": "system", "content": "당신은 인공지능 어시스턴트입니다. 친절하고 정확한 답변을 해주세요."},
|
48 |
+
{"role": "user", "content": message},
|
49 |
+
]
|
50 |
+
|
51 |
+
input_ids = tokenizer.apply_chat_template(
|
52 |
+
messages,
|
53 |
+
add_generation_prompt=True,
|
54 |
+
tokenize=True,
|
55 |
+
return_tensors="pt"
|
56 |
+
).to(model.device)
|
57 |
+
|
58 |
+
|
59 |
+
terminators = [
|
60 |
+
tokenizer.eos_token_id,
|
61 |
+
]
|
62 |
+
|
63 |
+
outputs = model.generate(
|
64 |
+
input_ids,
|
65 |
+
max_new_tokens=512,
|
66 |
+
eos_token_id=terminators,
|
67 |
+
do_sample=True,
|
68 |
+
temperature=0.9,
|
69 |
+
top_p=0.95,
|
70 |
+
)
|
71 |
+
response = outputs[0][input_ids.shape[-1]:]
|
72 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
73 |
+
|
74 |
+
chat('3차 세계대전이 일어난다면 어떻게 될 지 상상해서 알려줘')
|
75 |
+
```
|
76 |
+
|
77 |
+
## Output
|
78 |
+
|
79 |
+
```
|
80 |
+
3차 세계대전은 역사적으로 상상하기 힘들고, 사실상 존재하지 않은 이야기입니다. 만약 이런 일이 일어나게 되었다면, 전 세계가 파괴되고 수많은 사람들이 죽을 것입니다. 전쟁은 승자가 없으며, 상황의 복잡성을 고려할 때 더욱 그렇습니다.
|
81 |
+
|
82 |
+
세계는 2차 세계대전에서 수많은 전쟁의 원인을 배워야 했고, 히틀러를 필두로 한 나치 독일이 유럽을 지배했던 과거의 절망을 겪었습니다. 이는 세계 2차 전쟁 이후 국제 평화를 유지하기 위한 많은 노력의 시작이었습니다. 이러한 노력의 일환으로, 유엔이 설립되었고, 국제 평화와 안보를 책임진다면, 3차 세계대전은 전례 없는 규모의 전쟁이 될 것입니다.
|
83 |
+
|
84 |
+
유엔과 같은 국제기구가 3차 세계대전을 막기 위해 노력할 것이고, 모든 나라가 평화로운 해결을 위해 협력할 것입니다. 역사적으로 전쟁은 절대적으로 없어지지 않았지만, 국제 협력과 연대가 가능하다고 믿습니다.
|
85 |
+
```
|
86 |
+
|
87 |
+
## BenchMark (KOR)
|
88 |
+
| Benchmark (macro_f1) | A | B | C | D |
|
89 |
+
|---------------------------|:----:|:----:|:----:|:----:|
|
90 |
+
| kobest_boolq (0-shot) | 78.1 | 33.5 | 38.2 | 34.1 |
|
91 |
+
| kobest_boolq (5-shot) | 85.0 | 68.8 | 83.8 | 93.1 |
|
92 |
+
| kobest_copa (0-shot) | 80.4 | 58.5 | 63.1 | 81.0 |
|
93 |
+
| kobest_copa (5-shot) | 84.0 | 61.7 | 69.1 | 91.0 |
|
94 |
+
| kobest_hellaswag (0-shot) | 51.7 | 43.2 | 42.1 | 55.1 |
|
95 |
+
| kobest_hellaswag (5-shot) | 51.7 | 45.3 | 44.2 | 55.2 |
|
96 |
+
| kobest_sentineg (0-shot) | 81.5 | 34.8 | 51.5 | 82.7 |
|
97 |
+
| kobest_sentineg (5-shot) | 97.7 | 85.8 | 94.7 | 91.4 |
|
98 |
+
|
99 |
+
## BenchMark (ENG)
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
###youjunhyeok/glm4-9b-ko-v1
|
104 |
+
|
105 |
+
| | acc,none | acc_stderr,none | acc_norm,none | acc_norm_stderr,none | alias |
|
106 |
+
|:--------------|-----------:|------------------:|----------------:|-----------------------:|:--------------|
|
107 |
+
| ko_truthfulqa | 0.29131 | 0.015906 | nan | nan | ko_truthfulqa |
|
108 |
+
| ko_hellaswag | 0.381398 | 0.00484737 | 0.486059 | 0.00498784 | ko_hellaswag |
|
109 |
+
| ko_common_gen | 0.856491 | 0.0089572 | 0.856491 | 0.0089572 | ko_common_gen |
|
110 |
+
| ko_arc_easy | 0.330205 | 0.0137431 | 0.392491 | 0.0142696 | ko_arc_easy |
|
111 |
+
| openbookqa | 0.352 | 0.02138 | 0.45 | 0.0222709 | openbookqa |
|
112 |
+
| hellaswag | 0.615515 | 0.00485479 | 0.801036 | 0.00398405 | hellaswag |
|
113 |
+
| boolq | 0.86422 | 0.00599132 | nan | nan | boolq |
|
114 |
+
| arc_easy | 0.824916 | 0.00779824 | 0.79335 | 0.00830841 | arc_easy |
|
115 |
+
| arc_challenge | 0.532423 | 0.0145806 | 0.551195 | 0.0145346 | arc_challenge |
|
116 |
+
|
117 |
+
| | 0 | 5 |
|
118 |
+
|:----------------------------|---------:|---------:|
|
119 |
+
| kobest_boolq (macro_f1) | 0.351189 | 0.905978 |
|
120 |
+
| kobest_copa (macro_f1) | 0.645113 | 0.67963 |
|
121 |
+
| kobest_hellaswag (macro_f1) | 0.454822 | 0.479868 |
|
122 |
+
| kobest_sentineg (macro_f1) | 0.599628 | 0.926861 |
|
123 |
+
|
124 |
+
###THUDM/glm-4-9b-chat
|
125 |
+
|
126 |
+
| | acc,none | acc_stderr,none | acc_norm,none | acc_norm_stderr,none | alias |
|
127 |
+
|:--------------|-----------:|------------------:|----------------:|-----------------------:|:--------------|
|
128 |
+
| ko_truthfulqa | 0.334149 | 0.0165125 | nan | nan | ko_truthfulqa |
|
129 |
+
| ko_hellaswag | 0.379805 | 0.00484346 | 0.475901 | 0.00498398 | ko_hellaswag |
|
130 |
+
| ko_common_gen | 0.816699 | 0.00988516 | 0.816699 | 0.00988516 | ko_common_gen |
|
131 |
+
| ko_arc_easy | 0.360068 | 0.0140275 | 0.406143 | 0.0143517 | ko_arc_easy |
|
132 |
+
| openbookqa | 0.354 | 0.0214076 | 0.468 | 0.0223372 | openbookqa |
|
133 |
+
| hellaswag | 0.618901 | 0.00484664 | 0.806413 | 0.00394301 | hellaswag |
|
134 |
+
| boolq | 0.868196 | 0.00591652 | nan | nan | boolq |
|
135 |
+
| arc_easy | 0.824074 | 0.00781297 | 0.800084 | 0.00820653 | arc_easy |
|
136 |
+
| arc_challenge | 0.551195 | 0.0145346 | 0.576792 | 0.014438 | arc_challenge |
|
137 |
+
|
138 |
+
| | 0 | 5 |
|
139 |
+
|:----------------------------|---------:|---------:|
|
140 |
+
| kobest_boolq (macro_f1) | 0.351527 | 0.696896 |
|
141 |
+
| kobest_copa (macro_f1) | 0.518982 | 0.5104 |
|
142 |
+
| kobest_hellaswag (macro_f1) | 0.37683 | 0.384024 |
|
143 |
+
| kobest_sentineg (macro_f1) | 0.375372 | 0.663805 |
|
144 |
+
|
145 |
+
## Llama_factory Train Config
|
146 |
+
{data_dir}, {dataset_name}, {output_dir} is variable
|
147 |
+
```
|
148 |
+
cutoff_len: 2048
|
149 |
+
dataset: rlhf_dataset,safe_conversation,qarv-instruct-ko,korean-human-judgements,k2-feedback,ko_lima_vicuna
|
150 |
+
dataset_dir: /home/work/dweax/train/dataset
|
151 |
+
ddp_timeout: 180000000
|
152 |
+
do_train: true
|
153 |
+
eval_steps: 100
|
154 |
+
eval_strategy: steps
|
155 |
+
finetuning_type: lora
|
156 |
+
flash_attn: auto
|
157 |
+
fp16: true
|
158 |
+
gradient_accumulation_steps: 4
|
159 |
+
include_num_input_tokens_seen: true
|
160 |
+
learning_rate: 5.0e-05
|
161 |
+
logging_steps: 5
|
162 |
+
lora_alpha: 16
|
163 |
+
lora_dropout: 0.05
|
164 |
+
lora_rank: 16
|
165 |
+
lora_target: all
|
166 |
+
loraplus_lr_ratio: 1
|
167 |
+
lr_scheduler_type: cosine
|
168 |
+
max_grad_norm: 1.0
|
169 |
+
max_samples: 20000
|
170 |
+
model_name_or_path: THUDM/glm-4-9b
|
171 |
+
num_train_epochs: 2.0
|
172 |
+
optim: adamw_torch
|
173 |
+
output_dir: saves/GLM-4-9B/lora/glm4-alpha-v1
|
174 |
+
packing: true
|
175 |
+
per_device_eval_batch_size: 4
|
176 |
+
per_device_train_batch_size: 4
|
177 |
+
plot_loss: true
|
178 |
+
preprocessing_num_workers: 16
|
179 |
+
quantization_bit: 4
|
180 |
+
report_to: all
|
181 |
+
save_steps: 100
|
182 |
+
stage: sft
|
183 |
+
template: glm4
|
184 |
+
val_size: 0.01
|
185 |
+
warmup_steps: 250
|
186 |
+
|
187 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|