UI-TARS本地部署
UI-TARS本地部署
-
UI-TARS 論文(arXiv)
-
UI-TARS 官方倉庫:包含部署指南、模型下載鏈接及示例代碼。
-
UI-TARS-Desktop 客戶端:支持本地桌面應用的交互控制。
-
模型部署框架:vLLM本地部署
1.下載項目源碼
git clone https://github.com/bytedance/UI-TARS.git
2.下載模型checkpoint
# 使用huggingface鏡像源
export HF_ENDPOINT=https://hf-mirror.com
# 以2B模型為例(太窮了7B沒顯存)
huggingface-cli download --resume-download ByteDance-Seed/UI-TARS-2B-SFT --local-dir ./UI-TARS-2B-SFT
3.本地模型部署
- 啟動 API 服務
#python -m vllm.entrypoints.openai.api_server --served-model-name ui-tars --model <模型路徑>
python -m vllm.entrypoints.openai.api_server --served-model-name ui-tars --model /mnt/n/model/GUI-model/UI-TARS-2B-SFT
# --trust-remote-code
python -m vllm.entrypoints.openai.api_server --served-model-name ui-tars --model /mnt/n/model/GUI-model/UI-TARS-2B-SFT --trust-remote-code
- 若報錯:
# 報錯1
AttributeError: module 'pynvml' has no attribute 'nvmlDeviceGetCudaComputeCapability'
# 解決1pip install --force-reinstall --ignore-installed nvidia-ml-py# 報錯2:ValueError: size must contain 'shortest_edge' and 'longest_edge' keys.
# 解決2:
https://www.modelscope.cn/models/bytedance-research/UI-TARS-7B-DPO/feedback/issueDetail/27680
preprocessor_config.json增加:"size": {"max_pixels": 2116800,"min_pixels": 3136,"shortest_edge": 3136,"longest_edge": 2116800},"temporal_patch_size": 2,"shortest_edge": 3136,"longest_edge": 2116800
4. 客戶端調用示例
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="empty")
response = client.chat.completions.create(model="ui-tars",messages=[{"role": "user", "content": "搜索今日天氣"}]
)print(response.choices[0].message.content)
5. 安裝UI.TARS-0.1.2.Setup.exe
配置 UI-TARS 客戶端
打開 UI-TARS:啟動 UI-TARS Windows 客戶端。
進入模型配置界面:在客戶端中找到模型配置相關的功能區域,通常在設置或者模型管理模塊。
添加模型配置:
模型名稱:為模型設置一個便于識別的名稱,例如 local-vlm-model
。
API 基礎 URL:輸入 vLLM 服務的基礎 URL,默認情況下為 http://localhost:8000/v1
。
認證信息:若服務需要認證,需填寫相應的認證信息;若無需認證,可留空。