math_model / README.md
jdecim's picture
Update math model
72927ef verified
---
base_model: Qwen/Qwen3-1.7B
library_name: transformers
license: apache-2.0
pipeline_tag: text-generation
tags:
- math
- text-generation
---
# math_model
A fine-tuned version of [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B)
for mathematical reasoning. The model produces a chain of reasoning and returns the
final answer wrapped in `\boxed{...}`.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("cs-552-2026-the-transformers/math_model")
model = AutoModelForCausalLM.from_pretrained(
"cs-552-2026-the-transformers/math_model", device_map="cuda")
msgs = [{"role": "user", "content": "What is 12 * 12? Put the final answer in \\boxed{}."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to("cuda")
out = model.generate(ids, max_new_tokens=2048)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
```