A fine-tuned version of
Qwen/Qwen2.5-Math-7B-Instruct with supervised fine-tuning on curated math reasoning data, targeting improved step-by-step problem solving on competition and olympiad-level math.
The base Qwen2.5-Math-7B-Instruct is already a strong math model. This fine-tune focuses on:
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "DuoNeural/Qwen2.5-Math-NeuralMath-7B",
6 torch_dtype=torch.bfloat16,
7 device_map="auto"
8)
9tokenizer = AutoTokenizer.from_pretrained("DuoNeural/Qwen2.5-Math-NeuralMath-7B")
10
11prompt = """Solve the following math problem step by step.
12
13Problem: Find all positive integers n such that n² + 1 is divisible by n + 1.
14
15Solution:"""
16
17inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
18output = model.generate(**inputs, max_new_tokens=512, temperature=0.1, do_sample=True)
19print(tokenizer.decode(output[0], skip_special_tokens=True))
1# Create Modelfile
2cat > Modelfile << 'EOF'
3FROM ./neuromath-7b-q4_k_m.gguf
4SYSTEM "You are an expert mathematician. Solve problems step by step, showing all work clearly. Put your final answer in \\boxed{}."
5PARAMETER temperature 0.1
6PARAMETER num_ctx 4096
7EOF
8
9ollama create neuromath-7b -f Modelfile
10ollama run neuromath-7b "What is the sum of all prime numbers less than 100?"