brildev7 commited on
Commit
c533c9d
β€’
1 Parent(s): b35cad3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -187
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
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a πŸ€— transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
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