File size: 2,597 Bytes
c7ca4b8
 
 
 
 
 
 
 
 
 
 
ba8c0d4
 
 
 
 
 
 
c7ca4b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c60121b
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
license: mit
language:
- en
base_model:
- Qwen/Qwen3-VL-4B-Instruct
tags:
- geometry diagram parsing
- reasoning
- formalization
---
# Geoparsing: Diagram Parsing for Plane and Solid Geometry with a Unified Formal Language

[[🌐 Homepage](https://eternal8080.github.io/geoparsing.github.io/)] [[πŸ’» Github](https://github.com/eternal8080/Geoparsing)]  [[πŸ€— Huggingface Dataset](https://huggingface.co/datasets/PeijieWang/GDP29K)] 
[[πŸ€— Huggingface Model](https://huggingface.co/PeijieWang/GDP-4B)]  [[πŸ“– Paper](https://arxiv.org/abs/2604.11600)]


![image](https://cdn-uploads.huggingface.co/production/uploads/67811c0de11224514e9f5974/9uqAnMiwhxCFW_vBdII9X.png)

## 1. Install dependencies
We follow the official environment setup of Qwen3-VL. Please refer to:
πŸ‘‰ https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct

## πŸš€ Inference

We provide a minimal example for running inference with the released Geoparsing model.

```bash
import torch
from transformers import Qwen3VLForConditionalGeneration, AutoProcessor

model_path = "YOUR_MODEL_PATH"  # local path or HuggingFace repo id

model = Qwen3VLForConditionalGeneration.from_pretrained(
    model_path,
    torch_dtype="auto",
    device_map="cuda:0"
)
processor = AutoProcessor.from_pretrained(model_path)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "image",
                "image": "examples/3_17.jpg",
            },
            {
                "type": "text",
                "text": "Please parse the geometric diagram and provide its formal description.",
            },
        ],
    }
]

inputs = processor.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt"
)
inputs = inputs.to(model.device)

generated_ids = model.generate(
    **inputs,
    max_new_tokens=1280
)

generated_ids_trimmed = [
    out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]

output_text = processor.batch_decode(
    generated_ids_trimmed,
    skip_special_tokens=True,
    clean_up_tokenization_spaces=False
)

print(output_text[0])
```

## Citation

```bibtex
@article{wang2026geoparsing,
  title={Geoparsing: Diagram Parsing for Plane and Solid Geometry with a Unified Formal Language},
  author={Wang, Peijie and Zhang, Ming-Liang and Cao, Jun and Deng, Chao and Ran, Dekang and Sun, Hongda and Bu, Pi and Zhang, Xuan and Wang, Yingyao and Song, Jun and Zheng, Bo and Yin, Fei and Liu, Cheng-Lin},
  journal={https://arxiv.org/abs/2604.11600},
  year={2026}
}
```