Views
No views yet
Qwen3.5-2B-MathParser-pro.| Model | Samples | Avg Sim | Median Sim | Line Match | Within +/-1 | Runaway | Bad <0.50 |
|---|---|---|---|---|---|---|---|
| Qwen3.5-0.8B Base | 756 | 0.544843 | 0.580742 | 149 | 235 | 108 | 262 |
| Qwen3.5-2B Base | 756 | 0.599258 | 0.651649 | 252 | 392 | 19 | 236 |
| Qwen3.5-4B Base | 756 | 0.534456 | 0.541674 | 264 | 368 | 5 | 295 |
| Qwen3.5-2B SFT | 756 | 0.906516 | 0.952732 | 550 | 706 | 13 | 25 |
| Qwen3.5-2B SFT+DPO | 756 | 0.916060 | 0.951464 | 569 | 714 | 3 | 15 |
| Qwen3.5-4B SFT | 756 | 0.942045 | 0.966546 | 612 | 730 | 0 | 2 |
| Qwen3.5-4B SFT+DPO | 756 | 0.942878 | 0.968560 | 611 | 730 | 0 | 1 |
| Release | Avg Sim | Median Sim | Line Match | Within +/-1 | Runaway | Bad <0.50 |
|---|---|---|---|---|---|---|
| Qwen3.5-4B-MathParser-pro | 0.942878 | 0.968560 | 611 | 730 | 0 | 1 |




1from PIL import Image
2import torch
3from transformers import AutoModelForImageTextToText, AutoProcessor
4from qwen_vl_utils import process_vision_info
5
6model_id = "sugartai/Qwen3.5-4B-MathParser-pro"
7
8processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
9model = AutoModelForImageTextToText.from_pretrained(
10 model_id,
11 trust_remote_code=True,
12 dtype=torch.bfloat16,
13 device_map="auto",
14).eval()
15
16image = Image.open("formula.png").convert("RGB")
17messages = [
18 {
19 "role": "system",
20 "content": "You are a handwritten mathematical OCR model. Return only the LaTeX transcription.",
21 },
22 {
23 "role": "user",
24 "content": [
25 {"type": "image", "image": image},
26 {"type": "text", "text": "Transcribe the handwritten mathematical formula into LaTeX only."},
27 ],
28 },
29]
30
31text = processor.apply_chat_template(
32 messages,
33 tokenize=False,
34 add_generation_prompt=True,
35 enable_thinking=False,
36)
37image_inputs, video_inputs = process_vision_info(messages)
38inputs = processor(
39 text=[text],
40 images=image_inputs,
41 videos=video_inputs,
42 padding=True,
43 return_tensors="pt",
44).to(model.device)
45
46eos_ids = [processor.tokenizer.eos_token_id]
47pad_id = processor.tokenizer.pad_token_id
48if pad_id is not None and pad_id not in eos_ids:
49 eos_ids.append(pad_id)
50
51with torch.no_grad():
52 output_ids = model.generate(
53 **inputs,
54 max_new_tokens=1536,
55 do_sample=False,
56 num_beams=1,
57 eos_token_id=eos_ids,
58 pad_token_id=pad_id if pad_id is not None else eos_ids[0],
59 )
60
61new_ids = output_ids[:, inputs["input_ids"].shape[1]:]
62print(processor.decode(new_ids[0], skip_special_tokens=True))Qwen/Qwen3.5-4B.