Downloads · 30 days
216
64% of all-time downloads
Kevinmastascusa/qwen2p5-math-1p5b-merged
qwen2p5-math-1p5b-merged is a text generation model from Kevinmastascusa. 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.
Qwen2.5-Math-1.5B fine-tuned with LoRA on math word problems, with the adapter merged into the full weights so it loads like any Transformers model. The unmerged adapter is Kevinmastascusa/symbolic-math-qwen2p5-1p5b-l…
Downloads · 30 days
216
64% of all-time downloads
All-time downloads
339
Public
Parameters
1.5B
3.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors3.1 GB · 99%
From the Hugging Face model README
Qwen2.5-Math-1.5B fine-tuned with LoRA on math word problems, with the adapter merged into the full weights so it loads like any Transformers model. The unmerged adapter is Kevinmastascusa/symbolic-math-qwen2p5-1p5b-lora. Training, merge and evaluation code is in kevinmastascusa/symbolic-math-ai, whose Streamlit app adds Tree-of-Thoughts search with SymPy-checked final answers on top of this model.
merge_lora_to_full.py)Question: ...\nAnswer:Problem: ...\nSolution:Problem: ...\nOptions: ...\nSolution:Exact match on the project's test splits, with greedy decoding and up to 64 new tokens. The scorer takes the last number in the model's output and compares it with the last number in the gold answer.
| Test set | Problems | Correct | Exact match |
|---|---|---|---|
| SVAMP | 200 | 125 | 62.5% |
| GSM8K | 200 | 65 | 32.5% |
| MATH-500 | 100 | 16 | 16.0% |
| Three scored sets | 500 | 206 | 41.2% |
| MathQA | 200 | 0 | not scored (see below) |
evaluate_model.py. Raw results: eval_all.json.from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "Kevinmastascusa/qwen2p5-math-1p5b-merged"
tok = AutoTokenizer.from_pretrained(model_id)
if tok.pad_token is None:
tok.pad_token = tok.eos_token
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto" if torch.cuda.is_available() else None,
)
def solve(q, max_new_tokens=64):
prompt = f"Question: {q}\nAnswer:"
inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs, max_new_tokens=max_new_tokens,
do_sample=False, num_beams=1, pad_token_id=tok.eos_token_id
)
return tok.decode(out[0], skip_special_tokens=True)
Question: ...\nAnswer:Problem: ...\nSolution:Problem: ...\nOptions: ...\nSolution:Apache 2.0, inherited from the base model (Qwen/Qwen2.5-Math-1.5B).
If you use this model, please cite the base model:
@article{yang2024qwen25mathtechnicalreportmathematical,
title={Qwen2.5-Math Technical Report: Toward Mathematical Expert Model via Self-Improvement},
author={An Yang and Beichen Zhang and Binyuan Hui and Bofei Gao and Bowen Yu and Chengpeng Li and Dayiheng Liu and Jianhong Tu and Jingren Zhou and Junyang Lin and Keming Lu and Mingfeng Xue and Runji Lin and Tianyu Liu and Xingzhang Ren and Zhenru Zhang},
journal={arXiv preprint arXiv:2409.12122},
year={2024}
}