h-siyuan commited on
Commit
48a56a5
1 Parent(s): 2392f1e

remove large local files to save space storage

Browse files
showui-2b/.gitattributes DELETED
@@ -1,35 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/README.md DELETED
@@ -1,188 +0,0 @@
1
- ---
2
- tags:
3
- - GUI agents
4
- - vision-language-action model
5
- - computer use
6
- ---
7
- [Github](https://github.com/showlab/ShowUI/tree/main) | [Quick Start](https://huggingface.co/showlab/ShowUI-2B)
8
- <img src="examples/showui.png" alt="ShowUI" width="640">
9
-
10
- ShowUI is a lightweight (2B) vision-language-action model designed for GUI agents.
11
- [![demo](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/showlab/ShowUI-2B)&nbsp;
12
- ## ⭐ Quick Start
13
-
14
- 1. Load model
15
- ```python
16
- import ast
17
- import torch
18
- from PIL import Image, ImageDraw
19
- from qwen_vl_utils import process_vision_info
20
- from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
21
-
22
- def draw_point(image_input, point=None, radius=5):
23
- if isinstance(image_input, str):
24
- image = Image.open(BytesIO(requests.get(image_input).content)) if image_input.startswith('http') else Image.open(image_input)
25
- else:
26
- image = image_input
27
-
28
- if point:
29
- x, y = point[0] * image.width, point[1] * image.height
30
- ImageDraw.Draw(image).ellipse((x - radius, y - radius, x + radius, y + radius), fill='red')
31
- display(image)
32
- return
33
-
34
- model = Qwen2VLForConditionalGeneration.from_pretrained(
35
- "showlab/ShowUI-2B",
36
- torch_dtype=torch.bfloat16,
37
- device_map="auto"
38
- )
39
-
40
- min_pixels = 256*28*28
41
- max_pixels = 1344*28*28
42
-
43
- processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)
44
- ```
45
-
46
- 2. **UI Grounding**
47
- ```python
48
- img_url = 'examples/web_dbd7514b-9ca3-40cd-b09a-990f7b955da1.png'
49
- query = "Nahant"
50
-
51
-
52
- _SYSTEM = "Based on the screenshot of the page, I give a text description and you give its corresponding location. The coordinate represents a clickable location [x, y] for an element, which is a relative coordinate on the screenshot, scaled from 0 to 1."
53
- messages = [
54
- {
55
- "role": "user",
56
- "content": [
57
- {"type": "text", "text": _SYSTEM},
58
- {"type": "image", "image": img_url, "min_pixels": min_pixels, "max_pixels": max_pixels},
59
- {"type": "text", "text": query}
60
- ],
61
- }
62
- ]
63
-
64
- text = processor.apply_chat_template(
65
- messages, tokenize=False, add_generation_prompt=True,
66
- )
67
- image_inputs, video_inputs = process_vision_info(messages)
68
- inputs = processor(
69
- text=[text],
70
- images=image_inputs,
71
- videos=video_inputs,
72
- padding=True,
73
- return_tensors="pt",
74
- )
75
- inputs = inputs.to("cuda")
76
-
77
- generated_ids = model.generate(**inputs, max_new_tokens=128)
78
- generated_ids_trimmed = [
79
- out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
80
- ]
81
- output_text = processor.batch_decode(
82
- generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
83
- )[0]
84
-
85
- click_xy = ast.literal_eval(output_text)
86
- # [0.73, 0.21]
87
-
88
- draw_point(img_url, click_xy, 10)
89
- ```
90
-
91
- This will visualize the grounding results like (where the red points are [x,y])
92
-
93
- ![download](https://github.com/user-attachments/assets/8fe2783d-05b6-44e6-a26c-8718d02b56cb)
94
-
95
- 3. **UI Navigation**
96
- - Set up system prompt.
97
- ```python
98
- _NAV_SYSTEM = """You are an assistant trained to navigate the {_APP} screen.
99
- Given a task instruction, a screen observation, and an action history sequence,
100
- output the next action and wait for the next observation.
101
- Here is the action space:
102
- {_ACTION_SPACE}
103
- """
104
-
105
- _NAV_FORMAT = """
106
- Format the action as a dictionary with the following keys:
107
- {'action': 'ACTION_TYPE', 'value': 'element', 'position': [x,y]}
108
-
109
- If value or position is not applicable, set it as `None`.
110
- Position might be [[x1,y1], [x2,y2]] if the action requires a start and end position.
111
- Position represents the relative coordinates on the screenshot and should be scaled to a range of 0-1.
112
- """
113
-
114
- action_map = {
115
- 'web': """
116
- 1. `CLICK`: Click on an element, value is not applicable and the position [x,y] is required.
117
- 2. `INPUT`: Type a string into an element, value is a string to type and the position [x,y] is required.
118
- 3. `SELECT`: Select a value for an element, value is not applicable and the position [x,y] is required.
119
- 4. `HOVER`: Hover on an element, value is not applicable and the position [x,y] is required.
120
- 5. `ANSWER`: Answer the question, value is the answer and the position is not applicable.
121
- 6. `ENTER`: Enter operation, value and position are not applicable.
122
- 7. `SCROLL`: Scroll the screen, value is the direction to scroll and the position is not applicable.
123
- 8. `SELECT_TEXT`: Select some text content, value is not applicable and position [[x1,y1], [x2,y2]] is the start and end position of the select operation.
124
- 9. `COPY`: Copy the text, value is the text to copy and the position is not applicable.
125
- """,
126
-
127
- 'phone': """
128
- 1. `INPUT`: Type a string into an element, value is not applicable and the position [x,y] is required.
129
- 2. `SWIPE`: Swipe the screen, value is not applicable and the position [[x1,y1], [x2,y2]] is the start and end position of the swipe operation.
130
- 3. `TAP`: Tap on an element, value is not applicable and the position [x,y] is required.
131
- 4. `ANSWER`: Answer the question, value is the status (e.g., 'task complete') and the position is not applicable.
132
- 5. `ENTER`: Enter operation, value and position are not applicable.
133
- """
134
- }
135
-
136
- _NAV_USER = """{system}
137
- Task: {task}
138
- Observation: <|image_1|>
139
- Action History: {action_history}
140
- What is the next action?
141
- """
142
- ```
143
-
144
- ```python
145
- img_url = 'examples/chrome.png'
146
- split='web'
147
- system_prompt = _NAV_SYSTEM.format(_APP=split, _ACTION_SPACE=action_map[split])
148
- query = "Search the weather for the New York city."
149
-
150
- messages = [
151
- {
152
- "role": "user",
153
- "content": [
154
- {"type": "text", "text": system_prompt},
155
- {"type": "image", "image": img_url, "min_pixels": min_pixels, "max_pixels": max_pixels},
156
- {"type": "text", "text": query}
157
- ],
158
- }
159
- ]
160
-
161
- text = processor.apply_chat_template(
162
- messages, tokenize=False, add_generation_prompt=True,
163
- )
164
- image_inputs, video_inputs = process_vision_info(messages)
165
- inputs = processor(
166
- text=[text],
167
- images=image_inputs,
168
- videos=video_inputs,
169
- padding=True,
170
- return_tensors="pt",
171
- )
172
- inputs = inputs.to("cuda")
173
-
174
- generated_ids = model.generate(**inputs, max_new_tokens=128)
175
- generated_ids_trimmed = [
176
- out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
177
- ]
178
- output_text = processor.batch_decode(
179
- generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
180
- )[0]
181
-
182
- print(output_text)
183
- # {'action': 'CLICK', 'value': None, 'position': [0.49, 0.42]},
184
- # {'action': 'INPUT', 'value': 'weather for New York city', 'position': [0.49, 0.42]},
185
- # {'action': 'ENTER', 'value': None, 'position': None}
186
- ```
187
-
188
- ![download](https://github.com/user-attachments/assets/624097ea-06f2-4c8f-83f6-b6b9ee439c0c)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/added_tokens.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "<|box_end|>": 151649,
3
- "<|box_start|>": 151648,
4
- "<|endoftext|>": 151643,
5
- "<|im_end|>": 151645,
6
- "<|im_start|>": 151644,
7
- "<|image_pad|>": 151655,
8
- "<|object_ref_end|>": 151647,
9
- "<|object_ref_start|>": 151646,
10
- "<|quad_end|>": 151651,
11
- "<|quad_start|>": 151650,
12
- "<|video_pad|>": 151656,
13
- "<|vision_end|>": 151653,
14
- "<|vision_pad|>": 151654,
15
- "<|vision_start|>": 151652
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/config.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "_name_or_path": "Qwen/Qwen2-VL-2B-Instruct",
3
- "architectures": [
4
- "Qwen2VLForConditionalGeneration"
5
- ],
6
- "attention_dropout": 0.0,
7
- "bos_token_id": 151643,
8
- "eos_token_id": 151645,
9
- "hidden_act": "silu",
10
- "hidden_size": 1536,
11
- "image_token_id": 151655,
12
- "initializer_range": 0.02,
13
- "intermediate_size": 8960,
14
- "max_position_embeddings": 32768,
15
- "max_window_layers": 28,
16
- "model_type": "qwen2_vl",
17
- "num_attention_heads": 12,
18
- "num_hidden_layers": 28,
19
- "num_key_value_heads": 2,
20
- "rms_norm_eps": 1e-06,
21
- "rope_scaling": {
22
- "mrope_section": [
23
- 16,
24
- 24,
25
- 24
26
- ],
27
- "type": "mrope"
28
- },
29
- "rope_theta": 1000000.0,
30
- "sliding_window": 32768,
31
- "tie_word_embeddings": true,
32
- "tokenizer_model_max_length": 4096,
33
- "torch_dtype": "bfloat16",
34
- "transformers_version": "4.45.0.dev0",
35
- "use_cache": false,
36
- "use_sliding_window": false,
37
- "video_token_id": 151656,
38
- "vision_config": {
39
- "hidden_size": 1536,
40
- "in_chans": 3,
41
- "model_type": "qwen2_vl",
42
- "spatial_patch_size": 14
43
- },
44
- "vision_end_token_id": 151653,
45
- "vision_start_token_id": 151652,
46
- "vision_token_id": 151654,
47
- "vocab_size": 151936
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/examples/0730d43001da36204b8cb9495b61308.png DELETED
Binary file (67.6 kB)
 
showui-2b/examples/chrome.png DELETED
Binary file (67.6 kB)
 
showui-2b/examples/showui.png DELETED
Binary file (54 kB)
 
showui-2b/generation_config.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "_attn_implementation": "eager",
3
- "bos_token_id": 151643,
4
- "do_sample": true,
5
- "eos_token_id": [
6
- 151645,
7
- 151643
8
- ],
9
- "pad_token_id": 151643,
10
- "temperature": 0.01,
11
- "top_k": 1,
12
- "top_p": 0.001,
13
- "transformers_version": "4.45.0.dev0"
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/merges.txt DELETED
The diff for this file is too large to render. See raw diff
 
showui-2b/preprocessor_config.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "do_convert_rgb": true,
3
- "do_normalize": true,
4
- "do_rescale": true,
5
- "do_resize": true,
6
- "image_mean": [
7
- 0.48145466,
8
- 0.4578275,
9
- 0.40821073
10
- ],
11
- "image_processor_type": "Qwen2VLImageProcessor",
12
- "image_std": [
13
- 0.26862954,
14
- 0.26130258,
15
- 0.27577711
16
- ],
17
- "max_pixels": 12845056,
18
- "merge_size": 2,
19
- "min_pixels": 3136,
20
- "patch_size": 14,
21
- "processor_class": "Qwen2VLProcessor",
22
- "resample": 3,
23
- "rescale_factor": 0.00392156862745098,
24
- "size": {
25
- "max_pixels": 12845056,
26
- "min_pixels": 3136
27
- },
28
- "temporal_patch_size": 2
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/pytorch_model.bin DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:68080df785764e98976eb9cc93a07c6c69cf8a6933738496e02aef55b53d2aa3
3
- size 4418202778
 
 
 
 
showui-2b/special_tokens_map.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "additional_special_tokens": [
3
- "<|im_start|>",
4
- "<|im_end|>",
5
- "<|object_ref_start|>",
6
- "<|object_ref_end|>",
7
- "<|box_start|>",
8
- "<|box_end|>",
9
- "<|quad_start|>",
10
- "<|quad_end|>",
11
- "<|vision_start|>",
12
- "<|vision_end|>",
13
- "<|vision_pad|>",
14
- "<|image_pad|>",
15
- "<|video_pad|>"
16
- ],
17
- "eos_token": {
18
- "content": "<|im_end|>",
19
- "lstrip": false,
20
- "normalized": false,
21
- "rstrip": false,
22
- "single_word": false
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/tokenizer.json DELETED
The diff for this file is too large to render. See raw diff
 
showui-2b/tokenizer_config.json DELETED
@@ -1,144 +0,0 @@
1
- {
2
- "add_prefix_space": false,
3
- "added_tokens_decoder": {
4
- "151643": {
5
- "content": "<|endoftext|>",
6
- "lstrip": false,
7
- "normalized": false,
8
- "rstrip": false,
9
- "single_word": false,
10
- "special": true
11
- },
12
- "151644": {
13
- "content": "<|im_start|>",
14
- "lstrip": false,
15
- "normalized": false,
16
- "rstrip": false,
17
- "single_word": false,
18
- "special": true
19
- },
20
- "151645": {
21
- "content": "<|im_end|>",
22
- "lstrip": false,
23
- "normalized": false,
24
- "rstrip": false,
25
- "single_word": false,
26
- "special": true
27
- },
28
- "151646": {
29
- "content": "<|object_ref_start|>",
30
- "lstrip": false,
31
- "normalized": false,
32
- "rstrip": false,
33
- "single_word": false,
34
- "special": true
35
- },
36
- "151647": {
37
- "content": "<|object_ref_end|>",
38
- "lstrip": false,
39
- "normalized": false,
40
- "rstrip": false,
41
- "single_word": false,
42
- "special": true
43
- },
44
- "151648": {
45
- "content": "<|box_start|>",
46
- "lstrip": false,
47
- "normalized": false,
48
- "rstrip": false,
49
- "single_word": false,
50
- "special": true
51
- },
52
- "151649": {
53
- "content": "<|box_end|>",
54
- "lstrip": false,
55
- "normalized": false,
56
- "rstrip": false,
57
- "single_word": false,
58
- "special": true
59
- },
60
- "151650": {
61
- "content": "<|quad_start|>",
62
- "lstrip": false,
63
- "normalized": false,
64
- "rstrip": false,
65
- "single_word": false,
66
- "special": true
67
- },
68
- "151651": {
69
- "content": "<|quad_end|>",
70
- "lstrip": false,
71
- "normalized": false,
72
- "rstrip": false,
73
- "single_word": false,
74
- "special": true
75
- },
76
- "151652": {
77
- "content": "<|vision_start|>",
78
- "lstrip": false,
79
- "normalized": false,
80
- "rstrip": false,
81
- "single_word": false,
82
- "special": true
83
- },
84
- "151653": {
85
- "content": "<|vision_end|>",
86
- "lstrip": false,
87
- "normalized": false,
88
- "rstrip": false,
89
- "single_word": false,
90
- "special": true
91
- },
92
- "151654": {
93
- "content": "<|vision_pad|>",
94
- "lstrip": false,
95
- "normalized": false,
96
- "rstrip": false,
97
- "single_word": false,
98
- "special": true
99
- },
100
- "151655": {
101
- "content": "<|image_pad|>",
102
- "lstrip": false,
103
- "normalized": false,
104
- "rstrip": false,
105
- "single_word": false,
106
- "special": true
107
- },
108
- "151656": {
109
- "content": "<|video_pad|>",
110
- "lstrip": false,
111
- "normalized": false,
112
- "rstrip": false,
113
- "single_word": false,
114
- "special": true
115
- }
116
- },
117
- "additional_special_tokens": [
118
- "<|im_start|>",
119
- "<|im_end|>",
120
- "<|object_ref_start|>",
121
- "<|object_ref_end|>",
122
- "<|box_start|>",
123
- "<|box_end|>",
124
- "<|quad_start|>",
125
- "<|quad_end|>",
126
- "<|vision_start|>",
127
- "<|vision_end|>",
128
- "<|vision_pad|>",
129
- "<|image_pad|>",
130
- "<|video_pad|>"
131
- ],
132
- "bos_token": null,
133
- "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
134
- "clean_up_tokenization_spaces": false,
135
- "eos_token": "<|im_end|>",
136
- "errors": "replace",
137
- "model_max_length": 4096,
138
- "pad_token": null,
139
- "padding_side": "right",
140
- "processor_class": "Qwen2VLProcessor",
141
- "split_special_tokens": false,
142
- "tokenizer_class": "Qwen2Tokenizer",
143
- "unk_token": null
144
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
showui-2b/vocab.json DELETED
The diff for this file is too large to render. See raw diff