--- library_name: transformers license: llama3 language: - ko - en pipeline_tag: text-generation --- # davidkim205/ko-gemma-2-9b-it davidkim205/ko-gemma-2-9b-it is one of several models being researched to improve the performance of Korean language models. (would be released soon) ## Model Details * **Model Developers** : davidkim(changyeon kim) * **Repository** : - * **base mode** : google/gemma-2-9b-it * **sft dataset** : qa_ability_1851.jsonl ## Usage ### Chat Template ``` from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig model_id = "davidkim205/ko-gemma-2-9b-it" quantization_config = BitsAndBytesConfig(load_in_4bit=True) tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained( model_id, quantization_config=quantization_config) chat = [ { "role": "system", "content":"당신은 질문에 대해서 자세히 설명하는 AI입니다."}, { "role": "user", "content": "딥러닝을 어떻게 공부해야하나요?" }, ] prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True) inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt") outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=1024) print(tokenizer.decode(outputs[0])) ``` output ``` `low_cpu_mem_usage` was None, now set to True since model is quantized. Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:04<00:00, 1.04s/it] /home/david/anaconda3/envs/eval/lib/python3.10/site-packages/bitsandbytes/nn/modules.py:426: UserWarning: Input type into Linear4bit is torch.float16, but bnb_4bit_compute_dtype=torch.float32 (default). This will lead to slow inference or training speed. warnings.warn( 당신은 질문에 대해서 자세히 설명하는 AI입니다.user 딥러닝을 어떻게 공부해야하나요? model 딥러닝을 공부하는 것은 흥미롭고 보람 있는 여정이 될 수 있습니다! 하지만 어디서부터 시작해야 할지 막막하게 느껴질 수도 있습니다. 다음은 딥러닝을 공부하기 위한 단계별 가이드입니다. **1단계: 기초 다지기** * **수학**: 딥러닝의 기반이 되는 선형대수, 미적분, 확률 및 통계에 대한 기본 지식이 필요합니다. Khan Academy, Coursera 등 온라인 플랫폼에서 수학 강좌를 듣는 것을 추천합니다. * **프로그래밍**: Python은 딥러닝 분야에서 가장 널리 사용되는 프로그래밍 언어입니다. Python 기초 문법, 데이터 구조, 함수 등을 익히세요. Codecademy, Google's Python Class 등의 플랫폼에서 Python을 배울 수 있습니다. * **기본 머신러닝**: 딥러닝을 이해하기 전에 기본적인 머신러닝 개념을 익히는 것이 중요합니다. * 분류, 회귀, 클러스터링 등의 머신러닝 알고리즘을 이해하고, Scikit-learn 라이브러리를 활용하여 실습을 해보세요. **2단계: 딥러닝 개념 학습** * **온라인 강좌**: Coursera, edX, Udacity 등의 플랫폼에서 제공하는 딥러닝 강좌를 수강하세요. Andrew Ng의 Deep Learning Specialization은 딥러닝 분야의 기본 개념을 탄탄하게 다지는 데 좋은 선택입니다. * **책**: 딥러닝에 대한 이해를 심화시키기 위해 책을 읽는 것도 좋은 방법입니다. * "Deep Learning" (Ian Goodfellow, Yoshua Bengio, Aaron Courville)은 딥러닝 분야의 전문가를 위한 심도 있는 책입니다. * "Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow" (Aurélien Géron)은 실습 중심으로 딥러닝을 배우고 싶은 사람에게 적합합니다. * **블로그 및 기사**: 딥러닝 관련 최신 트렌드와 연구 동향을 파악하기 위해 블로그 및 기사를 읽는 것이 좋습니다. **3단계: 실습 및 프로젝트 진행** * **데이터셋**: Kaggle, UCI Machine Learning Repository 등의 플랫폼에서 다양한 데이터셋을 찾아 실습할 수 있습니다. * **라이브러리**: TensorFlow, PyTorch, Keras 등의 딥러닝 라이브러리를 활용하여 모델을 구축하고 훈련하세요. * **프로젝트**: 딥러닝 기술을 적용하여 실제 문제를 해결하는 프로젝트를 진행하는 것이 중요합니다. * 이미지 분류, 자연어 처리, 예측 모델 개발 등 다양한 프로젝트를 통해 딥러닝 실력을 향상시킬 수 있습니다. **추가 팁** * **커뮤니티 활동**: 딥러닝 관련 커뮤니티에 참여하여 다른 사람들과 교류하고 질문을 해보세요. * **꾸준함**: 딥러닝은 복잡한 분야이므로 꾸준히 공부하고 실습하는 것이 중요합니다. ``` ## Benchmark ### kollm_evaluation https://github.com/davidkim205/kollm_evaluation | Tasks |Version|Filter|n-shot| Metric |Value | |Stderr| |-------------------|-------|------|-----:|--------|-----:|---|------| |kobest |N/A |none | 0|acc |0.5150|± |0.0073| | | |none | 0|f1 |0.4494|± |N/A | | - kobest_boolq | 1|none | 0|acc |0.6154|± |0.0130| | | |none | 0|f1 |0.5595|± |N/A | | - kobest_copa | 1|none | 0|acc |0.4710|± |0.0158| | | |none | 0|f1 |0.4700|± |N/A | | - kobest_hellaswag| 1|none | 0|acc |0.3880|± |0.0218| | | |none | 0|f1 |0.3832|± |N/A | | | |none | 0|acc_norm|0.4780|± |0.0224| | - kobest_sentineg | 1|none | 0|acc |0.5189|± |0.0251| | | |none | 0|f1 |0.4773|± |N/A | | - kobest_wic | 1|none | 0|acc |0.4873|± |0.0141| | | |none | 0|f1 |0.3276|± |N/A | |ko_truthfulqa | 2|none | 0|acc |0.3390|± |0.0166| |ko_mmlu | 1|none | 0|acc |0.1469|± |0.0019| | | |none | 0|acc_norm|0.1469|± |0.0019| |ko_hellaswag | 1|none | 0|acc |0.2955|± |0.0046| | | |none | 0|acc_norm|0.3535|± |0.0048| |ko_common_gen | 1|none | 0|acc |0.5825|± |0.0126| | | |none | 0|acc_norm|0.5825|± |0.0126| |ko_arc_easy | 1|none | 0|acc |0.2329|± |0.0124| | | |none | 0|acc_norm|0.2867|± |0.0132| ### Evaluation of KEval keval is an evaluation model that learned the prompt and dataset used in the benchmark for evaluating Korean language models among various methods of evaluating models with chatgpt to compensate for the shortcomings of the existing lm-evaluation-harness. https://huggingface.co/davidkim205/keval-7b | model | ned | exe_time | evalscore | count | |:-----------------------------------------------------------------------------------------|------:|-----------:|------------:|--------:| | claude-3-opus-20240229 | nan | nan | 8.79 | 42 | | gpt-4-turbo-2024-04-09 | nan | nan | 8.71 | 42 | | Qwen2-72B-Instruct | nan | 29850.5 | 7.85 | 42 | | WizardLM-2-8x22B | nan | 133831 | 7.57 | 42 | | ***ko-gemma-2-9b-it*** | nan | 30789.5 | 7.52 | 42 | | HyperClovaX | nan | nan | 7.44 | 42 | | gemma-2-9b-it | nan | 23531.7 | 7.4 | 42 | | glm-4-9b-chat | nan | 24825.6 | 7.31 | 42 | | Ko-Llama-3-8B-Instruct | nan | 10697.5 | 6.81 | 42 | | Qwen2-7B-Instruct | nan | 11856.3 | 6.02 | 42 | | Not-WizardLM-2-7B | nan | 12955.7 | 5.26 | 42 | | gemma-1.1-7b-it | nan | 6950.5 | 4.99 | 42 | | Mistral-7B-Instruct-v0.3 | nan | 19631.4 | 4.89 | 42 | | Phi-3-small-128k-instruct | nan | 26747.5 | 3.52 | 42 |