Skip to content

KU-HIAI/Ko-Gemma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

60ad3c8 ยท Feb 27, 2024

History

26 Commits
Feb 27, 2024
Feb 25, 2024
Feb 27, 2024
Feb 27, 2024

Repository files navigation

Ko-Gemma

Huggingface Huggingface

logo

Ko-Gemma: Korean Gemma ๐Ÿ‡ฐ๐Ÿ‡ท๐Ÿค–

| ํ•œ๊ตญ์–ด | English |

What's New

  • February 2024: [๐Ÿš€ Model Release ๐Ÿš€] We are excited to announce the release of our initial models for the Korean language processing community! Check them out:

Ko-Gemma

  • Gemma๋Š” Gemini ๋ชจ๋ธ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋œ ๋™์ผํ•œ ์—ฐ๊ตฌ์™€ ๊ธฐ์ˆ ๋กœ ๊ตฌ์ถ•๋œ ๊ฒฝ๋Ÿ‰ํ™”๋œ ์ตœ์‹  ๋Œ€๊ทœ๋ชจ ์–ธ์–ด๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.
  • Ko-Gemma๋Š” Google์˜ Gemma์— ์˜ํ•ด ๊ฐœ๋ฐœ๋œ ํ•œ๊ตญ์–ด ๋Œ€๊ทœ๋ชจ ์–ธ์–ด ๋ชจ๋ธ๋กœ, ๊ณ ๋ ค๋Œ€ํ•™๊ต NLP & AI LAB์™€ HIAI ์—ฐ๊ตฌ์†Œ๊ฐ€ ํ˜‘๋ ฅํ•˜์—ฌ KULLM ๋ฐ์ดํ„ฐ์…‹ ๋ฐ ์ˆ˜์ œ์ž‘ํ•œ ๋ฐ์ดํ„ฐ์…‹์„ ํ™œ์šฉํ•˜์—ฌ ํ•œ๊ตญ์–ด ์„ฑ๋Šฅ์„ ๋”์šฑ ํ–ฅ์ƒ์‹œํ‚จ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.
  • Ko-Gemma v1์€ chat_template๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•™์Šต๋˜์—ˆ์œผ๋ฏ€๋กœ, tokenizer.chat_template์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ƒ์„ฑ ๋˜๋Š” ํ‰๊ฐ€ ์ž‘์—…์—์„œ๋Š” ์„ฑ๋Šฅ์ด ํฌ๊ฒŒ ๋‚ฎ์•„์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์•ž์œผ๋กœ ์šฐ๋ฆฌ๋Š” ํ•œ๊ตญ์–ด ๋ฐ์ดํ„ฐ๋กœ ์‚ฌํ›„ ํ•™์Šต ๋ชจ๋ธ, ๋‹ค์–‘ํ•œ ํ•œ๊ตญ์–ด ์ง€์‹œ์–ด ๋ฐ์ดํ„ฐ์…‹์œผ๋กœ ํŠœ๋‹๋œ ๋ชจ๋ธ, ํ•œ๊ตญ์–ด์— ๋” ์ตœ์ ํ™”๋œ ์ „์ด ๋ชจ๋ธ์„ ์ถœ์‹œํ•  ๊ณ„ํš์ž…๋‹ˆ๋‹ค.

Quick start

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์— ๋Œ€ํ•œ LLM ์ถ”๋ก  ๊ฒฐ๊ณผ

ํ•œ๊ตญ์–ด ๊ท ํ˜• ํ‰๊ฐ€ ์ž‘์—…(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

License

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published