视觉语言大模型(VLM)已经成为智能系统的关键基石。随着真实世界的智能任务越来越复杂,VLM模型也亟需在基本的多模态感知之外,逐渐增强复杂任务中的推理能力,提升自身的准确性、全面性和智能化程度,使得复杂问题解决、长上下文理解、多模态智能体等智能任务成为可能。
刚刚,智谱发布了最新的 GLM-4.5V 开源工作——全球100B级效果最佳的开源视觉推理模型,已同步在魔搭社区开源。
模型合集:
GLM-4.5V 基于智谱新一代旗舰文本基座模型 GLM-4.5-Air(106B参数,12B激活),延续 GLM-4.1V-Thinking 技术路线,在 42 个公开视觉多模态榜单中综合效果达到同级别开源模型 SOTA 性能,涵盖图像、视频、文档理解以及 GUI Agent 等常见任务。
编辑
在多模态榜单之外,研究团队更重视模型在真实场景下的表现与可用性。GLM-4.5V 通过高效混合训练,具备覆盖不同种视觉内容的处理能力,实现全场景视觉推理,包括:
- 图像推理(场景理解、复杂多图分析、位置识别)
- 视频理解(长视频分镜分析、事件识别)
- GUI 任务(屏幕读取、图标识别、桌面操作辅助)
- 复杂图表与长文档解析(研报分析、信息提取)
- Grounding 能力(精准定位视觉元素)
同时,模型新增 “思考模式” 开关,用户可灵活选择快速响应或深度推理,平衡效率与效果,该开关的使用方式与GLM-4.5 语言模型相同。
模型推理
环境安装
对于SGLang
和transformers
:
git clone https://github.com/zai-org/GLM-V.git cd GLM- pip install -r requirements.txt
vLLM
pip install -U vllm --pre --extra-index-url https://wheels.vllm.ai/nightly pip install transformers-v4.55.0-GLM-4.5V-preview
vLLM推理
vllm serve zai-org/GLM-4.5V \ --tensor-parallel-size 4 \ --tool-call-parser glm45 \ --reasoning-parser glm45 \ --enable-auto-tool-choice \ --served-model-name glm-4.5v \ --allowed-local-media-path / \ --media-io-kwargs '{"video": {"num_frames": -1}}'
SGlang推理
python3 -m sglang.launch_server --model-path zai-org/GLM-4.5V \ --tp-size 4 \ --tool-call-parser glm45 \ --reasoning-parser glm45 \ --served-model-name glm-4.5v \ --port 8000 \ --host 0.0.0.0
模型微调
我们介绍使用ms-swift对GLM-4.5V进行训练。ms-swift是魔搭社区官方提供的大模型与多模态大模型训练部署框架。
ms-swift开源地址:
https://github.com/modelscope/ms-swift
研究团队将展示可运行的微调demo,并给出自定义数据集的格式。
在开始微调之前,请确保您的环境已准备妥当。
# pip install git+https://github.com/modelscope/ms-swift.git git clone https://github.com/modelscope/ms-swift.git cd ms-swift pip install -e . pip install git+https://github.com/huggingface/transformers.git
如果您需要自定义数据集微调模型,你可以将数据准备成以下格式。
{"messages": [{"role": "user", "content": "<image><image>What is the difference between the two images?"}, {"role": "assistant", "content": "The first one is a kitten, and the second one is a puppy."}], "images": ["/xxx/x.jpg", "/xxx/x.png"]}
训练脚本:
# 4 * 65GiB CUDA_VISIBLE_DEVICES=0,1,2,3 \ swift sft \ --model ZhipuAI/GLM-4.5V \ --dataset 'AI-ModelScope/LaTeX_OCR:human_handwrite#20000' \ --split_dataset_ratio 0.01 \ --train_type lora \ --torch_dtype bfloat16 \ --num_train_epochs 1 \ --per_device_train_batch_size 1 \ --per_device_eval_batch_size 1 \ --learning_rate 1e-4 \ --lora_rank 8 \ --lora_alpha 32 \ --target_modules all-linear \ --freeze_vit true \ --gradient_accumulation_steps 16 \ --eval_steps 50 \ --save_steps 50 \ --save_total_limit 2 \ --logging_steps 5 \ --max_length 2048 \ --output_dir output \ --warmup_ratio 0.05 \ --dataloader_num_workers 4
编辑
训练完成后,使用以下命令进行推理:
CUDA_VISIBLE_DEVICES=0 \ swift infer \ --adapters output/vx-xxx/checkpoint-xxx \ --stream true \ --load_data_args true \ --max_new_tokens 2048
推送模型到ModelScope:
swift export \ --adapters output/vx-xxx/checkpoint-xxx \ --push_to_hub true \ --hub_model_id '<your-model-id>' \ --hub_token '<your-sdk-token>'
点击链接, 即可跳转模型合集~