youjunhyeok commited on
Commit
615d113
1 Parent(s): 2abbbd0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +181 -194
README.md CHANGED
@@ -2,199 +2,186 @@
2
  library_name: transformers
3
  tags:
4
  - llama-factory
 
 
 
 
 
 
 
 
 
 
5
  ---
6
 
7
- # Model Card for Model ID
8
-
9
- <!-- Provide a quick summary of what the model is/does. -->
10
-
11
-
12
-
13
- ## Model Details
14
-
15
- ### Model Description
16
-
17
- <!-- Provide a longer summary of what this model is. -->
18
-
19
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
20
-
21
- - **Developed by:** [More Information Needed]
22
- - **Funded by [optional]:** [More Information Needed]
23
- - **Shared by [optional]:** [More Information Needed]
24
- - **Model type:** [More Information Needed]
25
- - **Language(s) (NLP):** [More Information Needed]
26
- - **License:** [More Information Needed]
27
- - **Finetuned from model [optional]:** [More Information Needed]
28
-
29
- ### Model Sources [optional]
30
-
31
- <!-- Provide the basic links for the model. -->
32
-
33
- - **Repository:** [More Information Needed]
34
- - **Paper [optional]:** [More Information Needed]
35
- - **Demo [optional]:** [More Information Needed]
36
-
37
- ## Uses
38
-
39
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
40
-
41
- ### Direct Use
42
-
43
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
44
-
45
- [More Information Needed]
46
-
47
- ### Downstream Use [optional]
48
-
49
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
50
-
51
- [More Information Needed]
52
-
53
- ### Out-of-Scope Use
54
-
55
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
56
-
57
- [More Information Needed]
58
-
59
- ## Bias, Risks, and Limitations
60
-
61
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
62
-
63
- [More Information Needed]
64
-
65
- ### Recommendations
66
-
67
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
68
-
69
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
70
-
71
- ## How to Get Started with the Model
72
-
73
- Use the code below to get started with the model.
74
-
75
- [More Information Needed]
76
-
77
- ## Training Details
78
-
79
- ### Training Data
80
-
81
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
82
-
83
- [More Information Needed]
84
-
85
- ### Training Procedure
86
-
87
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
88
-
89
- #### Preprocessing [optional]
90
-
91
- [More Information Needed]
92
-
93
-
94
- #### Training Hyperparameters
95
-
96
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
97
-
98
- #### Speeds, Sizes, Times [optional]
99
-
100
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
101
-
102
- [More Information Needed]
103
-
104
- ## Evaluation
105
-
106
- <!-- This section describes the evaluation protocols and provides the results. -->
107
-
108
- ### Testing Data, Factors & Metrics
109
-
110
- #### Testing Data
111
-
112
- <!-- This should link to a Dataset Card if possible. -->
113
-
114
- [More Information Needed]
115
-
116
- #### Factors
117
-
118
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
119
-
120
- [More Information Needed]
121
-
122
- #### Metrics
123
-
124
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
125
-
126
- [More Information Needed]
127
-
128
- ### Results
129
-
130
- [More Information Needed]
131
-
132
- #### Summary
133
-
134
-
135
-
136
- ## Model Examination [optional]
137
-
138
- <!-- Relevant interpretability work for the model goes here -->
139
-
140
- [More Information Needed]
141
-
142
- ## Environmental Impact
143
-
144
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
145
-
146
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
147
-
148
- - **Hardware Type:** [More Information Needed]
149
- - **Hours used:** [More Information Needed]
150
- - **Cloud Provider:** [More Information Needed]
151
- - **Compute Region:** [More Information Needed]
152
- - **Carbon Emitted:** [More Information Needed]
153
-
154
- ## Technical Specifications [optional]
155
-
156
- ### Model Architecture and Objective
157
-
158
- [More Information Needed]
159
-
160
- ### Compute Infrastructure
161
-
162
- [More Information Needed]
163
-
164
- #### Hardware
165
-
166
- [More Information Needed]
167
-
168
- #### Software
169
-
170
- [More Information Needed]
171
-
172
- ## Citation [optional]
173
-
174
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
175
-
176
- **BibTeX:**
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
+ ```