Update README.md
Browse files
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 |
-
|
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 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
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 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|