File size: 5,123 Bytes
e6dcf26 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
---
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
<img src="https://huggingface.co/TwinDoc/RedWhale-tv-10.8B-v1.0/resolve/main/company_agilesoda__icon_RWTV.png" width="648">
## 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**.
The model μ¬μ©μ μνμλ©΄ repo access μμ²ν΄μ£ΌμΈμ.
## About the Model
- **Name:** TwinDoc/RedWhale-tv-10.8B-ipt-v0.1
- **Foundation Model:** RedWhale-tv-10.8B-v1.0
- **Train Corpus:** being updated
- **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 = '<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. **κΉμΉ**: κΉμΉλ νκ΅μ λνμ μΈ λ°ν¨ μν'
```
## 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 = '<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. **κΉμΉ**: κΉμΉλ νκ΅μ λνμ μΈ λ°ν¨ μν'
```
## License
<img src="https://huggingface.co/TwinDoc/RedWhale-tv-10.8B-v1.0/resolve/main/license__icon.png" width="324">
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:**
<a href="http://www.agilesoda.com/sub/twin_doc.php">
<img src="https://huggingface.co/TwinDoc/RedWhale-tv-10.8B-v1.0/resolve/main/company_agilesoda_twindoc__icon.png" alt="AgileSoda TwinDoc Icon">
</a> |