File size: 3,287 Bytes
c45f7d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d9e3944
c45f7d2
 
 
 
 
 
 
c712238
 
 
 
 
 
 
 
 
 
 
c45f7d2
 
c712238
 
c45f7d2
c712238
 
 
c45f7d2
 
 
c712238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c45f7d2
 
c712238
c45f7d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c712238
c45f7d2
 
c712238
 
c45f7d2
 
 
 
 
 
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
license: mit
base_model: Qwen/Qwen2.5-VL-3B-Instruct
datasets:
- Salesforce/grounding_dataset
tags:
- vision-language
- click-prediction
- gui-grounding
- diffusion-transformer
- flow-matching
pipeline_tag: image-to-text
---

# Qwen-Click-DiT

Vision-Language Model with Diffusion Transformer for GUI Click Prediction. For more, read [here](https://husseinlezzaik.com/tess/qwen-click-dit/).

## Model Description

This model predicts click coordinates given a screenshot and natural language instruction. It uses:
- **Qwen2.5-VL-3B** as a frozen vision-language backbone
- **DiT (Diffusion Transformer)** action head using flow matching

## Quick Start

### Installation

```bash
pip install torch transformers accelerate qwen-vl-utils pillow
git clone https://github.com/HusseinLezzaik/Qwen-Click-DiT.git
cd Qwen-Click-DiT
```

### Inference

```python
import torch
from PIL import Image
from transformers import AutoProcessor, AutoConfig
from qwen_vl_utils import process_vision_info

# Clone the repo first to get the model class
from src.model import Qwen2_5_VLForClickPrediction

# Load model
model_id = "TESS-Computer/qwen-click-dit"
config = AutoConfig.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct")
config.dit_hidden_size = 512
config.dit_num_layers = 6
config.dit_num_heads = 8
config.dit_dropout = 0.1
config.num_inference_steps = 16

model = Qwen2_5_VLForClickPrediction.from_pretrained(
    model_id, config=config, torch_dtype=torch.bfloat16
)
model = model.to("cuda").eval()
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct")

# Prepare input
image = Image.open("screenshot.png").convert("RGB")
prompt = "Click on the search button"

messages = [{
    "role": "user",
    "content": [
        {"type": "image", "image": image, "min_pixels": 200704, "max_pixels": 401408},
        {"type": "text", "text": prompt},
    ],
}]

text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs, video_kwargs = process_vision_info(messages, return_video_kwargs=True)
inputs = processor(text=text, images=image_inputs, videos=video_inputs, return_tensors="pt", **video_kwargs)
inputs = {k: v.to("cuda") if torch.is_tensor(v) else v for k, v in inputs.items()}

# Predict click coordinates
with torch.no_grad():
    click_xy = model.predict(**inputs)

x, y = click_xy[0].cpu().tolist()
print(f"Normalized: ({x:.4f}, {y:.4f})")
print(f"Pixels: ({int(x * image.width)}, {int(y * image.height)})")
```

See [GitHub repo](https://github.com/HusseinLezzaik/Qwen-Click-DiT) for more examples.

## Training

- **Dataset**: [Salesforce/grounding_dataset](https://huggingface.co/datasets/Salesforce/grounding_dataset)
- **Samples**: 20,000
- **Epochs**: 3
- **Base Model**: [Qwen/Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct)

## Architecture

| Component | Value |
|-----------|-------|
| DiT Hidden Size | 512 |
| DiT Layers | 6 |
| DiT Heads | 8 |
| Inference Steps | 16 |

## Citation

```bibtex
@misc{lezzaik2026qwenclickdit,
  title = {Qwen-Click-DiT: Vision-Language Model with Diffusion Transformer for GUI Click Prediction},
  author = {Lezzaik, Hussein},
  year = {2026},
  howpublished = {\url{https://github.com/HusseinLezzaik/Qwen-Click-DiT}},
}
```

## License

MIT