Text Generation
Transformers
Safetensors
Korean
llama
korean
causal-lm
instruction-tuned
from-scratch
kawk
conversational
text-generation-inference
Instructions to use Infinity08/KAWK-500M-Korean-Instruct-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Infinity08/KAWK-500M-Korean-Instruct-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Infinity08/KAWK-500M-Korean-Instruct-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Infinity08/KAWK-500M-Korean-Instruct-v1") model = AutoModelForCausalLM.from_pretrained("Infinity08/KAWK-500M-Korean-Instruct-v1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Infinity08/KAWK-500M-Korean-Instruct-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Infinity08/KAWK-500M-Korean-Instruct-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Infinity08/KAWK-500M-Korean-Instruct-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Infinity08/KAWK-500M-Korean-Instruct-v1
- SGLang
How to use Infinity08/KAWK-500M-Korean-Instruct-v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Infinity08/KAWK-500M-Korean-Instruct-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Infinity08/KAWK-500M-Korean-Instruct-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Infinity08/KAWK-500M-Korean-Instruct-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Infinity08/KAWK-500M-Korean-Instruct-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Infinity08/KAWK-500M-Korean-Instruct-v1 with Docker Model Runner:
docker model run hf.co/Infinity08/KAWK-500M-Korean-Instruct-v1
Update KAWK 500M Instruct model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ko
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
datasets:
|
| 7 |
+
- Infinity08/KAWK500M-Korean-SFT-v1
|
| 8 |
+
tags:
|
| 9 |
+
- llama
|
| 10 |
+
- korean
|
| 11 |
+
- causal-lm
|
| 12 |
+
- instruction-tuned
|
| 13 |
+
- kawk
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# KAWK 500M Korean Instruct v1
|
| 17 |
+
|
| 18 |
+
한국어 중심 말뭉치로 처음부터 사전학습한 505M 파라미터 KAWK 베이스 모델에
|
| 19 |
+
한국어 대화·지시 데이터로 supervised fine-tuning(SFT)을 적용한 모델입니다.
|
| 20 |
+
|
| 21 |
+
## 모델 구조
|
| 22 |
+
|
| 23 |
+
- 아키텍처: Llama 계열 decoder-only Transformer
|
| 24 |
+
- 파라미터: 505,350,400
|
| 25 |
+
- 어휘: 한국어 SentencePiece Unigram 32,000
|
| 26 |
+
- 레이어 / hidden / MLP: 26 / 1,280 / 3,584
|
| 27 |
+
- Attention / KV heads: 20 / 5 (GQA)
|
| 28 |
+
- 최대 문맥: 2,048토큰
|
| 29 |
+
- 입력·출력 임베딩 공유
|
| 30 |
+
|
| 31 |
+
## 학습
|
| 32 |
+
|
| 33 |
+
- 베이스 사전학습량: 한국어 중심 약 100억 토큰
|
| 34 |
+
- SFT 데이터: `Infinity08/KAWK500M-Korean-SFT-v1`
|
| 35 |
+
- 데이터 revision: `0a8e914359a063b916cfd9a3ee068a38ddcc1f79`
|
| 36 |
+
- SFT: 2 epochs, 739 optimizer steps, 약 9,080만 packed-token capacity
|
| 37 |
+
- Assistant 응답 토큰에만 loss 적용
|
| 38 |
+
- 유효 배치: 60 sequences × 2,048 tokens
|
| 39 |
+
- Precision / GPU: BF16 / NVIDIA A100 80GB
|
| 40 |
+
- Learning rate: 2e-5 → 2e-6 cosine decay
|
| 41 |
+
- step 700 validation loss / perplexity: 1.9786 / 7.2327
|
| 42 |
+
- 전체 설정과 로그: `training/`
|
| 43 |
+
|
| 44 |
+
## 사용 예시
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
import torch
|
| 48 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
+
|
| 50 |
+
repo_id = "Infinity08/KAWK-500M-Korean-Instruct-v1"
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=False)
|
| 52 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 53 |
+
repo_id,
|
| 54 |
+
dtype=torch.bfloat16,
|
| 55 |
+
device_map="auto",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
messages = [{"role": "user", "content": "대한민국의 수도를 간단히 설명해줘."}]
|
| 59 |
+
prompt = tokenizer.apply_chat_template(
|
| 60 |
+
messages,
|
| 61 |
+
tokenize=False,
|
| 62 |
+
add_generation_prompt=True,
|
| 63 |
+
)
|
| 64 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 65 |
+
outputs = model.generate(
|
| 66 |
+
**inputs,
|
| 67 |
+
max_new_tokens=128,
|
| 68 |
+
do_sample=True,
|
| 69 |
+
temperature=0.7,
|
| 70 |
+
top_p=0.9,
|
| 71 |
+
repetition_penalty=1.05,
|
| 72 |
+
)
|
| 73 |
+
new_tokens = outputs[0, inputs["input_ids"].shape[1]:]
|
| 74 |
+
print(tokenizer.decode(new_tokens, skip_special_tokens=True))
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
대화 템플릿은 `### 지침:`, `### 사용자:`, `### 도우미:` 역할 헤더를 사용하며
|
| 78 |
+
토크나이저의 `chat_template.jinja`에 포함되어 있습니다.
|
| 79 |
+
|
| 80 |
+
## 평가
|
| 81 |
+
|
| 82 |
+
KoBEST·KMMLU 0-shot 평가는 진행 중이며 완료 후 원시 결과와 요약을 `evaluation/`에 추가합니다.
|
| 83 |
+
|
| 84 |
+
## 한계
|
| 85 |
+
|
| 86 |
+
500M급 모델이므로 복잡한 추론, 정확한 사실 회상, 긴 지시 수행을 보장하지 않습니다.
|
| 87 |
+
SFT 데이터의 편향이나 잘못된 답을 재현할 수 있으며, 사실성·안전성·개인정보 재현에
|
| 88 |
+
대한 포괄적 평가가 완료되지 않았습니다. 고위험 의사결정에 사용하지 마십시오.
|