|
--- |
|
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 --> |
|
|
|
|
|
|