|
|
--- |
|
|
library_name: transformers |
|
|
tags: |
|
|
- unsloth |
|
|
- trl |
|
|
- sft |
|
|
datasets: |
|
|
- mintaeng/llm_futsaldata_yo |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- ko |
|
|
--- |
|
|
|
|
|
# FUT FUT CHAT BOT |
|
|
|
|
|
- ์คํ์์ค ๋ชจ๋ธ์ LLM fine tuning ๊ณผ RAG ๋ฅผ ์ ์ฉํ ์์ฑํ AI |
|
|
- ํ์ด์ ๋ํ ๊ด์ฌ์ด ๋์์ง๋ฉด์ ์์ ๋๋น ์
๋ฌธ์๋ฅผ ์ํ ์ ๋ณด ์ ๊ณต ์๋น์ค๊ฐ ํ์ํ๋ค๊ณ ๋๊ปด ์ ์ํ๊ฒ ๋จ |
|
|
- ํ์ด ํ๋ซํผ์ ์ฌ์ฉ๋๋ ํ์ด ์ ๋ณด ๋์ฐ๋ฏธ ์ฑ๋ด |
|
|
- 'ํด์์ฒด'๋ก ๋ตํ๋ฉฐ ๋ฌธ์ฅ ๋์ '์ผ๋ง๋ ์ง ๋ฌผ์ด๋ณด์ธ์~ ํํ~!' ์ ์ถ๋ ฅํจ |
|
|
- train for 7h23m |
|
|
|
|
|
## HOW TO USE |
|
|
``` python |
|
|
|
|
|
#!pip install transformers==4.40.0 accelerate |
|
|
import os |
|
|
import torch |
|
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
|
|
|
model_id = 'Dongwookss/small_fut_final' |
|
|
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
|
model_id, |
|
|
torch_dtype=torch.bfloat16, |
|
|
device_map="auto", |
|
|
) |
|
|
model.eval() |
|
|
``` |
|
|
|
|
|
**Query** |
|
|
|
|
|
```python |
|
|
from transformers import TextStreamer |
|
|
PROMPT = '''Below is an instruction that describes a task. Write a response that appropriately completes the request. |
|
|
์ ์ํ๋ context์์๋ง ๋๋ตํ๊ณ context์ ์๋ ๋ด์ฉ์ ๋ชจ๋ฅด๊ฒ ๋ค๊ณ ๋๋ตํด''' |
|
|
|
|
|
messages = [ |
|
|
{"role": "system", "content": f"{PROMPT}"}, |
|
|
{"role": "user", "content": f"{instruction}"} |
|
|
] |
|
|
|
|
|
input_ids = tokenizer.apply_chat_template( |
|
|
messages, |
|
|
add_generation_prompt=True, |
|
|
return_tensors="pt" |
|
|
).to(model.device) |
|
|
|
|
|
terminators = [ |
|
|
tokenizer.eos_token_id, |
|
|
tokenizer.convert_tokens_to_ids("<|eot_id|>") |
|
|
] |
|
|
|
|
|
text_streamer = TextStreamer(tokenizer) |
|
|
_ = model.generate( |
|
|
input_ids, |
|
|
max_new_tokens=4096, |
|
|
eos_token_id=terminators, |
|
|
do_sample=True, |
|
|
streamer = text_streamer, |
|
|
temperature=0.6, |
|
|
top_p=0.9, |
|
|
repetition_penalty = 1.1 |
|
|
) |
|
|
|
|
|
``` |
|
|
|
|
|
## Model Details |
|
|
|
|
|
|
|
|
### Model Description |
|
|
|
|
|
This is the model card of a ๐ค transformers model that has been pushed on the Hub. This model card has been automatically generated. |
|
|
- **Developed by:** Dongwookss |
|
|
- **Model type:** text generation |
|
|
- **Language(s) (NLP):** Korean |
|
|
- **Finetuned from model :** HuggingFaceH4/zephyr-7b-beta |
|
|
|
|
|
### Data |
|
|
https://huggingface.co/datasets/mintaeng/llm_futsaldata_yo |
|
|
|
|
|
ํ์ต ๋ฐ์ดํฐ์
์ beomi/KoAlpaca-v1.1a ๋ฅผ ๋ฒ ์ด์ค๋ก ์ถ๊ฐ, ๊ตฌ์ถ, ์ ์ฒ๋ฆฌ ์งํํ 23.5k ๋ฐ์ดํฐ๋ก ํ๋ํ์์ต๋๋ค. |
|
|
๋ฐ์ดํฐ์
์ instruction, input, output ์ผ๋ก ๊ตฌ์ฑ๋์ด ์์ผ๋ฉฐ tuning ๋ชฉํ์ ๋ง๊ฒ ๋งํฌ ์์ ํ์์ต๋๋ค. |
|
|
๋๋ฉ์ธ ์ ๋ณด์ ๋ํ ๋ฐ์ดํฐ ์ถ๊ฐํ์์ต๋๋ค. |
|
|
|
|
|
## Training & Result |
|
|
|
|
|
|
|
|
### Training Procedure |
|
|
LoRA์ SFT Trainer ๋ฐฉ์์ ์ฌ์ฉํ์์ต๋๋ค. |
|
|
|
|
|
#### Training Hyperparameters |
|
|
|
|
|
- **Training regime:** bf16 mixed precision |
|
|
``` |
|
|
r=32, |
|
|
lora_alpha=64, # QLoRA : alpha = r/2 // LoRA : alpha =r*2 |
|
|
lora_dropout=0.05, |
|
|
target_modules=[ |
|
|
"q_proj", |
|
|
"k_proj", |
|
|
"v_proj", |
|
|
"o_proj", |
|
|
"gate_proj", |
|
|
"up_proj", |
|
|
"down_proj", |
|
|
], # ํ๊ฒ ๋ชจ๋ |
|
|
``` |
|
|
|
|
|
### Result |
|
|
https://github.com/lucide99/Chatbot_FutFut |
|
|
|
|
|
<!-- ## Bias, Risks, and Limitations --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ## Model Examination [optional] --> |
|
|
|
|
|
|
|
|
|
|
|
## Environment |
|
|
|
|
|
L4 GPU |
|
|
|
|
|
<!-- ## contributors --> |
|
|
|
|
|
|
|
|
|