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
- ko
|
5 |
+
license: llama3
|
6 |
+
library_name: transformers
|
7 |
+
base_model:
|
8 |
+
- meta-llama/Meta-Llama-3-8B
|
9 |
+
---
|
10 |
+
|
11 |
+
<a href="https://github.com/MLP-Lab/Bllossom">
|
12 |
+
<img src="https://github.com/teddysum/bllossom/blob/main//bllossom_icon.png?raw=true" width="40%" height="50%">
|
13 |
+
</a>
|
14 |
+
|
15 |
+
# Bllossom | [Demo]() | [Homepage](https://www.bllossom.ai/) | [Github](https://github.com/MLP-Lab/Bllossom) | [Colab-tutorial](https://colab.research.google.com/drive/1fBOzUVZ6NRKk_ugeoTbAOokWKqSN47IG?usp=sharing) |
|
16 |
+
|
17 |
+
|
18 |
+
```bash
|
19 |
+
์ ํฌ Bllossomํ ์์ ํ๊ตญ์ด-์์ด ์ด์ค ์ธ์ด๋ชจ๋ธ์ธ Bllossom์ ๊ณต๊ฐํ์ต๋๋ค!
|
20 |
+
์์ธ๊ณผ๊ธฐ๋ ์ํผ์ปดํจํ
์ผํฐ์ ์ง์์ผ๋ก 100GB๊ฐ๋๋ ํ๊ตญ์ด๋ก ๋ชจ๋ธ์ ์ฒด๋ฅผ ํํ๋ํ ํ๊ตญ์ด ๊ฐํ ์ด์ค์ธ์ด ๋ชจ๋ธ์
๋๋ค!
|
21 |
+
ํ๊ตญ์ด ์ํ๋ ๋ชจ๋ธ ์ฐพ๊ณ ์์ง ์์ผ์
จ๋์?
|
22 |
+
- ํ๊ตญ์ด ์ต์ด! ๋ฌด๋ ค 3๋ง๊ฐ๊ฐ ๋๋ ํ๊ตญ์ด ์ดํํ์ฅ
|
23 |
+
- Llama3๋๋น ๋๋ต 25% ๋ ๊ธด ๊ธธ์ด์ ํ๊ตญ์ด Context ์ฒ๋ฆฌ๊ฐ๋ฅ
|
24 |
+
- ํ๊ตญ์ด-์์ด Pararell Corpus๋ฅผ ํ์ฉํ ํ๊ตญ์ด-์์ด ์ง์์ฐ๊ฒฐ (์ฌ์ ํ์ต)
|
25 |
+
- ํ๊ตญ์ด ๋ฌธํ, ์ธ์ด๋ฅผ ๊ณ ๋ คํด ์ธ์ดํ์๊ฐ ์ ์ํ ๋ฐ์ดํฐ๋ฅผ ํ์ฉํ ๋ฏธ์ธ์กฐ์
|
26 |
+
- ๊ฐํํ์ต
|
27 |
+
์ด ๋ชจ๋ ๊ฒ ํ๊บผ๋ฒ์ ์ ์ฉ๋๊ณ ์์
์ ์ด์ฉ์ด ๊ฐ๋ฅํ Bllossom์ ์ด์ฉํด ์ฌ๋ฌ๋ถ ๋ง์ ๋ชจ๋ธ์ ๋ง๋ค์ด๋ณด์ธ์ฅ!
|
28 |
+
๋ณธ ๋ชจ๋ธ์ 4GB GPU์์ ๊ตฌ๋ ๊ฐ๋ฅํ ์์ํ ๋ชจ๋ธ์
๋๋ค!
|
29 |
+
|
30 |
+
1. Bllossom-8B๋ ์์ธ๊ณผ๊ธฐ๋, ํ
๋์ธ, ์ฐ์ธ๋ ์ธ์ด์์ ์ฐ๊ตฌ์ค์ ์ธ์ดํ์์ ํ์
ํด ๋ง๋ ์ค์ฉ์ฃผ์๊ธฐ๋ฐ ์ธ์ด๋ชจ๋ธ์
๋๋ค! ์์ผ๋ก ์ง์์ ์ธ ์
๋ฐ์ดํธ๋ฅผ ํตํด ๊ด๋ฆฌํ๊ฒ ์ต๋๋ค ๋ง์ด ํ์ฉํด์ฃผ์ธ์ ๐
|
31 |
+
2. ์ด ๊ฐ๋ ฅํ Advanced-Bllossom 8B, 70B๋ชจ๋ธ, ์๊ฐ-์ธ์ด๋ชจ๋ธ์ ๋ณด์ ํ๊ณ ์์ต๋๋ค! (๊ถ๊ธํ์ ๋ถ์ ๊ฐ๋ณ ์ฐ๋ฝ์ฃผ์ธ์!!)
|
32 |
+
3. Bllossom์ NAACL2024, LREC-COLING2024 (๊ตฌ๋) ๋ฐํ๋ก ์ฑํ๋์์ต๋๋ค.
|
33 |
+
4. ์ข์ ์ธ์ด๋ชจ๋ธ ๊ณ์ ์
๋ฐ์ดํธ ํ๊ฒ ์ต๋๋ค!! ํ๊ตญ์ด ๊ฐํ๋ฅผ์ํด ๊ณต๋ ์ฐ๊ตฌํ์ค๋ถ(ํนํ๋
ผ๋ฌธ) ์ธ์ ๋ ํ์ํฉ๋๋ค!!
|
34 |
+
ํนํ ์๋์ GPU๋ผ๋ ๋์ฌ ๊ฐ๋ฅํํ์ ์ธ์ ๋ ์ฐ๋ฝ์ฃผ์ธ์! ๋ง๋ค๊ณ ์ถ์๊ฑฐ ๋์๋๋ ค์.
|
35 |
+
```
|
36 |
+
|
37 |
+
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:
|
38 |
+
|
39 |
+
* **Knowledge Linking**: Linking Korean and English knowledge through additional training
|
40 |
+
* **Vocabulary Expansion**: Expansion of Korean vocabulary to enhance Korean expressiveness.
|
41 |
+
* **Instruction Tuning**: Tuning using custom-made instruction following data specialized for Korean language and Korean culture
|
42 |
+
* **Human Feedback**: DPO has been applied
|
43 |
+
* **Vision-Language Alignment**: Aligning the vision transformer with this language model
|
44 |
+
|
45 |
+
**This model developed by [MLPLab at Seoultech](http://mlp.seoultech.ac.kr), [Teddysum](http://teddysum.ai/) and [Yonsei Univ](https://sites.google.com/view/hansaemkim/hansaem-kim)**
|
46 |
+
|
47 |
+
## Demo Video
|
48 |
+
|
49 |
+
<div style="display: flex; justify-content: space-between;">
|
50 |
+
<!-- ์ฒซ ๋ฒ์งธ ์ปฌ๋ผ -->
|
51 |
+
<div style="width: 49%;">
|
52 |
+
<a>
|
53 |
+
<img src="https://github.com/lhsstn/lhsstn/blob/main/x-llava_dem.gif?raw=true" style="width: 100%; height: auto;">
|
54 |
+
</a>
|
55 |
+
<p style="text-align: center;">Bllossom-V Demo</p>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<!-- ๋ ๋ฒ์งธ ์ปฌ๋ผ (ํ์ํ๋ค๋ฉด) -->
|
59 |
+
<div style="width: 49%;">
|
60 |
+
<a>
|
61 |
+
<img src="https://github.com/lhsstn/lhsstn/blob/main/bllossom_demo_kakao.gif?raw=true" style="width: 70%; height: auto;">
|
62 |
+
</a>
|
63 |
+
<p style="text-align: center;">Bllossom Demo(Kakao)ใ
คใ
คใ
คใ
คใ
คใ
คใ
คใ
ค</p>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
## NEWS
|
70 |
+
* [2024.05.08] Vocab Expansion Model Update
|
71 |
+
* [2024.04.25] We released Bllossom v2.0, based on llama-3
|
72 |
+
* [2023/12] We released Bllossom-Vision v1.0, based on Bllossom
|
73 |
+
* [2023/08] We released Bllossom v1.0, based on llama-2.
|
74 |
+
* [2023/07] We released Bllossom v0.7, based on polyglot-ko.
|
75 |
+
|
76 |
+
|
77 |
+
## Example code
|
78 |
+
|
79 |
+
### Colab Tutorial
|
80 |
+
- [Inference-Code-Link](https://colab.research.google.com/drive/1fBOzUVZ6NRKk_ugeoTbAOokWKqSN47IG?usp=sharing)
|
81 |
+
|
82 |
+
### Install Dependencies
|
83 |
+
```bash
|
84 |
+
pip install torch transformers==4.40.0 accelerate
|
85 |
+
```
|
86 |
+
|
87 |
+
### Python code with Pipeline
|
88 |
+
```python
|
89 |
+
import transformers
|
90 |
+
import torch
|
91 |
+
|
92 |
+
model_id = "MLP-KTLim/llama-3-Korean-Bllossom-8B"
|
93 |
+
|
94 |
+
pipeline = transformers.pipeline(
|
95 |
+
"text-generation",
|
96 |
+
model=model_id,
|
97 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
98 |
+
device_map="auto",
|
99 |
+
)
|
100 |
+
|
101 |
+
pipeline.model.eval()
|
102 |
+
|
103 |
+
PROMPT = '''๋น์ ์ ์ ์ฉํ AI ์ด์์คํดํธ์
๋๋ค. ์ฌ์ฉ์์ ์ง์์ ๋ํด ์น์ ํ๊ณ ์ ํํ๊ฒ ๋ต๋ณํด์ผ ํฉ๋๋ค.
|
104 |
+
You are a helpful AI assistant, you'll need to answer users' queries in a friendly and accurate manner.'''
|
105 |
+
instruction = "์์ธ๊ณผํ๊ธฐ์ ๋ํ๊ต MLP์ฐ๊ตฌ์ค์ ๋ํด ์๊ฐํด์ค"
|
106 |
+
|
107 |
+
messages = [
|
108 |
+
{"role": "system", "content": f"{PROMPT}"},
|
109 |
+
{"role": "user", "content": f"{instruction}"}
|
110 |
+
]
|
111 |
+
|
112 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
113 |
+
messages,
|
114 |
+
tokenize=False,
|
115 |
+
add_generation_prompt=True
|
116 |
+
)
|
117 |
+
|
118 |
+
terminators = [
|
119 |
+
pipeline.tokenizer.eos_token_id,
|
120 |
+
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
121 |
+
]
|
122 |
+
|
123 |
+
outputs = pipeline(
|
124 |
+
prompt,
|
125 |
+
max_new_tokens=2048,
|
126 |
+
eos_token_id=terminators,
|
127 |
+
do_sample=True,
|
128 |
+
temperature=0.6,
|
129 |
+
top_p=0.9,
|
130 |
+
repetition_penalty = 1.1
|
131 |
+
)
|
132 |
+
|
133 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
134 |
+
|
135 |
+
# ์์ธ๊ณผํ๊ธฐ์ ๋ํ๊ต MLP์ฐ๊ตฌ์ค์ ๋ฉํฐ๋ชจ๋ฌ ์์ฐ์ด์ฒ๋ฆฌ ์ฐ๊ตฌ๋ฅผ ํ๊ณ ์์ต๋๋ค. ๊ตฌ์ฑ์์ ์๊ฒฝํ ๊ต์์ ๊น๋ฏผ์ค, ๊น์๋ฏผ, ์ต์ฐฝ์, ์์ธํธ, ์ ํ๊ฒฐ, ์ํ์, ์ก์น์ฐ, ์ก์ ํ, ์ ๋์ฌ ํ์์ด ์์ต๋๋ค.
|
136 |
+
```
|
137 |
+
|
138 |
+
### Python code with AutoModel
|
139 |
+
```python
|
140 |
+
|
141 |
+
import os
|
142 |
+
import torch
|
143 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
144 |
+
|
145 |
+
model_id = 'MLP-KTLim/llama-3-Korean-Bllossom-8B'
|
146 |
+
|
147 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
148 |
+
model = AutoModelForCausalLM.from_pretrained(
|
149 |
+
model_id,
|
150 |
+
torch_dtype=torch.bfloat16,
|
151 |
+
device_map="auto",
|
152 |
+
)
|
153 |
+
|
154 |
+
model.eval()
|
155 |
+
|
156 |
+
PROMPT = '''๋น์ ์ ์ ์ฉํ AI ์ด์์คํดํธ์
๋๋ค. ์ฌ์ฉ์์ ์ง์์ ๋ํด ์น์ ํ๊ณ ์ ํํ๊ฒ ๋ต๋ณํด์ผ ํฉ๋๋ค.
|
157 |
+
You are a helpful AI assistant, you'll need to answer users' queries in a friendly and accurate manner.'''
|
158 |
+
instruction = "์์ธ๊ณผํ๊ธฐ์ ๋ํ๊ต MLP์ฐ๊ตฌ์ค์ ๋ํด ์๊ฐํด์ค"
|
159 |
+
|
160 |
+
messages = [
|
161 |
+
{"role": "system", "content": f"{PROMPT}"},
|
162 |
+
{"role": "user", "content": f"{instruction}"}
|
163 |
+
]
|
164 |
+
|
165 |
+
input_ids = tokenizer.apply_chat_template(
|
166 |
+
messages,
|
167 |
+
add_generation_prompt=True,
|
168 |
+
return_tensors="pt"
|
169 |
+
).to(model.device)
|
170 |
+
|
171 |
+
terminators = [
|
172 |
+
tokenizer.eos_token_id,
|
173 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
174 |
+
]
|
175 |
+
|
176 |
+
outputs = model.generate(
|
177 |
+
input_ids,
|
178 |
+
max_new_tokens=2048,
|
179 |
+
eos_token_id=terminators,
|
180 |
+
do_sample=True,
|
181 |
+
temperature=0.6,
|
182 |
+
top_p=0.9,
|
183 |
+
repetition_penalty = 1.1
|
184 |
+
)
|
185 |
+
|
186 |
+
print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
|
187 |
+
# ์์ธ๊ณผํ๊ธฐ์ ๋ํ๊ต MLP์ฐ๊ตฌ์ค์ ๋ฉํฐ๋ชจ๋ฌ ์์ฐ์ด์ฒ๋ฆฌ ์ฐ๊ตฌ๋ฅผ ํ๊ณ ์์ต๋๋ค. ๊ตฌ์ฑ์์ ์๊ฒฝํ ๊ต์์ ๊น๋ฏผ์ค, ๊น์๋ฏผ, ์ต์ฐฝ์, ์์ธํธ, ์ ํ๊ฒฐ, ์ํ์, ์ก์น์ฐ, ์ก์ ํ, ์ ๋์ฌ ํ์์ด ์์ต๋๋ค.
|
188 |
+
```
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
+
## Citation
|
193 |
+
**Language Model**
|
194 |
+
```text
|
195 |
+
@misc{bllossom,
|
196 |
+
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},
|
197 |
+
title = {Optimizing Language Augmentation for Multilingual Large Language Models: A Case Study on Korean},
|
198 |
+
year = {2024},
|
199 |
+
journal = {LREC-COLING 2024},
|
200 |
+
paperLink = {\url{https://arxiv.org/pdf/2403.10882}},
|
201 |
+
},
|
202 |
+
}
|
203 |
+
```
|
204 |
+
|
205 |
+
**Vision-Language Model**
|
206 |
+
```text
|
207 |
+
@misc{bllossom-V,
|
208 |
+
author = {Dongjae Shin, Hyunseok Lim, Inho Won, Changsu Choi, Minjun Kim, Seungwoo Song, Hangyeol Yoo, Sangmin Kim, Kyungtae Lim},
|
209 |
+
title = {X-LLaVA: Optimizing Bilingual Large Vision-Language Alignment},
|
210 |
+
year = {2024},
|
211 |
+
publisher = {GitHub},
|
212 |
+
journal = {NAACL 2024 findings},
|
213 |
+
paperLink = {\url{https://arxiv.org/pdf/2403.11399}},
|
214 |
+
},
|
215 |
+
}
|
216 |
+
```
|
217 |
+
|
218 |
+
## Contact
|
219 |
+
- ์๊ฒฝํ(KyungTae Lim), Professor at Seoultech. `ktlim@seoultech.ac.kr`
|
220 |
+
- ํจ์๊ท (Younggyun Hahm), CEO of Teddysum. `hahmyg@teddysum.ai`
|
221 |
+
- ๊นํ์(Hansaem Kim), Professor at Yonsei. `khss@yonsei.ac.kr`
|
222 |
+
|
223 |
+
## Contributor
|
224 |
+
- ์ต์ฐฝ์(Chansu Choi), choics2623@seoultech.ac.kr
|
225 |
+
- ๊น์๋ฏผ(Sangmin Kim), sangmin9708@naver.com
|
226 |
+
- ์์ธํธ(Inho Won), wih1226@seoultech.ac.kr
|
227 |
+
- ๊น๋ฏผ์ค(Minjun Kim), mjkmain@seoultech.ac.kr
|
228 |
+
- ์ก์น์ฐ(Seungwoo Song), sswoo@seoultech.ac.kr
|
229 |
+
- ์ ๋์ฌ(Dongjae Shin), dylan1998@seoultech.ac.kr
|
230 |
+
- ์ํ์(Hyeonseok Lim), gustjrantk@seoultech.ac.kr
|
231 |
+
- ์ก์ ํ(Jeonghun Yuk), usually670@gmail.com
|
232 |
+
- ์ ํ๊ฒฐ(Hangyeol Yoo), 21102372@seoultech.ac.kr
|
233 |
+
- ์ก์ํ(Seohyun Song), alexalex225225@gmail.com
|