File size: 945 Bytes
2b172d7
ac3517e
a421196
72927ef
 
2b172d7
ab2047d
72927ef
2b172d7
 
ab2047d
2b172d7
72927ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
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))
```