Run this model with HF Jobs
Run a2ran/GPTeacher-llama2-ko-13b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/a2ran/GPTeacher-llama2-ko-13b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/a2ran/GPTeacher-llama2-ko-13b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use a2ran/GPTeacher-llama2-ko-13b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use a2ran/GPTeacher-llama2-ko-13b with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TheBloke/WizardLM-13B-V1.2-GPTQ") model = PeftModel.from_pretrained(base_model, "a2ran/GPTeacher-llama2-ko-13b") - Notebooks
- Google Colab
- Kaggle
About GPTeacher
GPTeacher๋ ๋ก๋ด(Bot)์ด ์ถ๋ ฅํ๋ ๋ฏํ ๊ธฐ์กด LLM ๋ชจ๋ธ์ ์ถ๋ ฅ๊ฐ์, ๊ฐ์์๊ฐ ์ค์ ๋ก ํด๋น ๋ด์ฉ์ ๋ํด ๊ฐ์ํ๋ ๊ฒ์ฒ๋ผ ํ์ด๊ณผ์ ์ ์์ฑํ๋ ๊ฒ์ ๋ชฉํ๋ก ํ๊ณ ์์ต๋๋ค.
1. ์ฌ์ฉ์ ์ฐจ
- Install model and PEFT parameters
!pip install -U peft transformers optimum
!pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu117/
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoTokenizer, AutoModelForCausalLM, GPTQConfig
model_id = "TheBloke/WizardLM-13B-V1.2-GPTQ"
config = PeftConfig.from_pretrained("a2ran/GPTeacher-llama2-ko-13b")
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=True)
quantization_config_loading = GPTQConfig(bits=4, disable_exllama=True)
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config_loading,
torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(model, "a2ran/GPTeacher-llama2-ko-13b")
- How to Generate Tokens
from transformers import TextStreamer
streamer = TextStreamer(tokenizer)
# your input sentence๊ฐ ๋ค์ด๊ฐ ๊ณณ
sentence = "์ฌ๊ณผ๊ฐ ๋ชธ์ ์ข์ ์ด์ ๋ฅผ ์๋ ค์ฃผ์ธ์."
input = f"""
### input @ {sentence} \n\n### response @"""
output = tokenizer.decode(model.cuda().generate(
**tokenizer(
input,
return_tensors='pt',
).to(0),
max_new_tokens = 2048,
temperature = 1.2,
top_p = 0.7,
early_stopping = True,
eos_token_id = 2,
do_sample = True,
repetition_penalty = 1.1,
streamer = streamer
)[0]).replace(input+" ", "")
- Output ์์ฑ ์์
output =
<s> ์๋
ํ์ธ์. ์ค๋์ ์ฌ๊ณผ์ ์ฅ์ ์ ๋ํด ๋ฐฐ์ฐ๊ฒ ์ต๋๋ค. ์ฌ๊ณผ๋ ํฌ๋์ฃผ, ์นด๋ฐ์๋ก, ์ํธ๋ฌ์ค, ํผ๋ฅด๊ณ ํํจ๋ฆฌ๊ทธ๋ฆญ์ค ๋ฑ ์ฌ๋ฌ ๋ค๋ฅธ ์๋ฌผ๋ค๊ณผ ๋น๊ตํ๋ฉด์ ์ฐ๋ฆฌ์ ๊ฑด๊ฐ์ ์ต์ ํํ๋ ์ค์ํ ์๋ฌผ์
๋๋ค.
์ด์ , ์ฐ์ ์ฌ๊ณผ์ ์ฑ๋ถ์ ์ดํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. ์ฌ๊ณผ๋ ๊ณ ํ์์ ๋ฎ์ถ๋ ์๋ฆฌ๊ฐํจ๋ฆฐ๊ณผ ํจ๋ชจ์ ๊ฐ์ ๋จ๋ฐฑ์ง, ํผํธ์ฐ, ํผ๋ก๋์ฐ ๋ฑ ์์์๋ฅผ ํ๋ถํ๊ฒ ํจ์ ํฉ๋๋ค. ์ด๋ฌํ ์ฑ๋ถ๋ค์ ์ฐ๋ฆฌ์ ์ฒด๋ด ์กฐ์ง์ ํ์์ ์ธ ๋ฌผ์ง๋ค์ด๋ฏ๋ก ์ฌ๊ณผ๋ฅผ ์ญ์ทจํ ๋งํ ์ข์ ์ด์ ์ค ํ๋์
๋๋ค.
๋ํ, ์ฌ๊ณผ๋ ๊ณ ๊ธฐ ์๊ธ๊ณผ ํจ๊ป ์ฌ์ฉํ๋ฉด ๋จ๋ฐฑ์ง์ ์ํ๋ฅผ ๋์ผ ์ ์์ด์. ๋ํ ์ง๋ฐฉ ์๊ธ๊ณผ ํจ๊ป ์ฌ์ฉํ๋ฉด ๋น์ง์ ํก์๋ฅผ ์ฆ๊ฐ์ํฌ ์ ์์ต๋๋ค. ์ด๋ ์ฐ๋ฆฌ์ ์ ์ฒด ๊ธฐ๋ฅ์ ๊ฐ์ ํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
๋ํ, ์ฌ๊ณผ๋ ๋น ๋ฅด๊ฒ ์ํ๋์ด ํ์ํ๋ฌผ์ ๊ณต๊ธํ ์ ์๋ ๊ฒ์ด ์ฅ์ ์ด์ฃ . ์ด๋ ์ฒด๋ด ์๋์ง์์ผ๋ก ์๋ํ๋ ๋ฅ๋ ฅ์ ๋์ฌ์ค๋๋ค. ์ฌ๊ณผ๋ฅผ ์ ๊ตํ๊ฒ ๋จน์ ๊ฒฝ์ฐ ๋ถ๊ท์นํ ํผ์์ ๋ฐฉ์งํ๊ณ ์์ด๋ง์ ์ด๋์ ์ ์งํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
๋ง์ง๋ง์ผ๋ก, ์ฌ๊ณผ๋ ํผ๋ก๋น๊ณผ ์นดํด๋ผ๋ฌ๋ ๊ฐ ๋ง์ด ๋ค์ด ์์ด์. ์ด๋ ๊ทผ์ก์ ๋ฏธ์ธํ ํ์ ์ ๊ณตํ์ฌ ๋๊ตฌ, ํ
๋์ค ๋ฑ ๋ค์ํ ์ข
๋ฅ์ ์ด๋์ ์ํด ํ์ํ ์์์
๋๋ค. ์ด๋ ์ฐ๋ฆฌ์ ์ด๋์ ๋ ์ ์ํํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
๋ฐ๋ผ์, ์ฌ๊ณผ๋ฅผ ์ญ์ทจํ ๋๋ ์ฃผ๋ก ์์นจ์ด๋ ์์นจ ์์ฌ ์ ์ ๋จน๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ํ, ์ฌ๊ณผ๋ ๋งค์ฐ ํก์น๊ธฐ ์ฝ๊ณ ๋ค์ํ ์ฌ๋ฃ๋ฅผ ๊ฐ๋ณํ ์ ์๊ธฐ ๋๋ฌธ์ ์ฐฝ๊ณ ์ ๋ณด๊ดํ ์ ์์ต๋๋ค. ์ฌ๋ฐ๋ฅธ ์กฐ๋ฆฌ ๋ฐฉ๋ฒ์ ์๊ณ ์์ด์ผ ํ๋๋ฐ, ์ฃผ๋ก ํ ์ธ์ผ๋ก ๊ฐ๊ณตํ์ฌ ์ถฉ๋ถํ ์์์ ๋ง๋ค ์ ์์ต๋๋ค.
์ด์์ผ๋ก ์ฌ๊ณผ์ ๋ํด ์๋ ค๋๋ ธ์ต๋๋ค. ์ฌ๊ณผ๋ ์ฐ๋ฆฌ์ ๊ฑด๊ฐ์ ์ต์ ํํ๋ ๋ฐ ํ์์ ์ธ ์์์
๋๋ค. ๊ทธ๋ ๊ธฐ ๋๋ฌธ์ ์ญ์ทจํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ๊ฐ์ฌํฉ๋๋ค.</๋></s>
GPTeacher ํ๋ก์ ํธ๋ฅผ ํตํด ์ถ๊ตฌํ๊ณ ์ ํ๋ ๋ชฉํ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
- ์คํ ๋ฐ์ดํฐ์ ์ ๊ณต : kullm-v2, ko-alpaca ๋ฐ์ดํฐ์ ์ output์ ๊ฐ์ ํํ๋ก ๋ณํํ์ฌ, ๊ธฐ์กด ๋ฐ์ดํฐ์ ์ output๊ณผ ๋๋ถ์ด extended_output ์นผ๋ผ์ ์ถ๊ฐํด ์ ๊ณตํฉ๋๋ค.
- PEFTmodel ํน์ ko-llama2 ๋ชจ๋ธ ์ ๊ณต : ํ์ฌ ๋ฒ์ ์ academic research purpose๋ก ๋ณํ ๊ฐ๋ฅํ wizardLM์ ํ๋ผ๋ฏธํฐ๋ฅผ ์ปค์คํ ๋ฐ์ดํฐ์ ์ ์ ์ฉํ PEFTmodel ํ์ต๋ฐฉ์์ ํตํด ํ์ธํ๋ํ ๋ฒ์ ์ ๋๋ค. ์ฌ๋ฌ ๋ฒ์ ์ ๋ฐ์ดํธ๋ฅผ ํตํด, ๋ค๋ฅธ ๋ชจ๋ธ๋ก๋ถํฐ ํ์ธํ๋์ ํ ์ ์๋ ํ๋ ์์ํฌ๋ฅผ ์ ๊ณตํ๊ฑฐ๋, GPTeacher-ko-llama2 ๋ชจ๋ธ์ ์ ์ํด ์ ๊ณตํ๊ณ ์ ํฉ๋๋ค.
- ํ์ฌ ์ ์์ค์ธ ๋ฐ์ดํฐ์ ์์ : https://huggingface.co/datasets/a2ran/ex_dataset
ํ์ฌ ์ฌ์ฉ๋ชจ๋ธ : WizardLM-13B-v1.2
/์์ด๊ถ ๋ฐ์ดํฐ๋ฅผ ์ค์ฌ์ผ๋ก ํ์ตํ WizardLM ๋ชจ๋ธ์ ํ์ธํ๋ ํ์๊ธฐ์ generalํ ํ๊ตญ ์ ๋ณด์ ๊ดํ ์ง๋ฌธ์ ๋ฏธ์ํฉ๋๋ค./
| Model | Checkpoint | Paper | MT-Bench | AlpacaEval | GSM8k | HumanEval | Demo | License |
|---|---|---|---|---|---|---|---|---|
| WizardLM-70B-V1.0 | ๐ค HF Link | ๐Coming Soon | 7.78 | 92.91% | 77.6% | 50.6 | Llama 2 License | |
| WizardLM-13B-V1.2 | ๐ค HF Link | 7.06 | 89.17% | 55.3% | 36.6 | Demo | Llama 2 License |
ํฅํ ์งํ ๋ฐฉํฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค
- more custom dataset์ผ๋ก ํ์ธํ๋
- ์ฌ๋ฌ ํ๋ผ๋ฏธํฐ ๋ชจ๋ธ์ ๋ํด PEFT learning ์งํ (30B, 7B, 70B...)
- ko-llama2 ๋ชจ๋ธ์ ๋ํด ํ์ธํ๋
2. Training procedure
The following bitsandbytes quantization config was used during training:
- quant_method: gptq
- bits: 4
- tokenizer: None
- dataset: None
- group_size: 128
- damp_percent: 0.1
- desc_act: False
- sym: True
- true_sequential: True
- use_cuda_fp16: False
- model_seqlen: None
- block_name_to_quantize: None
- module_name_preceding_first_block: None
- batch_size: 1
- pad_token_id: None
- disable_exllama: True
- max_input_length: None
Framework versions
- PEFT 0.6.0.dev0
@misc{xu2023wizardlm, title={WizardLM: Empowering Large Language Models to Follow Complex Instructions}, author={Can Xu and Qingfeng Sun and Kai Zheng and Xiubo Geng and Pu Zhao and Jiazhan Feng and Chongyang Tao and Daxin Jiang}, year={2023}, eprint={2304.12244}, archivePrefix={arXiv}, primaryClass={cs.CL} }
- Downloads last month
- 5