Downloads · 30 days
34
52% of all-time downloads
song9/CC-KuLLM3-LoRA
CC-KuLLM3-LoRA is a text generation model from song9. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
34
52% of all-time downloads
All-time downloads
66
Public
Repo size
10.6 GB
Likes
0
Public
Click a slice to open those files.
.safetensors706 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of nlpai-lab/KULLM3 on the AI-Hub/민원(콜센터) 질의-응답 데이터 and AI-Hub/용도별 목적대화 데이터 dataset. It achieves the following results on the evaluation set:
This model is fine-tuned for "multi-turn conversations" in CC(Contact Center) domain.
import torch
from enum import Enum
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
from peft import PeftModel
device = 'cuda' torch.cuda.is_available() else 'cpu'
base_model = AutoModelForCausalLM.from_pretrained(
'nlpai-lab/KULLM3',
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map=device
)
tokenizer = AutoTokenizer.from_pretrained(
'song9/CC-KuLLM3-LoRA'
)
base_model.resize_token_embeddings(len(tokenizer))
peft_model = PeftModel.from_pretrained(
base_model,
'song9/CC-KuLLM3-LoRA'
)
# inference
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
conversation = [
{'role':'user','content':"지난주에 주문한 제품 반품하고 싶은데 어떻게 하죠?"}, # 이전 문맥
{'role':'assistant','content':'반품 사유를 말씀해주시겠습니까?'}, # 이전 문맥
{'role':'user','content':'아 네 제품이 배송 중에 파손된 것 같아요.'}
]
response_template = '[/INST]'
instruction_template = '[INST]'
collator = DataCollatorForCompletionOnlyLM(
instruction_template=instruction_template,
response_template=response_template,
tokenizer=tokenizer
)
inputs = collator.tokenizer(
tokenizer.apply_chat_template(
conversation,
tokenize=False,
add_generation_prompt=True,
return_tensors='pt'
),
padding=True,
truncation=True,
return_tensors='pt'
).to(device)
output = peft_model.generate(inputs['input_ids'], streamer=streamer, max_new_tokens=1024, use_cache=True)
# print(tokenizer.decode(output[0]))
# 네 그러시군요. 고객님 불편을 드려 죄송합니다.
Apache-2.0 (following original repo)
Dataset is preprocessed with two codes.
Set filepath and huggingface access token to yours and run the code. They refer to medium : fine-tuning-chat-based-llm.
Training Code is here : code
Referred this example : peft/examples
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 0.8004 | 0.1941 | 8000 | 0.7944 |
| 0.7445 | 0.3882 | 16000 | 0.7504 |
| 0.7058 | 0.5823 | 24000 | 0.7259 |
| 0.7039 | 0.7764 | 32000 | 0.7099 |
| 0.6861 | 0.9706 | 40000 | 0.6985 |
| 0.6670 | 1.1647 | 48000 | 0.6902 |
| 0.6562 | 1.3588 | 56000 | 0.6831 |
| 0.6605 | 1.5529 | 64000 | 0.6782 |
| 0.6474 | 1.7471 | 72000 | 0.6739 |
| 0.6537 | 1.9412 | 80000 | 0.6711 |
| No Log | 2.0000 | 82422 | 0.6711 |