Downloads · 30 days
24
6% of all-time downloads
mkd-hossain/keural-sft-18k
keural-sft-18k is a text generation model from mkd-hossain. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Keural is a bilingual Korean–English Mixture-of-Experts language model trained from scratch. This is the SFT (Supervised Fine-Tuning) checkpoint at step 18,000, fine-tuned from the Keural stage-2 pretrained base using…
Downloads · 30 days
24
6% of all-time downloads
All-time downloads
431
Public
Parameters
15.4B
30.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors30.7 GB · 100%
From the Hugging Face model README
Keural is a bilingual Korean–English Mixture-of-Experts language model trained from scratch. This is the SFT (Supervised Fine-Tuning) checkpoint at step 18,000, fine-tuned from the Keural stage-2 pretrained base using the ChatML instruction format.
| Property | Value |
|---|---|
| Architecture | Mixtral-style MoE (8 experts, top-2) |
| Parameters | 14.83B total / ~7.42B active per token |
| Layers | 24 |
| Hidden size | 4096 |
| Attention heads | 32 (GQA — 8 KV heads) |
| Expert intermediate size | 5632 |
| Context length | 4096 tokens |
| Vocabulary | 131,074 (131,072 SPM + `< |
| RoPE theta | 500,000 |
| Sliding window | 512 (every other layer) |
| Dtype | bfloat16 |
| Languages | Korean, English |
| Stage | Steps | Data |
|---|---|---|
| Pretraining Stage 1 | 100,000 | Korean + English web corpus |
| Pretraining Stage 2 | 20,000 | Korean + English web corpus (continued) |
| SFT (this checkpoint) | 18,000 | mkd-chanwoo/keural-SFT (1.14M ChatML samples) |
SFT hyperparameters: LR 1e-5 → 1e-6 cosine, batch 64 effective (4 × 8 accum × 2 GPUs), max_seq 4096, weight_decay 0.05, 2× H200 SXM with FSDP FULL_SHARD.
This model uses ChatML format. You must use this exact format for good results.
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
안녕하세요! 오늘 날씨가 어때요?<|im_end|>
<|im_start|>assistant
The model generates until it produces <|im_end|> (token ID 131073).
transformersfrom transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "mkd-hossain/keural-sft-18k"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a helpful bilingual Korean-English assistant."},
{"role": "user", "content": "파이썬에서 리스트를 정렬하는 방법을 알려주세요."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.1,
do_sample=True,
eos_token_id=131073, # <|im_end|>
)
response = tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=False)
response = response.split("<|im_end|>")[0].strip()
print(response)
pip install vllm
python -m vllm.entrypoints.openai.api_server \
--model mkd-hossain/keural-sft-18k \
--tokenizer mkd-hossain/keural-sft-18k \
--dtype bfloat16 \
--max-model-len 4096 \
--tensor-parallel-size 1
Then call the OpenAI-compatible endpoint:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
response = client.chat.completions.create(
model="mkd-hossain/keural-sft-18k",
messages=[
{"role": "system", "content": "You are a helpful bilingual assistant."},
{"role": "user", "content": "한국의 수도는 어디인가요?"},
],
max_tokens=512,
temperature=0.7,
)
print(response.choices[0].message.content)
python -m vllm.entrypoints.openai.api_server \
--model mkd-hossain/keural-sft-18k \
--dtype bfloat16 \
--max-model-len 4096 \
--tensor-parallel-size 2
apply_chat_template)prompt = (
"<|im_start|>system\n"
"You are a helpful assistant.<|im_end|>\n"
"<|im_start|>user\n"
"Tell me about Seoul.<|im_end|>\n"
"<|im_start|>assistant\n"
)
| Token | ID | Purpose |
|---|---|---|
| `< | im_start | >` |
| `< | im_end | >` |
<bos> | 1 | Beginning of sequence |
<eos> | 2 | End of sequence |
<pad> | 0 | Padding |
Important: Always set
eos_token_id=131073(<|im_end|>) when generating. If you useeos_token_id=2(<eos>), generation may not stop correctly.
generation_config = {
"max_new_tokens": 512,
"temperature": 0.7,
"top_p": 0.9,
"top_k": 50,
"repetition_penalty": 1.1,
"do_sample": True,
"eos_token_id": 131073,
}
For factual / deterministic tasks use temperature=0.1, do_sample=False.
Apache 2.0