- February 2024: [๐ Model Release ๐] We are excited to announce the release of our initial models for the Korean language processing community! Check them out:
- Gemma๋ Gemini ๋ชจ๋ธ์ ๋ง๋ค๊ธฐ ์ํด ์ฌ์ฉ๋ ๋์ผํ ์ฐ๊ตฌ์ ๊ธฐ์ ๋ก ๊ตฌ์ถ๋ ๊ฒฝ๋ํ๋ ์ต์ ๋๊ท๋ชจ ์ธ์ด๋ชจ๋ธ์ ๋๋ค.
- Ko-Gemma๋ Google์ Gemma์ ์ํด ๊ฐ๋ฐ๋ ํ๊ตญ์ด ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ๋ก, ๊ณ ๋ ค๋ํ๊ต NLP & AI LAB์ HIAI ์ฐ๊ตฌ์๊ฐ ํ๋ ฅํ์ฌ KULLM ๋ฐ์ดํฐ์ ๋ฐ ์์ ์ํ ๋ฐ์ดํฐ์ ์ ํ์ฉํ์ฌ ํ๊ตญ์ด ์ฑ๋ฅ์ ๋์ฑ ํฅ์์ํจ ๋ฒ์ ์ ๋๋ค.
- Ko-Gemma v1์
chat_template
๋ง์ ์ฌ์ฉํ์ฌ ํ์ต๋์์ผ๋ฏ๋ก,tokenizer.chat_template
์ ์ฌ์ฉํ์ง ์๋ ์์ฑ ๋๋ ํ๊ฐ ์์ ์์๋ ์ฑ๋ฅ์ด ํฌ๊ฒ ๋ฎ์์ง ์ ์์ต๋๋ค. - ์์ผ๋ก ์ฐ๋ฆฌ๋ ํ๊ตญ์ด ๋ฐ์ดํฐ๋ก ์ฌํ ํ์ต ๋ชจ๋ธ, ๋ค์ํ ํ๊ตญ์ด ์ง์์ด ๋ฐ์ดํฐ์ ์ผ๋ก ํ๋๋ ๋ชจ๋ธ, ํ๊ตญ์ด์ ๋ ์ต์ ํ๋ ์ ์ด ๋ชจ๋ธ์ ์ถ์ํ ๊ณํ์ ๋๋ค.
from transformers import AutoTokenizer, pipeline
import torch
model_and_tokenizer_path = "nlpai-lab/ko-gemma-7b-v1"
tokenizer = AutoTokenizer.from_pretrained(model_and_tokenizer_path)
pipeline = pipeline(
"text-generation",
model=model_and_tokenizer_path,
tokenizer=tokenizer,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
tokenizer = AutoTokenizer.from_pretrained(model_and_tokenizer_path)
messages = [
{"role": "user",
"content": "์ด์์ ์ฅ๊ตฐ์ ๋ํด ์ค๋ช
ํด์ฃผ์ธ์."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) # Don't use `pipeline.tokenizer`
print(prompt) # <bos><start_of_turn>user\n์ด์์ ์ฅ๊ตฐ์ ๋ํด ์ค๋ช
ํด์ฃผ์ธ์.<end_of_turn>\n<start_of_turn>model\n
outputs = pipeline(
prompt,
max_new_tokens=4096,
add_special_tokens=True
)
print(outputs[0]["generated_text"][len(prompt):]) # '์ด์์ ์ฅ๊ตฐ์ ์กฐ์ ์๋์ ๋ํ์ ์ธ ๊ตฐ์ฌ ์ง๋์์ด์ ์ ๋ต๊ฐ์
๋๋ค. ๊ทธ๋ ์กฐ์ ์๋์ ์๋์ธ ํ์์์ ํ์ด๋ฌ์ผ๋ฉฐ, ์กฐ์ ์๋ ๊ตฐ๋์์ ๋ค์ํ ์ง๋์๋ก ํ๋ํ์ต๋๋ค.\n\n์ด์์ ์ฅ๊ตฐ์ ๊ฐ์ฅ ์ฃผ๋ชฉํ ๋งํ ์
์ ์ค ํ๋๋ 1592๋
๋ถํฐ 1598๋
๊น์ง ์ผ๋ณธ์ด ์กฐ์ ์ ์นจ๊ณตํ ์ผ๋ณธ ์ ์์์์ ํ๋์
๋๋ค. ์ด ์ ์์์ ์ด์์ ์ฅ๊ตฐ์ ์กฐ์ ๊ตฐ๋์ ์ ๋ต์ ์ธ ์ง๋์๋ก ํ๋ํ๋ฉฐ ์ผ๋ณธ์ ์นจ๋ต์ ์ ํญํ๋ ๋ฐ ํฐ ์ญํ ์ ํ์ต๋๋ค.\n\n์ด์์ ์ฅ๊ตฐ์ ์ ํฌ์์์ ์ฉ๊ธฐ์ ์ ์ ์ ์ง์ฑ์ผ๋ก ์ ๋ช
ํ์ต๋๋ค. ๊ทธ๋ ์ ํฌ์์ ์ ์ ์ ์ธ ์ฌ๊ณ ๋ฅผ ๋ฐํํ๊ณ ์ ์ ์ฝ์ ์ ๊ณต๊ฒฉํ๋ ๊ฒ์ผ๋ก ์ ๋ช
ํ์ต๋๋ค. ๋ํ ๊ทธ๋ ์กฐ์ ๊ตฐ๋์ ์ ๋ ฅ์ ๊ณ ์ทจํ๊ณ ์ ํฌ์์ ์น๋ฆฌํ๋ ๋ฐ ๋์์ด ๋๋ ์ฐ์ค๊ณผ ๊ฒฉ๋ ค์ ๋ง์ ์ ํ๋ ๊ฒ์ผ๋ก๋ ์ ๋ช
ํ์ต๋๋ค.\n\n์ด์์ ์ฅ๊ตฐ์ ์ ์์ด ๋๋ ํ์๋ ์กฐ์ ๊ตฐ๋์์ ๊ณ์ ํ๋ํ๋ฉฐ ์กฐ์ ๊ตฐ๋์ ์ง๋์๋ก ํ๋ํ์ต๋๋ค. ๊ทธ๋ ์กฐ์ ๊ตฐ๋์ ์ ๋ ฅ์ ์ ์งํ๊ณ ์กฐ์ ์ ์๋ณด๋ฅผ ์งํค๋ ๋ฐ ํฐ ์ญํ ์ ํ์ต๋๋ค.\n\n์ด์์ ์ฅ๊ตฐ์ ์กฐ์ ์๋์ ๋ํ์ ์ธ ๊ตฐ์ฌ ์ง๋์์ด์ ์ ๋ต๊ฐ๋ก ๊ธฐ์ต๋๊ณ ์์ต๋๋ค. ๊ทธ์ ์ฉ๊ธฐ์ ์ ์ ์ ์ง์ฑ, ๊ทธ๋ฆฌ๊ณ ์กฐ์ ๊ตฐ๋์ ์ ๋ ฅ์ ์ ์งํ๋ ๋ฐ ๊ธฐ์ฌํ ๊ณต๋ก๋ ๊ทธ๋ฅผ ์ ์ค์ ์ธ ์ธ๋ฌผ๋ก ๋ง๋ค์์ต๋๋ค.'
ํ๊ตญ์ด ๊ท ํ ํ๊ฐ ์์ (KoBEST: Korean Balanced Evaluation of Significant Task, M.Jang et. al)์ ๋ํด 5-shot์ผ๋ก ํ๊ฐ๋ ๊ฒฐ๊ณผ์ ๋๋ค.
Model | WIC Acc | WIC F1 | Sentineg Acc | Sentineg F1 | Hellaswag Acc | Hellaswag F1 | COPA Acc | BoolQ Acc | BoolQ F1 | Avg F1 | Avg F1 (Excl. Sentineg, WIC) |
---|---|---|---|---|---|---|---|---|---|---|---|
google/gemma-2b-it | 0.528 | 0.520 | 0.655 | 0.631 | 0.35 | 0.347 | 0.42 | 0.526 | 0.525 | 0.536 | 0.510 |
google/gemma-7b-it | 0.508 | 0.506 | 0.736 | 0.722 | 0.352 | 0.349 | 0.42 | 0.544 | 0.543 | 0.573 | 0.545 |
nlpai-lab/ko-gemma-2b-v1 | 0.521 | 0.420 | 0.587 | 0.517 | 0.354 | 0.350 | 0.456 | 0.595 | 0.594 | 0.506 | 0.532 |
nlpai-lab/ko-gemma-7b-v1 | 0.563 | 0.542 | 0.788 | 0.780 | 0.39 | 0.388 | 0.488 | 0.639 | 0.638 | 0.629 | 0.608 |
- ํ๊ฐ๋ lm-evaluation-harness๋ฅผ ์ฌ์ฉํ์ต๋๋ค. add_bos_token ์ต์ ์ ์ ์ฉํ์ฌ ํ๊ฐํ์ต๋๋ค.
License Copyright 2024 DeepMind Technologies Limited
This code is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.