Yuqi-Zhou/GUI-G1-3B-v1
220
This repository contains the model presented in GUI-G1: Understanding r1-zero-like training for visual grounding in gui agents.
Project page: https://github.com/Yuqi-Zhou/GUI-G1
Benchmark 1: ScreenSpotV2
Benchmark 2: ScreenSpot-Pro
Evaluation Code for GUI Grounding
Here we show a code snippet to show you how to use the chat model with transformers and qwen_vl_utils:
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
# default: Load the model on the available device(s)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"Yuqi-Zhou/GUI-G1-3B-v1", torch_dtype="auto", device_map="auto"
)
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
# model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
# "Yuqi-Zhou/GUI-G1-3B-v1",
# torch_dtype=torch.bfloat16,
# attn_implementation="flash_attention_2",
# device_map="auto",
# )
# default processer
processor = AutoProcessor.from_pretrained("Yuqi-Zhou/GUI-G1-3B-0.1K")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "Grounding instruction is:{Question}. Help to locate and output its bbox coordinates using JSON format::\n```json\n[\n{{"point_2d": [x, y], "label": "object name/description"}}\n]```"},
],
}
]
# Preparation for inference
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to("cuda")
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=128, use_cache=True)
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)Citation
If you find our work helpful, feel free to give us a cite.
@article{zhou2025gui,
title={GUI-G1: Understanding r1-zero-like training for visual grounding in gui agents},
author={Zhou, Yuqi and Dai, Sunhao and Wang, Shuai and Zhou, Kaiwen and Jia, Qinglin and Xu, Jun},
journal={arXiv preprint arXiv:2505.15810},
year={2025}
}