jujbob commited on
Commit
96ed42b
β€’
1 Parent(s): d8ea992

Create README.md

Browse files

The first commit! good luck!!

Files changed (1) hide show
  1. README.md +173 -0
README.md ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ---
4
+ library_name: transformers
5
+ license: apache-2.0
6
+ language:
7
+ - en
8
+ - ko
9
+ base_model:
10
+ - meta-llama/Meta-Llama-3-8B
11
+ ---
12
+
13
+ <a href="https://github.com//KULLM">
14
+ <img src="./bllossom_icon.png" width="40%" height="40%">
15
+ </a>
16
+
17
+
18
+ # Bllossom | [Demo](https://c537bba37aaab5fc9e.gradio.live) | [Homepage](https://www.bllossom.ai/) |
19
+
20
+ 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:
21
+
22
+ * **Knowledge Linking**: Linking Korean and English knowledge through additional training
23
+ * **Vocabulary Expansion**: Expansion of Korean vocabulary to enhance Korean expressiveness.
24
+ * **Instruction Tuning**: Tuning using custom-made instruction following data specialized for Korean language and Korean culture
25
+ * **Human Feedback**: DPO has been applied
26
+ * **Vision-Language Alignment**: Aligning the vision transformer with this language model
27
+
28
+ **This model devel by [MLPLab at Seoultech](http://mlp.seoultech.ac.kr), [Teddysum](http://teddysum.ai/) and [Yonsei Univ](https://sites.google.com/view/hansaemkim/hansaem-kim)**
29
+
30
+ ## NEWS
31
+ * [2024/04] We released Bllossom v2.0, based on llama-3
32
+ * [2023/12] We released Bllossom-Vision v1.0, based on Bllossom
33
+ * [2023/08] We released Bllossom v1.0, based on llama-2.
34
+ * [2023/07] We released Bllossom v0.7, based on polyglot-ko.
35
+
36
+
37
+ ## Example code
38
+ ### Install Dependencies
39
+ ```bash
40
+ pip install torch transformers==4.40.0 accelerate
41
+ ```
42
+
43
+ ### Python code with Pipeline
44
+ ```python
45
+ import transformers
46
+ import torch
47
+
48
+ model_id = "MLP-KTLim/Bllossom"
49
+
50
+ pipeline = transformers.pipeline(
51
+ "text-generation",
52
+ model=model_id,
53
+ model_kwargs={"torch_dtype": torch.bfloat16},
54
+ device_map="auto",
55
+ )
56
+
57
+ pipeline.model.eval()
58
+
59
+ PROMPT = '''당신은 μœ μš©ν•œ AI μ–΄μ‹œμŠ€ν„΄νŠΈμž…λ‹ˆλ‹€. μ‚¬μš©μžμ˜ μ§ˆμ˜μ— λŒ€ν•΄ μΉœμ ˆν•˜κ³  μ •ν™•ν•˜κ²Œ λ‹΅λ³€ν•΄μ•Ό ν•©λ‹ˆλ‹€.'''
60
+ instruction = "μ„œμšΈκ³Όν•™κΈ°μˆ λŒ€ν•™κ΅ MLP연ꡬ싀에 λŒ€ν•΄ μ†Œκ°œν•΄μ€˜"
61
+
62
+ messages = [
63
+ {"role": "system", "content": f"{PROMPT}"},
64
+ {"role": "user", "content": f"{instruction}"}
65
+ ]
66
+
67
+ prompt = pipeline.tokenizer.apply_chat_template(
68
+ messages,
69
+ tokenize=False,
70
+ add_generation_prompt=True
71
+ )
72
+
73
+ terminators = [
74
+ pipeline.tokenizer.eos_token_id,
75
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
76
+ ]
77
+
78
+ outputs = pipeline(
79
+ prompt,
80
+ max_new_tokens=2048,
81
+ eos_token_id=terminators,
82
+ do_sample=True,
83
+ temperature=0.6,
84
+ top_p=0.9,
85
+ )
86
+
87
+ print(outputs[0]["generated_text"][len(prompt):])
88
+
89
+ # μ„œμšΈκ³Όν•™κΈ°μˆ λŒ€ν•™κ΅ MLP연ꡬ싀은 λ©€ν‹°λͺ¨λ‹¬ μžμ—°μ–΄μ²˜λ¦¬ 연ꡬλ₯Ό ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. ꡬ성원은 μž„κ²½νƒœ κ΅μˆ˜μ™€ κΉ€λ―Όμ€€, 김상민, 졜창수, μ›μΈν˜Έ, μœ ν•œκ²°, μž„ν˜„μ„, μ†‘μŠΉμš°, μœ‘μ •ν›ˆ, μ‹ λ™μž¬ 학생이 μžˆμŠ΅λ‹ˆλ‹€.
90
+ ```
91
+
92
+ ### Python code with AutoModel
93
+ ```python
94
+
95
+ import os
96
+ import torch
97
+ from transformers import AutoTokenizer, AutoModelForCausalLM
98
+
99
+ model_id = 'MLP-KTLim/Bllossom'
100
+
101
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
102
+ model = AutoModelForCausalLM.from_pretrained(
103
+ model_id,
104
+ torch_dtype=torch.bfloat16,
105
+ device_map="auto",
106
+ )
107
+
108
+ model.eval()
109
+
110
+ PROMPT = '''당신은 μœ μš©ν•œ AI μ–΄μ‹œμŠ€ν„΄νŠΈμž…λ‹ˆλ‹€. μ‚¬μš©μžμ˜ μ§ˆμ˜μ— λŒ€ν•΄ μΉœμ ˆν•˜κ³  μ •ν™•ν•˜κ²Œ λ‹΅λ³€ν•΄μ•Ό ν•©λ‹ˆλ‹€.'''
111
+ instruction = "μ„œμšΈκ³Όν•™κΈ°μˆ λŒ€ν•™κ΅ MLP연ꡬ싀에 λŒ€ν•΄ μ†Œκ°œν•΄μ€˜"
112
+
113
+ messages = [
114
+ {"role": "system", "content": f"{PROMPT}"},
115
+ {"role": "user", "content": f"{instruction}"}
116
+ ]
117
+
118
+ input_ids = tokenizer.apply_chat_template(
119
+ messages,
120
+ add_generation_prompt=True,
121
+ return_tensors="pt"
122
+ ).to(model.device)
123
+
124
+ terminators = [
125
+ tokenizer.eos_token_id,
126
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
127
+ ]
128
+
129
+ outputs = model.generate(
130
+ input_ids,
131
+ max_new_tokens=2048,
132
+ eos_token_id=terminators,
133
+ do_sample=True,
134
+ temperature=0.6,
135
+ top_p=0.9,
136
+ repetition_penalty = 1.1
137
+ )
138
+
139
+ print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
140
+ # μ„œμšΈκ³Όν•™κΈ°μˆ λŒ€ν•™κ΅ MLP연ꡬ싀은 λ©€ν‹°λͺ¨λ‹¬ μžμ—°μ–΄μ²˜λ¦¬ 연ꡬλ₯Ό ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. ꡬ성원은 μž„κ²½νƒœ κ΅μˆ˜μ™€ κΉ€λ―Όμ€€, 김상민, 졜창수, μ›μΈν˜Έ, μœ ν•œκ²°, μž„ν˜„μ„, μ†‘μŠΉμš°, μœ‘μ •ν›ˆ, μ‹ λ™μž¬ 학생이 μžˆμŠ΅λ‹ˆλ‹€.
141
+ ```
142
+
143
+
144
+
145
+ ## Citation
146
+ **Language Model**
147
+ ```text
148
+ @misc{bllossom,
149
+ 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},
150
+ title = {Optimizing Language Augmentation for Multilingual Large Language Models: A Case Study on Korean},
151
+ year = {2024},
152
+ journal = {LREC-COLING 2024},
153
+ paperLink = {\url{https://arxiv.org/pdf/2403.10882}},
154
+ },
155
+ }
156
+ ```
157
+
158
+ **Vision-Language Model**
159
+ ```text
160
+ @misc{bllossom,
161
+ author = {Dongjae Shin, Hyunseok Lim, Inho Won, Changsu Choi, Minjun Kim, Seungwoo Song, Hangyeol Yoo, Sangmin Kim, Kyungtae Lim},
162
+ title = {X-LLaVA: Optimizing Bilingual Large Vision-Language Alignment},
163
+ year = {2024},
164
+ publisher = {GitHub},
165
+ journal = {NAACL 2024 findings},
166
+ paperLink = {\url{https://arxiv.org/pdf/2403.11399}},
167
+ },
168
+ }
169
+ ```
170
+
171
+ ## Contact
172
+ - μž„κ²½νƒœ(KyungTae Lim), Professor at Seoultech. `[email protected]`
173
+ - ν•¨μ˜κ· (Younggyun Hahm), CEO of Teddysum. `[email protected]`