Finetuned Models
Collection
6 items
β’
Updated
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 μμ²ν΄μ£ΌμΈμ.
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)
messages = [
{'content': 'λΉμ μ λ€μν μμ
μ λν νκ΅μ΄ μ§μΉ¨μ μ 곡νλλ‘ νλ ¨λ λ€κ΅μ΄ AI λͺ¨λΈμ
λλ€.', 'role': 'system'},
{'content': 'νκ΅μ μ ν΅ μμμ 무μμΈκ°μ?', 'role': 'user'}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, return_tensors="pt")
# text = '<s> [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 = '<s> [INST] λΉμ μ λ€μν μμ
μ λν νκ΅μ΄ μ§μΉ¨μ μ 곡νλλ‘ νλ ¨λ λ€κ΅μ΄ AI λͺ¨λΈμ
λλ€.\n\nνκ΅μ μ ν΅ μμμ 무μμΈκ°μ? [/INST] νκ΅μ μ ν΅ μμμ λ€μν μ§μκ³Ό κ³μ μ λ°λΌ λ€μν μ’
λ₯κ° μμ΅λλ€. λνμ μΈ μ ν΅ μμμ λ€μκ³Ό κ°μ΅λλ€.\n\n1. **λΉλΉλ°₯**: λΉλΉλ°₯μ λ€μν μ¬λ£λ₯Ό μμ΄ λ§λ λ°₯ μμ μλ
μ λΏλ € λ¨Ήλ μμμ
λλ€.\n2. **κΉμΉ**: κΉμΉλ νκ΅μ λνμ μΈ λ°ν¨ μν'
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 = '<s> [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 = '<s> [INST] λΉμ μ λ€μν μμ
μ λν νκ΅μ΄ μ§μΉ¨μ μ 곡νλλ‘ νλ ¨λ λ€κ΅μ΄ AI λͺ¨λΈμ
λλ€.\n\nνκ΅μ μ ν΅ μμμ 무μμΈκ°μ? [/INST] νκ΅μ μ ν΅ μμμ λ€μν μ§μκ³Ό κ³μ μ λ°λΌ λ€μν μ’
λ₯κ° μμ΅λλ€. λνμ μΈ μ ν΅ μμμ λ€μκ³Ό κ°μ΅λλ€.\n\n1. **λΉλΉλ°₯**: λΉλΉλ°₯μ λ€μν μ¬λ£λ₯Ό μμ΄ λ§λ λ°₯ μμ μλ
μ λΏλ € λ¨Ήλ μμμ
λλ€.\n2. **κΉμΉ**: κΉμΉλ νκ΅μ λνμ μΈ λ°ν¨ μν'
The content of this project, created by AGILESODA, is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).
@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: