Day1Kim/Multilingual-Thinking-KO
Viewer • Updated • 200 • 32 • 1
How to use Day1Kim/gpt-oss-20b-korean-reasoner with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Day1Kim/gpt-oss-20b-korean-reasoner")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("Day1Kim/gpt-oss-20b-korean-reasoner", device_map="auto")How to use Day1Kim/gpt-oss-20b-korean-reasoner with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Day1Kim/gpt-oss-20b-korean-reasoner"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Day1Kim/gpt-oss-20b-korean-reasoner",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Day1Kim/gpt-oss-20b-korean-reasoner
How to use Day1Kim/gpt-oss-20b-korean-reasoner with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Day1Kim/gpt-oss-20b-korean-reasoner" \
--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": "Day1Kim/gpt-oss-20b-korean-reasoner",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Day1Kim/gpt-oss-20b-korean-reasoner" \
--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": "Day1Kim/gpt-oss-20b-korean-reasoner",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Day1Kim/gpt-oss-20b-korean-reasoner with Docker Model Runner:
docker model run hf.co/Day1Kim/gpt-oss-20b-korean-reasoner
This model is a fine-tuned version of openai/gpt-oss-20b on the Day1Kim/Multilingual-Thinking-KO dataset. It has been trained using TRL.
한국어 thinking 데이터셋 기반 파인튜닝된 모델.
from transformers import pipeline
question = "한국의 수도는?"
generator = pipeline("text-generation", model="Day1Kim/gpt-oss-20b-korean-reasoner", device="cuda")
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained("openai/gpt-oss-20b")
# Load the original model first
model_kwargs = dict(attn_implementation="eager", torch_dtype="auto", use_cache=True, device_map="auto")
base_model = AutoModelForCausalLM.from_pretrained("openai/gpt-oss-20b", **model_kwargs).cuda()
# Merge fine-tuned weights with the base model
peft_model_id = "gpt-oss-20b-korean-reasoner"
model = PeftModel.from_pretrained(base_model, peft_model_id)
model = model.merge_and_unload()
REASONING_LANGUAGE = "Korean"
SYSTEM_PROMPT = f"reasoning language: {REASONING_LANGUAGE}"
USER_PROMPT = "한국의 수도는?"
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": USER_PROMPT},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
gen_kwargs = {"max_new_tokens": 512, "do_sample": True, "temperature": 0.6, "top_p": None, "top_k": None}
output_ids = model.generate(input_ids, **gen_kwargs)
response = tokenizer.batch_decode(output_ids)[0]
print(response)
This model was trained with SFT.
Cite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
Base model
openai/gpt-oss-20b