youjunhyeok commited on
Commit
4fcff5d
1 Parent(s): e45d8af

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +147 -188
README.md CHANGED
@@ -2,199 +2,158 @@
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: apache-2.0
6
  ---
7
 
8
+ ## Model
9
+ - base model: [beomi/Llama-3-KoEn-8B-Instruct-preview](https://huggingface.co/beomi/Llama-3-KoEn-8B-Instruct-preview)
10
 
11
+ ## Dataset
12
+ - [youjunhyeok/llama3_train](https://huggingface.co/datasets/youjunhyeok/llama3_train)
13
 
14
+ ## Load Model
15
 
16
+ Use the following Python code to load the model:
17
 
18
+ ```python3
19
+ from transformers import AutoTokenizer, AutoModelForCausalLM
20
 
21
+ path = 'youjunhyeok/llama3-8b-ko-sft-v1'
22
 
23
+ model = AutoModelForCausalLM.from_pretrained(path)
24
+ tokenizer = AutoTokenizer.from_pretrained(path)
25
+ model.to('cuda')
26
+ ```
27
+
28
+ ## Chat
29
+
30
+ ```python3
31
+ def chat(message):
32
+ messages = [
33
+ {"role": "system", "content": "당신은 인공지능 어시스턴트입니다. 친절하고 정확한 답변을 해주세요."},
34
+ {"role": "user", "content": message},
35
+ ]
36
+
37
+ input_ids = tokenizer.apply_chat_template(
38
+ messages,
39
+ add_generation_prompt=True,
40
+ return_tensors="pt"
41
+ ).to(model.device)
42
+
43
+ terminators = [
44
+ tokenizer.eos_token_id,
45
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
46
+ ]
47
+
48
+ outputs = model.generate(
49
+ input_ids,
50
+ max_new_tokens=512,
51
+ eos_token_id=terminators,
52
+ do_sample=True,
53
+ temperature=0.9,
54
+ top_p=0.95,
55
+ )
56
+ response = outputs[0][input_ids.shape[-1]:]
57
+ print(tokenizer.decode(response, skip_special_tokens=True))
58
+
59
+ chat('ETL 파이프라인을 어떻게 구현해야할까?')
60
+ ```
61
+
62
+ ## Output
63
+
64
+ ```
65
+ ETL(데이터 추출, 변환 로드) 파이프라인을 구현하려면 먼저 데이터 소스, 목표, 중간 결과물과 같은 ETL 파이프라인의 각 단계에 대한 명확한 이해와 구현 계획이 필요합니다. 다음은 일반적인 ETL 파이프라인 구현 프로세스입니다:
66
+
67
+ 1. 데이터 소스 이해: ETL 파이프라인의 번째 단계는 데이터 소스를 결정하는 것입니다. ETL 파이프라인에 사용할 데이터 소스 유형을 식별하고 데이터 소스에서 추출할 데이터에 대한 구체적인 계획을 세웁니다.
68
+
69
+ 2. ETL 도구 선택: ETL을 구현하는 데 사용할 도구를 결정합니다. ETL 프로세스의 특정 요구 사항에 따라 다양한 도구를 사용할 수 있습니다. 인기 있는 도구로는 Oracle의 Informatica, Microsoft의 Power BI, 데이터웨어하우스 툴인 Talend 등이 있습니다.
70
+
71
+ 3. 추출 계획 수립: 데이터 소스에서 데이터를 추출할 계획을 세웁니다. 이 단계에서는 데이터 소스에서 필요로 하는 데이터 유형, 구조 및 형식을 파악합니다. 추출 프로세스에 대한 로드맵을 만들고, 데이터 변환 및 로드에 대한 필요성을 식별하는 것이 중요합니다.
72
+
73
+ 4. 변환 계획 수립: 데이터를 변환하기 위해 실행할 프로세스를 결정합니다. 데이터 포맷을 변환하고, 데이터 유형을 변환하며, 필요한 경우 데이터 값을 정규화하거나 결합합니다.
74
+
75
+ 5. 데이터 로드 계획 수립: 변환된 데이터를 데이터베이스나 기타 목적지에 로드할 계획을 세웁니다. 단계에서는 데이터베이스 디자인, 저장 프로시저 또는 파이프라인 구성을 결정합니다.
76
+
77
+ 6. ETL 파이프라인 구현: ETL 도구를 사용하여 ETL 파이프라인을 구현합니다. 소스, 변환, 로드 단계를 순서대로 처리하여 필요한 데이터 변환을 수행합니다.
78
+
79
+ 7. 데이터 품질 관리: ETL 파이프라인이 올바르게 작동하고 데이터 품질이 유지되도록 테스트하고 모니터링합니다. 데이터 오류 및 누락 항목을 검출하고 데이터 품질을 유지하기 위한 프로세스를 구현합니다.
80
+ ```
81
+
82
+ ## BenchMark (KOR)
83
+
84
+ ```
85
+ # alias
86
+ A = youjunhyeok/llama3-koen-8b-sft-v1
87
+ B = DavidAhn/Llama-3-8B-slerp-262k
88
+ C = meta-llama/Meta-Llama-3-8B
89
+ D = chihoonlee10/T3Q-ko-solar-dpo-v7.0 (24.05.24 ko 리더보드 1등)
90
+ ```
91
+
92
+ | Benchmark (macro_f1) | A | B | C | D |
93
+ |---------------------------|:----:|:----:|:----:|:----:|
94
+ | kobest_boolq (0-shot) | 78.1 | 33.5 | 38.2 | 34.1 |
95
+ | kobest_boolq (5-shot) | 85.0 | 68.8 | 83.8 | 93.1 |
96
+ | kobest_copa (0-shot) | 80.4 | 58.5 | 63.1 | 81.0 |
97
+ | kobest_copa (5-shot) | 84.0 | 61.7 | 69.1 | 91.0 |
98
+ | kobest_hellaswag (0-shot) | 51.7 | 43.2 | 42.1 | 55.1 |
99
+ | kobest_hellaswag (5-shot) | 51.7 | 45.3 | 44.2 | 55.2 |
100
+ | kobest_sentineg (0-shot) | 81.5 | 34.8 | 51.5 | 82.7 |
101
+ | kobest_sentineg (5-shot) | 97.7 | 85.8 | 94.7 | 91.4 |
102
+
103
+ ## BenchMark (ENG)
104
+
105
+ ```
106
+ # alias
107
+ A = youjunhyeok/llama3-koen-8b-sft-v1
108
+ B = DavidAhn/Llama-3-8B-slerp-262k
109
+ C = meta-llama/Meta-Llama-3-8B
110
+ ```
111
+
112
+ | | A | B | C |
113
+ |:--------------|------:|------:|------:|
114
+ | openbookqa | 0.310 | 0.312 | 0.338 |
115
+ | hellaswag | 0.544 | 0.587 | 0.576 |
116
+ | boolq | 0.807 | 0.832 | 0.831 |
117
+ | arc_easy | 0.753 | 0.808 | 0.815 |
118
+ | arc_challenge | 0.421 | 0.518 | 0.529 |
119
+
120
+ ## Llama_factory Train Config
121
+ {data_dir}, {dataset_name}, {output_dir} is variable
122
+ ```
123
+ cutoff_len: 1024
124
+ dataset: {dataset_name}
125
+ dataset_dir: {data_dir}
126
+ ddp_timeout: 180000000
127
+ do_train: true
128
+ eval_steps: 500
129
+ eval_strategy: steps
130
+ finetuning_type: lora
131
+ flash_attn: auto
132
+ fp16: true
133
+ gradient_accumulation_steps: 8
134
+ include_num_input_tokens_seen: true
135
+ learning_rate: 5.0e-05
136
+ logging_steps: 5
137
+ lora_alpha: 16
138
+ lora_dropout: 0.05
139
+ lora_rank: 16
140
+ lora_target: all
141
+ lr_scheduler_type: cosine
142
+ max_grad_norm: 1.0
143
+ max_samples: 300000
144
+ model_name_or_path: beomi/Llama-3-KoEn-8B-Instruct-preview
145
+ num_train_epochs: 1.0
146
+ optim: adamw_torch
147
+ output_dir: {output_dir}
148
+ packing: false
149
+ per_device_eval_batch_size: 16
150
+ per_device_train_batch_size: 16
151
+ plot_loss: true
152
+ preprocessing_num_workers: 16
153
+ report_to: all
154
+ save_steps: 1000
155
+ stage: sft
156
+ template: llama3
157
+ val_size: 0.01
158
+ warmup_steps: 1000
159
+ ```