Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags: []
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
@@ -12,190 +12,48 @@ tags: []
|
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
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 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- 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. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
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).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
200 |
-
|
201 |
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags: [summarization]
|
4 |
---
|
5 |
|
6 |
# Model Card for Model ID
|
|
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
+
Korean summarization finetune model based on gemma-7b-it model
|
16 |
+
|
17 |
+
- **Finetuned by:** [Kang Seok Ju]
|
18 |
+
|
19 |
+
### Inference Examples
|
20 |
+
|
21 |
+
from dataclasses import dataclass, field
|
22 |
+
from typing import Optional
|
23 |
+
|
24 |
+
import torch
|
25 |
+
|
26 |
+
from transformers import AutoTokenizer, HfArgumentParser, AutoModelForCausalLM, BitsAndBytesConfig, TrainingArguments
|
27 |
+
from datasets import load_dataset
|
28 |
+
from peft import LoraConfig
|
29 |
+
from trl import SFTTrainer
|
30 |
+
|
31 |
+
model_id = "brildev7/gemma-7b-it-finetune-summarization-ko"
|
32 |
+
quantization_config = BitsAndBytesConfig(
|
33 |
+
load_in_4bit=True,
|
34 |
+
bnb_4bit_compute_dtype=torch.float16,
|
35 |
+
bnb_4bit_quant_type="nf4"
|
36 |
+
)
|
37 |
+
|
38 |
+
model = AutoModelForCausalLM.from_pretrained(
|
39 |
+
model_id,
|
40 |
+
device_map={"":0},
|
41 |
+
quantization_config=quantization_config,
|
42 |
+
torch_dtype=torch.float32,
|
43 |
+
)
|
44 |
+
|
45 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
46 |
+
tokenizer.pad_token_id = tokenizer.eos_token_id
|
47 |
+
tokenizer.padding_side = 'right'
|
48 |
+
|
49 |
+
passage = "APΒ·AFP ν΅μ λ± μΈμ μ μμμ μ΅κ³ λΆμλ‘ κΌ½νλ μΈλμ 무μΌμ μλ°λ 릴λΌμ΄μΈμ€ μΈλμ€νΈλ¦¬ νμ₯μ΄ λ§λ΄μλ€μ μ΄νΈν κ²°νΌμμ μ€λΉνλ©΄μ μ μΈκ³ μ΅λ§μ₯μμ ν 리μ°λ μ€ν λ± μ λͺ
μΈμ¬λ€μ λκ±° μ΄λνλ€κ³ 2μΌ(νμ§μκ°) 보λνλ€. μ΄μ λ°λ₯΄λ©΄ κ·Έμ 28μΈ μλ€μΈ μλνΈ μλ°λλ μ€λ 7μ μΈλ μλΆ κ΅¬μλΌνΈμ£Ό μ λκ°λ₯΄μμ μ€λ μ°μΈμΈ λΌλμΉ΄ λ¨Έμ²νΈμ κ²°νΌν μμ μ΄λ€. λ¨Έμ²νΈλ μΈλ μ μ½νμ¬ μμ½λ₯΄ ν¬μ€μΌμ΄μ μ΅κ³ κ²½μμ(CEO) λ°μ΄λ λ¨Έμ²νΈμ λΈμ΄λ€. μ¬νκ° μ§νλ λ μ¬λμ κ²°νΌμμ λ§ν¬ μ 컀λ²κ·Έ λ©ν CEO, λΉ κ²μ΄μΈ λ§μ΄ν¬λ‘μννΈ(MS) μ°½μ
μ, μλ€λ₯΄ νΌμ°¨μ΄ κ΅¬κΈ CEO, λλλ νΈλΌν μ λ―Έκ΅ λν΅λ Ήμ λΈ μ΄λ°©μΉ΄ νΈλΌν λ± 1200λͺ
μ μ λͺ
μΈμ¬λ€μ΄ μ°Έμν μμ μ΄λ€. λ νμ€ν 리νλμ λ§μ μ¬ λ°μ΄λΉλ λΈλ μΈ λ±μ 곡μ°λ μ΄λ¦΄ μμ μ΄λ€. μΈλμ ν¬λ°μ΄λ 리νλκ° μ΄ νμ¬ μΆμ°λ£λ‘ 900λ§ λ¬λ¬(μ½ 120μ΅ μ)λ₯Ό μ μλ°μλ€κ³ 보λνλ€. μ§λ 6μΌ μμΈκΉν¬λΉμ¦λμ€ν곡μΌν°λ₯Ό ν΅ν΄ μλλ©λ―Έλ¦¬νΈμ°ν©(UAE)μΌλ‘ μΆκ΅νκ³ μλ μ΄μ¬μ© μΌμ±μ μ νμ₯. λ΄μμ€ μ΄λ² κ²°νΌμμ μ°Έμνλ νκ°λ€μ μ κΈμ ν
λ§λ‘ ν μμμ μ
κ³ μλνΈ μλ°λκ° μ΄μνλ λλ¬Ό ꡬ쑰 μΌν°λ₯Ό λ°©λ¬Ένλ€. βμ²μ λ³βμ΄λΌλ λ»μ βλ°νλΌβλ‘ μλ €μ§ μ΄κ³³μ λ©΄μ λ§ μ¬μλμ 4λ°° κ·λͺ¨μΈ 12γ’μ λ¬νλ©° μ½λΌλ¦¬ λ± κ°μ’
λ©Έμ’
μκΈ°μ μλ λλ¬Όλ€μ΄ μμνλ€. λ λ§€μΌ μ΄νΈν νν°κ° μ΄λ¦¬λ©° κ·Έλλ§λ€ μλ‘μ΄ λλ μ€ μ½λμ λ§μΆ° μ·μ μ
μ΄μΌ νλ€. μ΄λ² κ²°νΌμμ μν΄ μλ°λλ νλκ΅ μ¬μ λ¨μ§λ₯Ό μλ‘ κ±΄μ€ μ€μ΄λ©°, κ²°νΌμ νν°μλ§ 2500μ¬ κ°μ μμμ΄ μ 곡λ μμ μ΄λ€. μλ°λλ 2018λ
κ³Ό 2019λ
μλ κ°κ° λΈκ³Ό μλ€μ κ²°νΌμν€λ©΄μ μ΄νΈν νν°λ₯Ό μ΄μ΄ μ μΈκ³μ μ΄λͺ©μ μ§μ€μμΌ°λ€. 2018λ
12μμ μ΄λ¦° λΈ μ΄μ€ μλ°λμ κ²°νΌμ μΆνμ°μλ νλ¬λ¦¬ ν΄λ¦°ν΄ μ λ―Έκ΅ κ΅λ¬΄μ₯κ΄κ³Ό μ΄μ¬μ© μΌμ±μ μ νμ₯, μΈλ‘ μ¬λ² 루νΌνΈ λ¨Έλ
μ μ°¨λ¨ μ μμ€ λ¨Έλ
λ±μ΄ μ°Έμνκ³ , μΆν 곡μ°μ νμ€ν λΉμμΈκ° 맑μλ€. μλ°λ νμ₯μ μ΄ κ²°νΌμμλ§ 1μ΅ λ¬λ¬(μ½ 1336μ΅ μ)λ₯Ό μ¬μ©ν κ²μΌλ‘ μ ν΄μ‘λ€. 2019λ
μ₯λ¨ μμΉ΄μ μλ°λμ κ²°νΌμμλ ν λ λΈλ μ΄ μ μκ΅ μ΄λ¦¬λ₯Ό λΉλ‘―ν΄ μλ€λ₯΄ νΌμ°¨μ΄μ λ°κΈ°λ¬Έ μ μ μμ¬λ¬΄μ΄μ₯ λ±μ΄ μ°Έμνλ€. μ΄μ¬μ© νμ₯μ μ΄ λ μΈλ μ ν΅ μμμ μ
κ³ μ°Έμν μ¬μ§μ΄ 곡κ°λΌ νμ κ° λκΈ°λ νλ€. μλ°λ νμ₯μ μμ μ κ°μ€, μμ νν λΆμΌμμ μ±κ³΅ν΄ λ§μ λμ λͺ¨μκ³ 2016λ
릴λΌμ΄μΈμ€ μ§μ€λ₯Ό μμΈμ μΈλ ν΅μ μμ₯μλ μ§μΆ, μΈλ μμ₯μ μ¬μ€μ νμ νλ©΄μ μμμ μ΅κ³ κ°λΆ λμ΄μ μ¬λΌμ°λ€. κ·Έκ° μμ ν μΈλ λλ°μ΄μ 27μΈ΅μ§λ¦¬ μ ν βμν리μβλ μΈκ³μμ κ°μ₯ λΉμΌ κ°μΈ μ£ΌνμΌλ‘ κΌ½νλ€."
|
50 |
+
text = f"λ¬Έμ₯: {passage}\nμμ½ :"
|
51 |
+
device = "cuda:0"
|
52 |
+
inputs = tokenizer(text, return_tensors="pt").to(device)
|
53 |
+
|
54 |
+
outputs = model.generate(**inputs,
|
55 |
+
max_new_tokens=512,
|
56 |
+
temperature=1,
|
57 |
+
use_cache=False)
|
58 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|