Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,168 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
-
|
|
|
4 |
---
|
5 |
|
6 |
-
|
|
|
|
|
7 |
|
8 |
-
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
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 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
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 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
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]
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- ko
|
5 |
+
license: llama3
|
6 |
library_name: transformers
|
7 |
+
base_model:
|
8 |
+
- meta-llama/Meta-Llama-3-8B
|
9 |
---
|
10 |
|
11 |
+
<a href="https://taemin6697.github.io/">
|
12 |
+
<img src="https://github.com/taemin6697/taemin6697/assets/96530685/46a29020-e640-4e74-9d77-f12e466fc706" width="40%" height="50%">
|
13 |
+
</a>
|
14 |
|
15 |
+
# Hansung Bllossom | [Demo]() | [Developer κΉνλ―Ό](https://taemin6697.github.io/) | [Github](https://github.com/taemin6697/HansungGPT/tree/main) |
|
16 |
|
17 |
+
```bash
|
18 |
+
νμ±λνκ΅ QA κΈ°λ°μΌλ‘ νμ΅μν¨Hansung-Llama-3-8B λ₯Ό μΆμν©λλ€.
|
19 |
+
μ΄λ beomi/Llama-3-KoEn-8B-Instruct-preview μ κΈ°λ°μΌλ‘ νμ΅λμμ΅λλ€.
|
20 |
+
```
|
21 |
+
|
22 |
+
The Bllossom language model is a Korean-English bilingual language model based on the open-source LLama3. It enhances the connection of knowledge between Korean and English. It has the following features:
|
23 |
|
24 |
+
* **Knowledge Linking**: Linking Korean and English knowledge through additional training
|
25 |
+
* **Vocabulary Expansion**: Expansion of Korean vocabulary to enhance Korean expressiveness.
|
26 |
+
* **Instruction Tuning**: Tuning using custom-made instruction following data specialized for Korean language and Korean culture
|
27 |
+
* **Human Feedback**: DPO has been applied
|
28 |
+
* **Vision-Language Alignment**: Aligning the vision transformer with this language model
|
29 |
+
|
30 |
+
## Example code
|
31 |
+
|
32 |
+
### Install Dependencies
|
33 |
+
```bash
|
34 |
+
pip install torch transformers==4.40.0 accelerate
|
35 |
+
```
|
36 |
|
37 |
+
### Python code with Pipeline
|
38 |
+
```python
|
39 |
+
import transformers
|
40 |
+
import torch
|
41 |
+
|
42 |
+
model_id = "kfkas/Hansung-Llama-3-8B"
|
43 |
+
|
44 |
+
pipeline = transformers.pipeline(
|
45 |
+
"text-generation",
|
46 |
+
model=model_id,
|
47 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
48 |
+
device_map="auto",
|
49 |
+
)
|
50 |
+
|
51 |
+
pipeline.model.eval()
|
52 |
+
|
53 |
+
PROMPT = '''λΉμ μ μ μ©ν AI μ΄μμ€ν΄νΈμ
λλ€. μ¬μ©μμ μ§μμ λν΄ μΉμ νκ³ μ ννκ² λ΅λ³ν΄μΌ ν©λλ€.
|
54 |
+
You are a helpful AI assistant, you'll need to answer users' queries in a friendly and accurate manner.'''
|
55 |
+
instruction = "νμ±λνκ΅μμλ μ΄λ€ μΆμ λ νμ¬κ° μ΄λ¦¬λμ?"
|
56 |
+
|
57 |
+
messages = [
|
58 |
+
{"role": "system", "content": f"{PROMPT}"},
|
59 |
+
{"role": "user", "content": f"{instruction}"}
|
60 |
+
]
|
61 |
+
|
62 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
63 |
+
messages,
|
64 |
+
tokenize=False,
|
65 |
+
add_generation_prompt=True
|
66 |
+
)
|
67 |
+
|
68 |
+
terminators = [
|
69 |
+
pipeline.tokenizer.eos_token_id,
|
70 |
+
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
71 |
+
]
|
72 |
+
|
73 |
+
outputs = pipeline(
|
74 |
+
prompt,
|
75 |
+
max_new_tokens=2048,
|
76 |
+
eos_token_id=terminators,
|
77 |
+
do_sample=True,
|
78 |
+
temperature=0.6,
|
79 |
+
top_p=0.9
|
80 |
+
)
|
81 |
+
|
82 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
83 |
+
|
84 |
+
```
|
85 |
+
|
86 |
+
### Python code with AutoModel
|
87 |
+
```python
|
88 |
+
|
89 |
+
import os
|
90 |
+
import torch
|
91 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
92 |
+
|
93 |
+
model_id = 'kfkas/Hansung-Llama-3-8B'
|
94 |
+
|
95 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
96 |
+
model = AutoModelForCausalLM.from_pretrained(
|
97 |
+
model_id,
|
98 |
+
torch_dtype=torch.bfloat16,
|
99 |
+
device_map="auto",
|
100 |
+
)
|
101 |
+
|
102 |
+
model.eval()
|
103 |
+
|
104 |
+
PROMPT = '''λΉμ μ μ μ©ν AI μ΄μμ€ν΄νΈμ
λλ€. μ¬μ©μμ μ§μμ λν΄ μΉμ νκ³ μ ννκ² λ΅λ³ν΄μΌ ν©λλ€.
|
105 |
+
You are a helpful AI assistant, you'll need to answer users' queries in a friendly and accurate manner.'''
|
106 |
+
instruction = "νμ±λνκ΅λ μΈμ μ€λ¦½λμλμ?"
|
107 |
+
|
108 |
+
messages = [
|
109 |
+
{"role": "system", "content": f"{PROMPT}"},
|
110 |
+
{"role": "user", "content": f"{instruction}"}
|
111 |
+
]
|
112 |
+
|
113 |
+
input_ids = tokenizer.apply_chat_template(
|
114 |
+
messages,
|
115 |
+
add_generation_prompt=True,
|
116 |
+
return_tensors="pt"
|
117 |
+
).to(model.device)
|
118 |
+
|
119 |
+
terminators = [
|
120 |
+
tokenizer.eos_token_id,
|
121 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
122 |
+
]
|
123 |
+
|
124 |
+
outputs = model.generate(
|
125 |
+
input_ids,
|
126 |
+
max_new_tokens=2048,
|
127 |
+
eos_token_id=terminators,
|
128 |
+
do_sample=True,
|
129 |
+
temperature=0.6,
|
130 |
+
top_p=0.9
|
131 |
+
)
|
132 |
+
|
133 |
+
print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
|
134 |
+
```
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
## Citation
|
139 |
+
**Language Model**
|
140 |
+
```text
|
141 |
+
@misc{bllossom,
|
142 |
+
author = {ChangSu Choi, Yongbin Jeong, Seoyoon Park, InHo Won, HyeonSeok Lim, SangMin Kim, Yejee Kang, Chanhyuk Yoon, Jaewan Park, Yiseul Lee, HyeJin Lee, Younggyun Hahm, Hansaem Kim, KyungTae Lim},
|
143 |
+
title = {Optimizing Language Augmentation for Multilingual Large Language Models: A Case Study on Korean},
|
144 |
+
year = {2024},
|
145 |
+
journal = {LREC-COLING 2024},
|
146 |
+
paperLink = {\url{https://arxiv.org/pdf/2403.10882}},
|
147 |
+
},
|
148 |
+
}
|
149 |
+
```
|
150 |
+
|
151 |
+
**Vision-Language Model**
|
152 |
+
```text
|
153 |
+
@misc{bllossom-V,
|
154 |
+
author = {Dongjae Shin, Hyunseok Lim, Inho Won, Changsu Choi, Minjun Kim, Seungwoo Song, Hangyeol Yoo, Sangmin Kim, Kyungtae Lim},
|
155 |
+
title = {X-LLaVA: Optimizing Bilingual Large Vision-Language Alignment},
|
156 |
+
year = {2024},
|
157 |
+
publisher = {GitHub},
|
158 |
+
journal = {NAACL 2024 findings},
|
159 |
+
paperLink = {\url{https://arxiv.org/pdf/2403.11399}},
|
160 |
+
},
|
161 |
+
}
|
162 |
+
```
|
163 |
+
|
164 |
+
## Contact
|
165 |
+
- κΉνλ―Ό(Taemin Kim), Intelligent System. `[email protected]`
|
166 |
+
|
167 |
+
## Contributor
|
168 |
+
- κΉνλ―Ό(Taemin Kim), Intelligent System. `taemin6697@gmail.com`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|