File size: 13,714 Bytes
96ed42b d07be75 826de2e 96ed42b c58a89d 2e03180 96ed42b f488a1a 8a738f9 f488a1a 072cdf8 96ed42b 5fdfd07 17ecd35 29b4912 6ca0c05 17ecd35 ae50909 17ecd35 ae50909 072cdf8 17ecd35 ae50909 17ecd35 4aff21d 96ed42b da41283 96ed42b 5988290 59c4c44 6138e69 684d079 6138e69 684d079 6138e69 b72a5ef 6138e69 684d079 6138e69 684d079 6138e69 b72a5ef 6138e69 59c4c44 f488a1a 17ecd35 96ed42b 252f3f9 96ed42b 17ecd35 96ed42b 8d38ba6 aa89f4d 96ed42b 36fdb96 96ed42b 359a3e9 aa89f4d 96ed42b 17ecd35 96ed42b 8d38ba6 aa89f4d 96ed42b f361a34 96ed42b 359a3e9 aa89f4d 96ed42b 4fd96f0 96ed42b fd84ee3 7ee6d92 fd84ee3 5da6e9e ce7071f d07be75 |
1 2 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
---
language:
- en
- ko
license: llama3
library_name: transformers
base_model:
- meta-llama/Meta-Llama-3-8B
---
<a href="https://github.com/MLP-Lab/Bllossom">
<img src="https://github.com/teddysum/bllossom/blob/main//bllossom_icon.png?raw=true" width="40%" height="50%">
</a>
# Update!
* [2024.06.18] μ¬μ νμ΅λμ **250GB**κΉμ§ λλ¦° Bllossom ELOλͺ¨λΈλ‘ μ
λ°μ΄νΈ λμμ΅λλ€. λ€λ§ λ¨μ΄νμ₯μ νμ§ μμμ΅λλ€. κΈ°μ‘΄ λ¨μ΄νμ₯λ long-context λͺ¨λΈμ νμ©νκ³ μΆμΌμ λΆμ κ°μΈμ°λ½μ£ΌμΈμ!
* [2024.06.18] Bllossom ELO λͺ¨λΈμ μ체 κ°λ°ν ELOμ¬μ νμ΅ κΈ°λ°μΌλ‘ μλ‘μ΄ νμ΅λ λͺ¨λΈμ
λλ€. [LogicKor](https://github.com/StableFluffy/LogicKor) λ²€μΉλ§ν¬ κ²°κ³Ό νμ‘΄νλ νκ΅μ΄ 10Bμ΄ν λͺ¨λΈμ€ SOTAμ μλ₯Ό λ°μμ΅λλ€.
LogicKor μ±λ₯ν :
| Model | Math | Reasoning | Writing | Coding | Understanding | Grammar | Single ALL | Multi ALL | Overall |
|:---------:|:-----:|:------:|:-----:|:-----:|:----:|:-----:|:-----:|:-----:|:----:|
| gpt-3.5-turbo-0125 | 7.14 | 7.71 | 8.28 | 5.85 | 9.71 | 6.28 | 7.50 | 7.95 | 7.72 |
| gemini-1.5-pro-preview-0215 | 8.00 | 7.85 | 8.14 | 7.71 | 8.42 | 7.28 | 7.90 | 6.26 | 7.08 |
| llama-3-Korean-Bllossom-8B | 5.43 | 8.29 | 9.0 | 4.43 | 7.57 | 6.86 | 6.93 | 6.93 | 6.93 |
# Bllossom | [Demo]() | [Homepage](https://www.bllossom.ai/) | [Github](https://github.com/MLP-Lab/Bllossom) |
<!-- [GPUμ© Colab μ½λμμ ](https://colab.research.google.com/drive/1fBOzUVZ6NRKk_ugeoTbAOokWKqSN47IG?usp=sharing) | -->
<!-- [CPUμ© Colab μμνλͺ¨λΈ μ½λμμ ](https://colab.research.google.com/drive/129ZNVg5R2NPghUEFHKF0BRdxsZxinQcJ?usp=drive_link) -->
```bash
μ ν¬ Bllossomν μμ νκ΅μ΄-μμ΄ μ΄μ€ μΈμ΄λͺ¨λΈμΈ Bllossomμ 곡κ°νμ΅λλ€!
μμΈκ³ΌκΈ°λ μνΌμ»΄ν¨ν
μΌν°μ μ§μμΌλ‘ 100GBκ°λλ νκ΅μ΄λ‘ λͺ¨λΈμ 체λ₯Ό ννλν νκ΅μ΄ κ°ν μ΄μ€μΈμ΄ λͺ¨λΈμ
λλ€!
νκ΅μ΄ μνλ λͺ¨λΈ μ°Ύκ³ μμ§ μμΌμ
¨λμ?
- νκ΅μ΄ μ΅μ΄! λ¬΄λ € 3λ§κ°κ° λλ νκ΅μ΄ μ΄ννμ₯
- Llama3λλΉ λλ΅ 25% λ κΈ΄ κΈΈμ΄μ νκ΅μ΄ Context μ²λ¦¬κ°λ₯
- νκ΅μ΄-μμ΄ Pararell Corpusλ₯Ό νμ©ν νκ΅μ΄-μμ΄ μ§μμ°κ²° (μ¬μ νμ΅)
- νκ΅μ΄ λ¬Έν, μΈμ΄λ₯Ό κ³ λ €ν΄ μΈμ΄νμκ° μ μν λ°μ΄ν°λ₯Ό νμ©ν λ―ΈμΈμ‘°μ
- κ°ννμ΅
μ΄ λͺ¨λ κ² νκΊΌλ²μ μ μ©λκ³ μμ
μ μ΄μ©μ΄ κ°λ₯ν Bllossomμ μ΄μ©ν΄ μ¬λ¬λΆ λ§μ λͺ¨λΈμ λ§λ€μ΄λ³΄μΈμ₯!
λ¬΄λ € Colab λ¬΄λ£ GPUλ‘ νμ΅μ΄ κ°λ₯ν©λλ€. νΉμ μμν λͺ¨λΈλ‘ CPUμμ¬λ €λ³΄μΈμ [μμνλͺ¨λΈ](https://huggingface.co/MLP-KTLim/llama-3-Korean-Bllossom-8B-4bit)
1. Bllossom-8Bλ μμΈκ³ΌκΈ°λ, ν
λμΈ, μ°μΈλ μΈμ΄μμ μ°κ΅¬μ€μ μΈμ΄νμμ νμ
ν΄ λ§λ μ€μ©μ£ΌμκΈ°λ° μΈμ΄λͺ¨λΈμ
λλ€! μμΌλ‘ μ§μμ μΈ μ
λ°μ΄νΈλ₯Ό ν΅ν΄ κ΄λ¦¬νκ² μ΅λλ€ λ§μ΄ νμ©ν΄μ£ΌμΈμ π
2. μ΄ κ°λ ₯ν Advanced-Bllossom 8B, 70Bλͺ¨λΈ, μκ°-μΈμ΄λͺ¨λΈμ 보μ νκ³ μμ΅λλ€! (κΆκΈνμ λΆμ κ°λ³ μ°λ½μ£ΌμΈμ!!)
3. Bllossomμ NAACL2024, LREC-COLING2024 (ꡬλ) λ°νλ‘ μ±νλμμ΅λλ€.
4. μ’μ μΈμ΄λͺ¨λΈ κ³μ μ
λ°μ΄νΈ νκ² μ΅λλ€!! νκ΅μ΄ κ°νλ₯Όμν΄ κ³΅λ μ°κ΅¬νμ€λΆ(νΉνλ
Όλ¬Έ) μΈμ λ νμν©λλ€!!
νΉν μλμ GPUλΌλ λμ¬ κ°λ₯ννμ μΈμ λ μ°λ½μ£ΌμΈμ! λ§λ€κ³ μΆμκ±° λμλλ €μ.
```
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:
* **Knowledge Linking**: Linking Korean and English knowledge through additional training
* **Vocabulary Expansion**: Expansion of Korean vocabulary to enhance Korean expressiveness.
* **Instruction Tuning**: Tuning using custom-made instruction following data specialized for Korean language and Korean culture
* **Human Feedback**: DPO has been applied
* **Vision-Language Alignment**: Aligning the vision transformer with this language model
**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)**
## Demo Video
<div style="display: flex; justify-content: space-between;">
<!-- 첫 λ²μ§Έ μ»¬λΌ -->
<div style="width: 49%;">
<a>
<img src="https://github.com/lhsstn/lhsstn/blob/main/x-llava_dem.gif?raw=true" style="width: 100%; height: auto;">
</a>
<p style="text-align: center;">Bllossom-V Demo</p>
</div>
<!-- λ λ²μ§Έ μ»¬λΌ (νμνλ€λ©΄) -->
<div style="width: 49%;">
<a>
<img src="https://github.com/lhsstn/lhsstn/blob/main/bllossom_demo_kakao.gif?raw=true" style="width: 70%; height: auto;">
</a>
<p style="text-align: center;">Bllossom Demo(Kakao)γ
€γ
€γ
€γ
€γ
€γ
€γ
€γ
€</p>
</div>
</div>
# NEWS
* [2024.06.18] We have reverted to the non-vocab-expansion model. However, we have significantly increased the amount of pre-training data to 250GB.
* [2024.05.08] Vocab Expansion Model Update
* [2024.04.25] We released Bllossom v2.0, based on llama-3
## Example code
### Colab Tutorial
- [Inference-Code-Link](https://colab.research.google.com/drive/1fBOzUVZ6NRKk_ugeoTbAOokWKqSN47IG?usp=sharing)
### Install Dependencies
```bash
pip install torch transformers==4.40.0 accelerate
```
### Python code with Pipeline
```python
import transformers
import torch
model_id = "MLP-KTLim/llama-3-Korean-Bllossom-8B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
pipeline.model.eval()
PROMPT = '''You are a helpful AI assistant. Please answer the user's questions kindly. λΉμ μ μ λ₯ν AI μ΄μμ€ν΄νΈ μ
λλ€. μ¬μ©μμ μ§λ¬Έμ λν΄ μΉμ νκ² λ΅λ³ν΄μ£ΌμΈμ.'''
instruction = "μμΈμ μ λͺ
ν κ΄κ΄ μ½μ€λ₯Ό λ§λ€μ΄μ€λ?"
messages = [
{"role": "system", "content": f"{PROMPT}"},
{"role": "user", "content": f"{instruction}"}
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9
)
print(outputs[0]["generated_text"][len(prompt):])
```
```
# λ¬Όλ‘ μ΄μ£ ! μμΈμ λ€μν λ¬Ένμ μμ¬, μμ°μ κ²ΈλΉν λμλ‘, λ§μ κ΄κ΄ λͺ
μλ₯Ό μλν©λλ€. μ¬κΈ° μμΈμ μ λͺ
ν κ΄κ΄ μ½μ€λ₯Ό μκ°ν΄ λ릴κ²μ.
### μ½μ€ 1: μμ¬μ λ¬Έν νλ°©
1. **경볡κΆ**
- μμΈμ λνμ μΈ κΆκΆλ‘, μ‘°μ μμ‘°μ μμ¬μ λ¬Ένλ₯Ό 체νν μ μλ κ³³μ
λλ€.
2. **λΆμ΄ νμ₯λ§μ**
- μ ν΅ νμ₯μ΄ μ 보쑴λ λ§μλ‘, μ‘°μ μλμ μνμμ λλ μ μμ΅λλ€.
3. **μΈμ¬λ**
- μ ν΅ λ¬Ένμ νλ μμ μ΄ κ³΅μ‘΄νλ 거리λ‘, λ€μν κ°€λ¬λ¦¬μ μ ν΅ μμμ μ΄ μμ΅λλ€.
4. **μ²κ³μ²**
- μμΈμ μ€μ¬μ μμΉν μ²λ¬ΈμΌλ‘, μ‘°κΉ
κ³Ό μ°μ±
μ μ¦κΈΈ μ μλ κ³³μ
λλ€.
### μ½μ€ 2: μμ°κ³Ό μΌν
1. **λ¨μ° μμΈνμ**
- μμΈμ μ κ²½μ νλμ λ³Ό μ μλ κ³³μΌλ‘, νΉν μ λ
μκ°λμ μΌλͺ°μ κ°μνλ κ²μ΄ μ’μ΅λλ€.
2. **λͺ
λ**
- μΌνκ³Ό μμμ μ΄ μ¦λΉν μ§μμΌλ‘, λ€μν λΈλλμ μ ν΅ μμμ λ§λ³Ό μ μμ΅λλ€.
3. **νκ°κ³΅μ**
- μμΈμ μ£Όμ 곡μ μ€ νλλ‘, μ‘°κΉ
, μμ κ±° νκΈ°, λ°°λ μ¬νμ μ¦κΈΈ μ μμ΅λλ€.
4. **νλ**
- μ μμ΄λ€μ΄ μ¦κ²¨ μ°Ύλ μ§μμΌλ‘, λ€μν μΉ΄ν, λ μ€ν λ, ν΄λ½μ΄ μμ΅λλ€.
### μ½μ€ 3: νλμ μ ν΅μ μ‘°ν
1. **λλλ¬Έ λμμΈ νλΌμ (DDP)**
- νλμ μΈ κ±΄μΆλ¬Όλ‘, λ€μν μ μμ μ΄λ²€νΈκ° μ΄λ¦¬λ κ³³μ
λλ€.
2. **μ΄νμ**
- λ€μν κ΅μ μμκ³Ό μΉ΄νκ° μλ μ§μμΌλ‘, λ€μν λ¬Ένλ₯Ό κ²½νν μ μμ΅λλ€.
3. **κ΄νλ¬Έ**
- μμΈμ μ€μ¬μ μμΉν κ΄μ₯μΌλ‘, λ€μν 곡μ°κ³Ό νμ¬κ° μ΄λ¦½λλ€.
4. **μμΈλλ**
- μμΈ μΈκ³½μ μμΉν ν
λ§νν¬λ‘, κ°μ‘±λ¨μ κ΄κ΄κ°λ€μκ² μΈκΈ° μλ κ³³μ
λλ€.
μ΄ μ½μ€λ€μ μμΈμ λ€μν λ©΄λͺ¨λ₯Ό κ²½νν μ μλλ‘ κ΅¬μ±λμ΄ μμ΅λλ€. κ° μ½μ€λ§λ€ μκ°μ μ‘°μ νκ³ , κ°μΈμ κ΄μ¬μ¬μ λ§κ² μ ννμ¬ λ°©λ¬Ένλ©΄ μ’μ κ² κ°μ΅λλ€. μ¦κ±°μ΄ μ¬ν λμΈμ!
```
### Python code with AutoModel
```python
import os
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = 'MLP-KTLim/llama-3-Korean-Bllossom-8B'
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
PROMPT = '''You are a helpful AI assistant. Please answer the user's questions kindly. λΉμ μ μ λ₯ν AI μ΄μμ€ν΄νΈ μ
λλ€. μ¬μ©μμ μ§λ¬Έμ λν΄ μΉμ νκ² λ΅λ³ν΄μ£ΌμΈμ.'''
instruction = "μμΈμ μ λͺ
ν κ΄κ΄ μ½μ€λ₯Ό λ§λ€μ΄μ€λ?"
messages = [
{"role": "system", "content": f"{PROMPT}"},
{"role": "user", "content": f"{instruction}"}
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = model.generate(
input_ids,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9
)
print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
```
```
# λ¬Όλ‘ μ΄μ£ ! μμΈμ λ€μν λ¬Ένμ μμ¬, μμ°μ κ²ΈλΉν λμλ‘, λ§μ κ΄κ΄ λͺ
μλ₯Ό μλν©λλ€. μ¬κΈ° μμΈμ μ λͺ
ν κ΄κ΄ μ½μ€λ₯Ό μκ°ν΄ λ릴κ²μ.
### μ½μ€ 1: μμ¬μ λ¬Έν νλ°©
1. **경볡κΆ**
- μμΈμ λνμ μΈ κΆκΆλ‘, μ‘°μ μμ‘°μ μμ¬μ λ¬Ένλ₯Ό 체νν μ μλ κ³³μ
λλ€.
2. **λΆμ΄ νμ₯λ§μ**
- μ ν΅ νμ₯μ΄ μ 보쑴λ λ§μλ‘, μ‘°μ μλμ μνμμ λλ μ μμ΅λλ€.
3. **μΈμ¬λ**
- μ ν΅ λ¬Ένμ νλ μμ μ΄ κ³΅μ‘΄νλ 거리λ‘, λ€μν κ°€λ¬λ¦¬μ μ ν΅ μμμ μ΄ μμ΅λλ€.
4. **μ²κ³μ²**
- μμΈμ μ€μ¬μ μμΉν μ²λ¬ΈμΌλ‘, μ‘°κΉ
κ³Ό μ°μ±
μ μ¦κΈΈ μ μλ κ³³μ
λλ€.
### μ½μ€ 2: μμ°κ³Ό μΌν
1. **λ¨μ° μμΈνμ**
- μμΈμ μ κ²½μ νλμ λ³Ό μ μλ κ³³μΌλ‘, νΉν μ λ
μκ°λμ μΌλͺ°μ κ°μνλ κ²μ΄ μ’μ΅λλ€.
2. **λͺ
λ**
- μΌνκ³Ό μμμ μ΄ μ¦λΉν μ§μμΌλ‘, λ€μν λΈλλμ μ ν΅ μμμ λ§λ³Ό μ μμ΅λλ€.
3. **νκ°κ³΅μ**
- μμΈμ μ£Όμ 곡μ μ€ νλλ‘, μ‘°κΉ
, μμ κ±° νκΈ°, λ°°λ μ¬νμ μ¦κΈΈ μ μμ΅λλ€.
4. **νλ**
- μ μμ΄λ€μ΄ μ¦κ²¨ μ°Ύλ μ§μμΌλ‘, λ€μν μΉ΄ν, λ μ€ν λ, ν΄λ½μ΄ μμ΅λλ€.
### μ½μ€ 3: νλμ μ ν΅μ μ‘°ν
1. **λλλ¬Έ λμμΈ νλΌμ (DDP)**
- νλμ μΈ κ±΄μΆλ¬Όλ‘, λ€μν μ μμ μ΄λ²€νΈκ° μ΄λ¦¬λ κ³³μ
λλ€.
2. **μ΄νμ**
- λ€μν κ΅μ μμκ³Ό μΉ΄νκ° μλ μ§μμΌλ‘, λ€μν λ¬Ένλ₯Ό κ²½νν μ μμ΅λλ€.
3. **κ΄νλ¬Έ**
- μμΈμ μ€μ¬μ μμΉν κ΄μ₯μΌλ‘, λ€μν 곡μ°κ³Ό νμ¬κ° μ΄λ¦½λλ€.
4. **μμΈλλ**
- μμΈ μΈκ³½μ μμΉν ν
λ§νν¬λ‘, κ°μ‘±λ¨μ κ΄κ΄κ°λ€μκ² μΈκΈ° μλ κ³³μ
λλ€.
μ΄ μ½μ€λ€μ μμΈμ λ€μν λ©΄λͺ¨λ₯Ό κ²½νν μ μλλ‘ κ΅¬μ±λμ΄ μμ΅λλ€. κ° μ½μ€λ§λ€ μκ°μ μ‘°μ νκ³ , κ°μΈμ κ΄μ¬μ¬μ λ§κ² μ ννμ¬ λ°©λ¬Ένλ©΄ μ’μ κ² κ°μ΅λλ€. μ¦κ±°μ΄ μ¬ν λμΈμ!
```
## Citation
**Language Model**
```text
@misc{bllossom,
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},
title = {Optimizing Language Augmentation for Multilingual Large Language Models: A Case Study on Korean},
year = {2024},
journal = {LREC-COLING 2024},
paperLink = {\url{https://arxiv.org/pdf/2403.10882}},
},
}
```
**Vision-Language Model**
```text
@misc{bllossom-V,
author = {Dongjae Shin, Hyunseok Lim, Inho Won, Changsu Choi, Minjun Kim, Seungwoo Song, Hangyeol Yoo, Sangmin Kim, Kyungtae Lim},
title = {X-LLaVA: Optimizing Bilingual Large Vision-Language Alignment},
year = {2024},
publisher = {GitHub},
journal = {NAACL 2024 findings},
paperLink = {\url{https://arxiv.org/pdf/2403.11399}},
},
}
```
## Contact
- μκ²½ν(KyungTae Lim), Professor at Seoultech. `[email protected]`
- ν¨μκ· (Younggyun Hahm), CEO of Teddysum. `[email protected]`
- κΉνμ(Hansaem Kim), Professor at Yonsei. `[email protected]`
## Contributor
- μ΅μ°½μ(Chansu Choi), [email protected]
- κΉμλ―Ό(Sangmin Kim), [email protected]
- μμΈνΈ(Inho Won), [email protected]
- κΉλ―Όμ€(Minjun Kim), [email protected]
- μ‘μΉμ°(Seungwoo Song), [email protected]
- μ λμ¬(Dongjae Shin), [email protected]
- μνμ(Hyeonseok Lim), [email protected]
- μ‘μ ν(Jeonghun Yuk), [email protected]
- μ νκ²°(Hangyeol Yoo), [email protected]
- μ‘μν(Seohyun Song), [email protected] |