PeijieWang commited on
Commit
c7ca4b8
·
verified ·
1 Parent(s): c9423f8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -3
README.md CHANGED
@@ -1,3 +1,74 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ base_model:
6
+ - Qwen/Qwen3-VL-4B-Instruct
7
+ tags:
8
+ - geometry diagram parsing
9
+ - reasoning
10
+ - formalization
11
+ ---
12
+
13
+ ## 1. Install dependencies
14
+ We follow the official environment setup of Qwen3-VL. Please refer to:
15
+ 👉 https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct
16
+
17
+ ## 🚀 Inference
18
+
19
+ We provide a minimal example for running inference with the released Geoparsing model.
20
+
21
+ ```bash
22
+ import torch
23
+ from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
24
+
25
+ model_path = "YOUR_MODEL_PATH" # local path or HuggingFace repo id
26
+
27
+ model = Qwen3VLForConditionalGeneration.from_pretrained(
28
+ model_path,
29
+ torch_dtype="auto",
30
+ device_map="cuda:0"
31
+ )
32
+ processor = AutoProcessor.from_pretrained(model_path)
33
+
34
+ messages = [
35
+ {
36
+ "role": "user",
37
+ "content": [
38
+ {
39
+ "type": "image",
40
+ "image": "examples/3_17.jpg",
41
+ },
42
+ {
43
+ "type": "text",
44
+ "text": "Please parse the geometric diagram and provide its formal description.",
45
+ },
46
+ ],
47
+ }
48
+ ]
49
+
50
+ inputs = processor.apply_chat_template(
51
+ messages,
52
+ tokenize=True,
53
+ add_generation_prompt=True,
54
+ return_dict=True,
55
+ return_tensors="pt"
56
+ )
57
+ inputs = inputs.to(model.device)
58
+
59
+ generated_ids = model.generate(
60
+ **inputs,
61
+ max_new_tokens=1280
62
+ )
63
+
64
+ generated_ids_trimmed = [
65
+ out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
66
+ ]
67
+
68
+ output_text = processor.batch_decode(
69
+ generated_ids_trimmed,
70
+ skip_special_tokens=True,
71
+ clean_up_tokenization_spaces=False
72
+ )
73
+
74
+ print(output_text[0])