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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. `[email protected]`
|
220 |
+
- ν¨μκ· (Younggyun Hahm), CEO of Teddysum. `[email protected]`
|
221 |
+
- κΉνμ(Hansaem Kim), Professor at Yonsei. `[email protected]`
|
222 |
+
|
223 |
+
## Contributor
|
224 |
+
- μ΅μ°½μ(Chansu Choi), [email protected]
|
225 |
+
- κΉμλ―Ό(Sangmin Kim), [email protected]
|
226 |
+
- μμΈνΈ(Inho Won), [email protected]
|
227 |
+
- κΉλ―Όμ€(Minjun Kim), [email protected]
|
228 |
+
- μ‘μΉμ°(Seungwoo Song), [email protected]
|
229 |
+
- μ λμ¬(Dongjae Shin), [email protected]
|
230 |
+
- μνμ(Hyeonseok Lim), [email protected]
|
231 |
+
- μ‘μ ν(Jeonghun Yuk), [email protected]
|
232 |
+
- μ νκ²°(Hangyeol Yoo), [email protected]
|
233 |
+
- μ‘μν(Seohyun Song), [email protected]
|