openai/gsm8k
Benchmark • Updated • 17.6k • 957k • 1.33k
How to use ryota39/Qwen3-8B-math-RL-en with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ryota39/Qwen3-8B-math-RL-en")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ryota39/Qwen3-8B-math-RL-en")
model = AutoModelForCausalLM.from_pretrained("ryota39/Qwen3-8B-math-RL-en")
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]:]))How to use ryota39/Qwen3-8B-math-RL-en with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ryota39/Qwen3-8B-math-RL-en"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ryota39/Qwen3-8B-math-RL-en",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/ryota39/Qwen3-8B-math-RL-en
How to use ryota39/Qwen3-8B-math-RL-en with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ryota39/Qwen3-8B-math-RL-en" \
--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": "ryota39/Qwen3-8B-math-RL-en",
"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 "ryota39/Qwen3-8B-math-RL-en" \
--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": "ryota39/Qwen3-8B-math-RL-en",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use ryota39/Qwen3-8B-math-RL-en with Docker Model Runner:
docker model run hf.co/ryota39/Qwen3-8B-math-RL-en
max_new_tokens=256で、openai/gsm8kを使って事後学習したモデルです。import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ryota39/Qwen3-8B-math-RL-en"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
)
prompt = "A Christmas tree has 8 shelves for decorations, and each shelf can hold 45 ornaments. Currently, two-thirds of the total capacity is decorated. How many ornaments are on the tree in total? Write your answer in the format \\boxed{answer}."
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
# 出力例
# <think>
# Okay, let's see. The Christmas tree has 8 shelves, each holding 45 ornaments. So the total capacity is 8 times 45. Let me calculate that: 8*45 is 360. So the total capacity is 360 ornaments. Now, two-thirds of that is decorated. So two-thirds of 360 is (2/3)*360. Let me compute that: 360 divided by 3 is 120, times 2 is 240. So there are 240 ornaments on the tree. The answer is \boxed{240}.
#
# **Final Answer**
# \boxed{240}
# </think>
#
# To determine how many ornaments are currently on the tree, we start by calculating the total capacity of the tree:
#
# - There are 8 shelves, and each shelf holds 45 ornaments.
# - Total capacity = $ 8 \times 45 = 360 $ ornaments.
#
# Next, we are told that two-thirds of this total capacity is currently decorated:
#
# - Two-thirds of 360 = $ \frac{2}{3} \times 360 = 240 $