Downloads · 30 days
0
FutureMa/Qwen2.5-7B-Instruct-GRPO-Math
Qwen2.5-7B-Instruct-GRPO-Math is a text generation model from FutureMa. 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.
This model is a fine-tuned version of Qwen/Qwen2.5-7B-Instruct using GRPO (Group Relative Policy Optimization) on mathematical reasoning tasks.
Downloads · 30 days
0
Access
Public
Updated Nov 28, 2025
Repo size
243 MB
Likes
0
Public
Click a slice to open those files.
.pt162 MB · 67%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen2.5-7B-Instruct using GRPO (Group Relative Policy Optimization) on mathematical reasoning tasks.
CUDA_VISIBLE_DEVICES=0 \
swift rlhf \
--rlhf_type grpo \
--model Qwen/Qwen2.5-7B-Instruct \
--reward_funcs accuracy format \
--train_type lora \
--lora_rank 8 \
--lora_alpha 32 \
--target_modules all-linear \
--torch_dtype bfloat16 \
--dataset 'AI-MO/NuminaMath-TIR#500' \
--num_train_epochs 1 \
--per_device_train_batch_size 2 \
--learning_rate 5e-5 \
--num_generations 2
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
torch_dtype="auto",
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"FutureMa/Qwen2.5-7B-Instruct-GRPO-Math"
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
# Generate
messages = [
{"role": "user", "content": "Solve for x: 2x^2 - 3x + 1 = 0"}
]
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=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# Inference
swift infer \
--ckpt_dir FutureMa/Qwen2.5-7B-Instruct-GRPO-Math \
--eval_human false
This model is optimized for:
@misc{qwen2.5-grpo-math,
author = {FutureMa},
title = {Qwen2.5-7B-Instruct Fine-tuned with GRPO on Math Tasks},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/FutureMa/Qwen2.5-7B-Instruct-GRPO-Math}}
}