--- license: cc-by-nc-4.0 language: - ko base_model: - TwinDoc/RedWhale-tv-10.8B-v1.0 pipeline_tag: text-generation library_name: transformers --- # Model Card for RedWhale-tv-10.8B-ipt-v0.1 ## Model Description The **RedWhale-tv-10.8B-ipt-v0.1** is an **Instruction Pre-Trained (IPT)** version of the **RedWhale-tv-10.8B-v1.0**, created through continual training for 5000 steps using 80,000 single-turn synthetic instruction data points (not multi-turn). The training was performed on a single NVIDIA A5000 24GB GPU using the Low-Rank Adaptation (LoRA) method. Multi-turn instruction data will be explored in future iterations. The model 사용을 원하시면 repo access 요청해주세요. ## About the Model - **Name:** [TwinDoc/RedWhale-tv-10.8B-ipt-v0.1](https://huggingface.co/TwinDoc/RedWhale-tv-10.8B-ipt-v0.1) - **Foundation Model:** [TwinDoc/RedWhale-tv-10.8B-v1.0](https://huggingface.co/TwinDoc/RedWhale-tv-10.8B-v1.0) - **Train Corpus:** [TwinDoc/synthetic-dataset-sft-alpaca-KGID-v0](https://huggingface.co/datasets/TwinDoc/synthetic-dataset-sft-alpaca-KGID-v0) - **Developed by:** 애자일소다 (AGILESODA) - **Model type:** mistral - **Language(s) (NLP):** 한국어 - **License:** cc-by-nc-sa-4.0 - **Paper:** [RedWhale: An Adapted Korean LLM Through Efficient Continual Pretraining ](https://arxiv.org/abs/2408.11294) ## Load the Model ``` from transformers import AutoTokenizer from transformers import AutoModelForCausalLM YOUR_HF_TOKEN_READ = "hf_..." model_name_or_path = "TwinDoc/RedWhale-tv-10.8B-ipt-v0.1" tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, token=YOUR_HF_TOKEN_READ) model = AutoModelForCausalLM.from_pretrained(model_name_or_path, token=YOUR_HF_TOKEN_READ) ``` ## Generate Text ``` messages = [ {'content': '당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.', 'role': 'system'}, {'content': '한국의 전통 음식은 무엇인가요?', 'role': 'user'} ] text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, return_tensors="pt") # text = ' [INST] 당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.\n\n한국의 전통 음식은 무엇인가요? [/INST]' encodings = tokenizer(text, return_tensors='pt') terminators = [tokenizer.eos_token_id] max_new_tokens = 64 outputs = model.generate(**encodings, eos_token_id=terminators, max_new_tokens=max_new_tokens) generated_text = tokenizer.batch_decode(outputs)[0] # generated_text = ' [INST] 당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.\n\n한국의 전통 음식은 무엇인가요? [/INST] 한국의 전통 음식은 다양한 지역과 계절에 따라 다양한 종류가 있습니다. 대표적인 전통 음식은 다음과 같습니다.\n\n1. **비빔밥**: 비빔밥은 다양한 재료를 섞어 만든 밥 위에 양념을 뿌려 먹는 음식입니다.\n2. **김치**: 김치는 한국의 대표적인 발효 식품' ``` ## Generate Streaming Text ``` from transformers import TextStreamer text_streamer = TextStreamer(tokenizer) messages = [ {'content': '당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.', 'role': 'system'}, {'content': '한국의 전통 음식은 무엇인가요?', 'role': 'user'} ] text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, return_tensors="pt") # text = ' [INST] 당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.\n\n한국의 전통 음식은 무엇인가요? [/INST]' encodings = tokenizer(text, return_tensors='pt') terminators = [tokenizer.eos_token_id] max_new_tokens = 64 outputs = model.generate(**encodings, eos_token_id=terminators, max_new_tokens=max_new_tokens) generated_text = model.generate(**encodings, streamer = text_streamer, max_new_tokens = max_new_tokens) # generated_text = ' [INST] 당신은 다양한 작업에 대한 한국어 지침을 제공하도록 훈련된 다국어 AI 모델입니다.\n\n한국의 전통 음식은 무엇인가요? [/INST] 한국의 전통 음식은 다양한 지역과 계절에 따라 다양한 종류가 있습니다. 대표적인 전통 음식은 다음과 같습니다.\n\n1. **비빔밥**: 비빔밥은 다양한 재료를 섞어 만든 밥 위에 양념을 뿌려 먹는 음식입니다.\n2. **김치**: 김치는 한국의 대표적인 발효 식품' ``` ## License The content of this project, created by AGILESODA, is licensed under the [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/). ## Citation ``` @misc{vo2024redwhaleadaptedkoreanllm, title={RedWhale: An Adapted Korean LLM Through Efficient Continual Pretraining}, author={Anh-Dung Vo and Minseong Jung and Wonbeen Lee and Daewoo Choi}, year={2024}, eprint={2408.11294}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2408.11294}, } ``` **Built with:** AgileSoda TwinDoc Icon