brildev7 commited on
Commit
2a919e6
β€’
1 Parent(s): b5ec7df

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -193
README.md CHANGED
@@ -1,204 +1,76 @@
1
  ---
2
  library_name: peft
3
  base_model: google/gemma-2b
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
-
12
  ## Model Details
13
-
14
  ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
-
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
-
202
- ### Framework versions
203
-
204
- - PEFT 0.8.2
 
1
  ---
2
  library_name: peft
3
  base_model: google/gemma-2b
4
+ language:
5
+ - ko
6
+ - en
7
+ tags:
8
+ - translation
9
+ - gemma
10
  ---
11
 
12
  # Model Card for Model ID
 
 
 
 
 
13
  ## Model Details
 
14
  ### Model Description
15
+ Summarise Korean sentences concisely
16
+ - **Developed by:** [Kang Seok Ju]
17
+ - **Contact:** [brildev7@gmail.com]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  ## Training Details
 
20
  ### Training Data
21
+ https://huggingface.co/datasets/traintogpb/aihub-koen-translation-integrated-tiny-100k
22
+
23
+ # Inference Examples
24
+ ```
25
+ import os
26
+ import torch
27
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
28
+ from peft import PeftModel
29
+
30
+ model_id = "google/gemma-2b"
31
+ peft_model_id = "brildev7/gemma-2b-translation-koen-sft-qlora"
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
+ quantization_config=quantization_config,
41
+ torch_dtype=torch.float32,
42
+ attn_implementation="sdpa",
43
+ )
44
+ model = PeftModel.from_pretrained(model, peft_model_id)
45
+
46
+ tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
47
+ tokenizer.pad_token_id = tokenizer.eos_token_id
48
+
49
+ # example
50
+ prompt_template = """λ‹€μŒ λ‚΄μš©μ„ μ˜μ–΄λ‘œ λ²ˆμ—­ν•˜μ„Έμš”.:
51
+ {}
52
+
53
+ λ²ˆμ—­:
54
+ """
55
+ sentences = "μœ„μ€‘μ„€μ΄ λ‚˜λŒλ˜ μœŒλ¦¬μ—„ 영ꡭ μ™•μ„Έμžμ˜ 뢀인 μΌ€μ΄νŠΈ λ―Έλ“€ν„΄ μ™•μ„ΈμžλΉˆ(42)이 κ²°κ΅­ μ•” 진단을 λ°›μ•˜λ‹€. λ‘œμ΄ν„° 톡신에 λ”°λ₯΄λ©΄ μ™•μ„ΈμžλΉˆμ€ 22일(ν˜„μ§€μ‹œκ°„) μΈμŠ€νƒ€κ·Έλž¨ μ˜μƒ λ©”μ‹œμ§€λ₯Ό 톡해 μ§€λ‚œ 1μ›” 볡뢀 μˆ˜μˆ μ„ 받은 λ’€ μ‹€μ‹œν•œ 후속 κ²€μ‚¬μ—μ„œ 암이 발견돼 ν˜„μž¬ ν™”ν•™μΉ˜λ£Œλ₯Ό λ°›κ³  μžˆλ‹€κ³  λ°ν˜”λ‹€. μ™•μ„ΈμžλΉˆμ€ 'μ˜λ£Œμ§„μ€ 예방적 μ°¨μ›μ—μ„œ ν™”ν•™μΉ˜λ£Œλ₯Ό κΆŒκ³ ν–ˆλ‹€'λ©΄μ„œ 'λ¬Όλ‘  이것은 큰 좩격으둜 λ‹€κ°€μ™”μ§€λ§Œ μœŒλ¦¬μ—„κ³Ό μ €λŠ” μ–΄λ¦° 가쑱듀을 μœ„ν•΄ 이 문제λ₯Ό ν•΄κ²°ν•˜κ³ μž μ΅œμ„ μ„ λ‹€ν•˜κ³  μžˆλ‹€'κ³  λ§ν–ˆλ‹€. κ·ΈλŸ¬λ©΄μ„œ 'ν˜„μž¬ μ•”μœΌλ‘œ 인해 영ν–₯을 받은 λͺ¨λ“  μ‚¬λžŒλ“€μ„ μƒκ°ν•˜κ³  μžˆλ‹€'λ©° '믿음과 희망을 μžƒμ§€ 말아 달라. μ—¬λŸ¬λΆ„μ€ ν˜Όμžκ°€ μ•„λ‹ˆλ‹€'라고 λ§λΆ™μ˜€λ‹€."
56
+ texts = prompt_template.format(sentences)
57
+ inputs = tokenizer(texts, return_tensors="pt").to(model.device)
58
+
59
+ outputs = model.generate(**inputs, max_new_tokens=1024)
60
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
61
+ - Prince William's wife Kate Middleton, 42, has been diagnosed with cancer after undergoing surgery for her abdominal pain, according to Reuters news agency. In an Instagram message on the 22nd (local time), Kate Middleton, the wife of Prince William, said that she was diagnosed with cancer after undergoing surgery for her abdominal pain in January and is currently undergoing chemical therapy. She said that the medical team recommended chemical therapy as a measure to prevent the spread of the disease, but that she and Prince William are trying to resolve the issue for their young family. She added that "The medical team recommended chemical therapy as a measure to prevent the spread of the disease.
62
+
63
+ # example
64
+ prompt_template = """λ‹€μŒ λ‚΄μš©μ„ μ˜μ–΄λ‘œ λ²ˆμ—­ν•˜μ„Έμš”.:
65
+ {}
66
+
67
+ λ²ˆμ—­:
68
+ """
69
+ sentences = "μ• ν”Œμ΄ μ£Όλ ₯ μ‹œμž₯ 쀑에 ν•˜λ‚˜μΈ μ€‘κ΅­μ—μ„œ ν˜„μ§€ 슀마트폰 μ œμ‘°μ‚¬λ“€μ—κ²Œ 밀리며 μœ„κΈ°κ°μ΄ 증폭된 κ°€μš΄λ° 쀑ꡭ μ†ŒλΉ„μž μž‘κΈ°μ— λ‚˜μ„œκ³  μžˆλ‹€. νŒ€ μΏ‘ CEO(졜고경영자)κ°€ 직접 쀑ꡭ을 λ°©λ¬Έν•΄ 투자λ₯Ό μ•½μ†ν•˜κ³ , '아이폰' λ“± μžμ‚¬ 기기에 쀑ꡭ λ°”μ΄λ‘μ˜ AI(인곡지λŠ₯) λͺ¨λΈμ„ νƒ‘μž¬ν•˜λŠ” λ°©μ•ˆλ„ κ²€ν† ν•˜κ³  μžˆλ‹€. 쀑ꡭ λ³Έν† μ„œ 아이폰 할인 곡세에 이어 μ „λ°©μœ„μ  투자λ₯Ό λŠ˜λ¦¬λŠ” λͺ¨μ–‘μƒˆλ‹€."
70
+ texts = prompt_template.format(sentences)
71
+ inputs = tokenizer(texts, return_tensors="pt").to(model.device)
72
+
73
+ outputs = model.generate(**inputs, max_new_tokens=1024)
74
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
75
+ - With Apple becoming a target in China, a major market, the company is taking a stance in a Chinese consumer magazine. CEO Tim Cook is visiting China and is planning to invest, and is also considering adding Chinese Big Data AI models on Apple's products such as 'iPhone'. It seems that China is making a wide-ranging investment following the iPhone discounting wave on the mainland.
76
+ ```