openai/gsm8k
Benchmark • Updated • 17.6k • 969k • 1.34k
How to use lmassaron/gemma-2-2b-it-grpo-gsm8k with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="lmassaron/gemma-2-2b-it-grpo-gsm8k") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("lmassaron/gemma-2-2b-it-grpo-gsm8k")
model = AutoModelForCausalLM.from_pretrained("lmassaron/gemma-2-2b-it-grpo-gsm8k")How to use lmassaron/gemma-2-2b-it-grpo-gsm8k with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "lmassaron/gemma-2-2b-it-grpo-gsm8k"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lmassaron/gemma-2-2b-it-grpo-gsm8k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/lmassaron/gemma-2-2b-it-grpo-gsm8k
How to use lmassaron/gemma-2-2b-it-grpo-gsm8k with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "lmassaron/gemma-2-2b-it-grpo-gsm8k" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lmassaron/gemma-2-2b-it-grpo-gsm8k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "lmassaron/gemma-2-2b-it-grpo-gsm8k" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lmassaron/gemma-2-2b-it-grpo-gsm8k",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use lmassaron/gemma-2-2b-it-grpo-gsm8k with Docker Model Runner:
docker model run hf.co/lmassaron/gemma-2-2b-it-grpo-gsm8k
This model is a fine-tuned version of Google/gemma-2-2b-it on the dataset GSM8k. It has been trained using GRPOTrainer from TRL.
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
tokenizer_name = "Google/gemma-2-2b-it"
model_name="lmassaron/gemma-2-2b-it-grpo-gsm8k"
tokenizer = AutoTokenizer.from_pretrained(tokenizer_name,
trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name,
device_map="auto",
use_cache=True)
FORMAT = """<reasoning>\n</reasoning>\n<answer>\n</answer>\n"""
question = "Which is bigger? 9.11 or 9.9?"
generator = pipeline("text-generation",
model=model,
tokenizer=tokenizer,
do_sample=False,
batch_size=1)
output = generator([{"role": "user", "content": FORMAT + question}],
max_new_tokens=256,
return_full_text=False)[0]
print(output["generated_text"])
This model was trained with GRPO, a method introduced in DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models.
Cite GRPO as:
@article{zhihong2024deepseekmath,
title = {{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
author = {Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
year = 2024,
eprint = {arXiv:2402.03300},
}
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édec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}