Views
No views yet
pip install transformers torch accelerate pillow1from transformers import AutoProcessor, AutoModelForVision2Seq
2from PIL import Image
3import torch
4
5# Load model and processor
6processor = AutoProcessor.from_pretrained("your-org/dart-gui-7b")
7model = AutoModelForVision2Seq.from_pretrained(
8 "your-org/dart-gui-7b",
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13# Prepare input
14image = Image.open("your_image.jpg")
15messages = [
16 {
17 "role": "user",
18 "content": [
19 {"type": "image", "image": image},
20 {"type": "text", "text": "Describe this interface"}
21 ]
22 }
23]
24
25# Process input and generate
26text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
27image_inputs, video_inputs, inputs = processor(
28 text=[text],
29 images=[image],
30 videos=None,
31 padding=True,
32 return_tensors="pt"
33).to(model.device)
34
35# Generate response
36generated_ids = model.generate(**inputs, max_new_tokens=512)
37generated_ids_trimmed = [
38 out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
39]
40output_text = processor.batch_decode(
41 generated_ids_trimmed,
42 skip_special_tokens=True,
43 clean_up_tokenization_spaces=False
44)
45print(output_text[0])1@article{li2025efficient,
2 title={Efficient multi-turn rl for gui agents via decoupled training and adaptive data curation},
3 author={Li, Pengxiang and Hu, Zechen and Shang, Zirui and Wu, Jingrong and Liu, Yang and Liu, Hui and Gao, Zhi and Shi, Chenrui and Zhang, Bofei and Zhang, Zihao and others},
4 journal={arXiv preprint arXiv:2509.23866},
5 year={2025}
6}