Image-Text-to-Text
Transformers
Safetensors
English
opencua
feature-extraction
VLM
Computer-Use-Agent
OS-Agent
GUI
Grounding
conversational
custom_code
Instructions to use xlangai/OpenCUA-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xlangai/OpenCUA-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="xlangai/OpenCUA-7B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xlangai/OpenCUA-7B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use xlangai/OpenCUA-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xlangai/OpenCUA-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xlangai/OpenCUA-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/xlangai/OpenCUA-7B
- SGLang
How to use xlangai/OpenCUA-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "xlangai/OpenCUA-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xlangai/OpenCUA-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "xlangai/OpenCUA-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xlangai/OpenCUA-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use xlangai/OpenCUA-7B with Docker Model Runner:
docker model run hf.co/xlangai/OpenCUA-7B
replace the config.json with a correct version
#6
by LutherXD - opened
- config.json +11 -8
config.json
CHANGED
|
@@ -12,25 +12,28 @@
|
|
| 12 |
"media_placeholder_token_id": 151664,
|
| 13 |
"model_type": "opencua",
|
| 14 |
"pad_token_id": 0,
|
|
|
|
|
|
|
| 15 |
"text_config": {
|
| 16 |
"bos_token_id": 151643,
|
| 17 |
"eos_token_id": 151644,
|
| 18 |
"head_dim": 128,
|
| 19 |
"hidden_act": "silu",
|
| 20 |
-
"hidden_size":
|
| 21 |
"initializer_range": 0.02,
|
| 22 |
-
"intermediate_size":
|
| 23 |
"k_proj_bias": true,
|
| 24 |
"max_length": 20,
|
| 25 |
"min_length": 0,
|
| 26 |
"model_type": "qwen2",
|
| 27 |
-
"num_attention_heads":
|
| 28 |
"num_beam_groups": 1,
|
| 29 |
"num_beams": 1,
|
| 30 |
-
"num_hidden_layers":
|
| 31 |
-
"num_key_value_heads":
|
| 32 |
"pad_token_id": 152063,
|
| 33 |
-
"
|
|
|
|
| 34 |
"q_proj_bias": true,
|
| 35 |
"rms_norm_eps": 1e-05,
|
| 36 |
"rope_theta": 1000000.0,
|
|
@@ -56,13 +59,13 @@
|
|
| 56 |
"hidden_size": 1280,
|
| 57 |
"num_heads": 16,
|
| 58 |
"in_chans": 3,
|
| 59 |
-
"intermediate_size":
|
| 60 |
|
| 61 |
"patch_size": 14,
|
| 62 |
"spatial_merge_size": 2,
|
| 63 |
"spatial_patch_size": 14,
|
| 64 |
"temporal_patch_size": 2,
|
| 65 |
-
"out_hidden_size":
|
| 66 |
"tokens_per_second": 2,
|
| 67 |
"window_size": 112
|
| 68 |
},
|
|
|
|
| 12 |
"media_placeholder_token_id": 151664,
|
| 13 |
"model_type": "opencua",
|
| 14 |
"pad_token_id": 0,
|
| 15 |
+
"num_attention_heads": 28,
|
| 16 |
+
"max_position_embeddings": 128000,
|
| 17 |
"text_config": {
|
| 18 |
"bos_token_id": 151643,
|
| 19 |
"eos_token_id": 151644,
|
| 20 |
"head_dim": 128,
|
| 21 |
"hidden_act": "silu",
|
| 22 |
+
"hidden_size": 3584,
|
| 23 |
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 18944,
|
| 25 |
"k_proj_bias": true,
|
| 26 |
"max_length": 20,
|
| 27 |
"min_length": 0,
|
| 28 |
"model_type": "qwen2",
|
| 29 |
+
"num_attention_heads": 28,
|
| 30 |
"num_beam_groups": 1,
|
| 31 |
"num_beams": 1,
|
| 32 |
+
"num_hidden_layers": 28,
|
| 33 |
+
"num_key_value_heads": 4,
|
| 34 |
"pad_token_id": 152063,
|
| 35 |
+
"max_position_embeddings": 128000,
|
| 36 |
+
"pretraining_sequence_length": 128000,
|
| 37 |
"q_proj_bias": true,
|
| 38 |
"rms_norm_eps": 1e-05,
|
| 39 |
"rope_theta": 1000000.0,
|
|
|
|
| 59 |
"hidden_size": 1280,
|
| 60 |
"num_heads": 16,
|
| 61 |
"in_chans": 3,
|
| 62 |
+
"intermediate_size": 3420,
|
| 63 |
|
| 64 |
"patch_size": 14,
|
| 65 |
"spatial_merge_size": 2,
|
| 66 |
"spatial_patch_size": 14,
|
| 67 |
"temporal_patch_size": 2,
|
| 68 |
+
"out_hidden_size": 3584,
|
| 69 |
"tokens_per_second": 2,
|
| 70 |
"window_size": 112
|
| 71 |
},
|