Update chat_template.json
REPLACE
"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 %}"
TO
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}<|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 %}"
This commit is contained in:
12
README.md
12
README.md
@@ -6,16 +6,14 @@ tags:
|
||||
base_model:
|
||||
- Qwen/Qwen2-VL-2B-Instruct
|
||||
license: mit
|
||||
tasks:
|
||||
- image-text-to-text
|
||||
---
|
||||
[Github](https://github.com/showlab/ShowUI/tree/main) | [arXiv](https://arxiv.org/abs/2411.17465) | [HF Paper](https://huggingface.co/papers/2411.17465) | [Studio](https://www.modelscope.cn/studios/AI-ModelScope/ShowUI) | [Datasets](https://huggingface.co/datasets/showlab/ShowUI-desktop-8K) | [Quick Start](https://www.modelscope.cn/models/AI-ModelScope/ShowUI-2B)
|
||||
[Github](https://github.com/showlab/ShowUI/tree/main) | [arXiv](https://arxiv.org/abs/2411.17465) | [HF Paper](https://huggingface.co/papers/2411.17465) | [Spaces](https://huggingface.co/spaces/showlab/ShowUI) | [Datasets](https://huggingface.co/datasets/showlab/ShowUI-desktop-8K) | [Quick Start](https://huggingface.co/showlab/ShowUI-2B)
|
||||
<img src="examples/showui.jpg" alt="ShowUI" width="640">
|
||||
|
||||
ShowUI is a lightweight (2B) vision-language-action model designed for GUI agents.
|
||||
|
||||
## Try our ModelScope Studio Demo
|
||||
https://www.modelscope.cn/studios/AI-ModelScope/ShowUI
|
||||
## 🤗 Try our HF Space Demo
|
||||
https://huggingface.co/spaces/showlab/ShowUI
|
||||
|
||||
|
||||
## ⭐ Quick Start
|
||||
@@ -49,7 +47,7 @@ model = Qwen2VLForConditionalGeneration.from_pretrained(
|
||||
min_pixels = 256*28*28
|
||||
max_pixels = 1344*28*28
|
||||
|
||||
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)
|
||||
processor = AutoProcessor.from_pretrained("showlab/ShowUI-2B", min_pixels=min_pixels, max_pixels=max_pixels)
|
||||
```
|
||||
|
||||
2. **UI Grounding**
|
||||
@@ -146,7 +144,7 @@ action_map = {
|
||||
```python
|
||||
img_url = 'examples/chrome.png'
|
||||
split='web'
|
||||
system_prompt = _NAV_SYSTEM.format(_APP=split, _ACTION_SPACE=action_map[split])
|
||||
system_prompt = _NAV_SYSTEM.format(_APP=split, _ACTION_SPACE=action_map[split]) + _NAV_FORMAT
|
||||
query = "Search the weather for the New York city."
|
||||
|
||||
messages = [
|
||||
|
||||
Reference in New Issue
Block a user