mirror of
https://www.modelscope.cn/ZhipuAI/GLM-4.1V-9B-Thinking.git
synced 2026-06-12 12:12:53 +08:00
Compare commits
145 Commits
pr/DX12388
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 62ee2f8ebd | |||
| fd92a094c2 | |||
| 1c97e7adee | |||
| 257979fd39 | |||
| 0dabdef802 | |||
| 2236e0b1af | |||
| b0872b7794 | |||
| 35bfb6657d | |||
| 0613213f11 | |||
| 09c913ff71 | |||
| f2e8f73ada | |||
| 2c5a0c61dd | |||
| d2d32cfcb1 | |||
| 7db4ca304d | |||
| 435419c52d | |||
| 5db418414d | |||
| c8a7d0963f | |||
| 31b66e679d | |||
| 7051418798 | |||
| f9a9b744a3 | |||
| 07a5204d7c | |||
| 9355dcde75 | |||
| 71fced2779 | |||
| f36b3e1114 | |||
| 5770a2c93f | |||
| eea3d25a9d | |||
| 5181066a32 | |||
| af10462fe9 | |||
| a1b9d15988 | |||
| 8256a4e5ac | |||
| 8707695690 | |||
| ea5103057f | |||
| 07d57847a7 | |||
| 3fb7c80c22 | |||
| 6cf7fec891 | |||
| 5a87b42726 | |||
| 26a6379252 | |||
| bf670f6e47 | |||
| f3e92c6283 | |||
| 68e1a18c4f | |||
| 15caa86165 | |||
| 78170a76d4 | |||
| a96c62f3c6 | |||
| c9b0a3712a | |||
| 513122fb6b | |||
| e634423499 | |||
| 4189e78e82 | |||
| b9962d86d7 | |||
| 5b54a2c8a4 | |||
| 5627c3e221 | |||
| d1fa1eb77b | |||
| 1dd5dea5c8 | |||
| 1f96a11038 | |||
| c0c8ab6b12 | |||
| 12953d1d55 | |||
| 109e69fbb4 | |||
| 1ec558733e | |||
| 171de346d2 | |||
| 50bc379f48 | |||
| 43562b321f | |||
| 27c94755b7 | |||
| 90735b4930 | |||
| a14b7ee944 | |||
| 1888286b6f | |||
| fe9c2f230c | |||
| 7393bf6a0b | |||
| a28562c226 | |||
| dcfce55c4c | |||
| 399a51fb2b | |||
| 4f6de1dca6 | |||
| 6d685baab9 | |||
| a380d4601a | |||
| 7cc2ae24b1 | |||
| ada03b9d38 | |||
| 9db7824676 | |||
| 18ab00aa7b | |||
| 6778c7a8fc | |||
| 88676c1db0 | |||
| 08cf4d93a2 | |||
| 23ff5af1e9 | |||
| 14051cc226 | |||
| fc732bbad2 | |||
| 55bab11e83 | |||
| b15d4c2292 | |||
| 3906a4d8e3 | |||
| e9892c8226 | |||
| 86a914356f | |||
| c6e72bdcc5 | |||
| 94ac4ea6d5 | |||
| 5eab5eb239 | |||
| 5fd252ce8c | |||
| dfe3b94896 | |||
| 84f7e07a2d | |||
| 6f6848583d | |||
| 87fe415681 | |||
| 58136e3240 | |||
| 3e3a7e75b1 | |||
| a99b3355e6 | |||
| cf29e981de | |||
| 79b0bc60b2 | |||
| 33d0975fe7 | |||
| 195967d00f | |||
| 3c235c94e6 | |||
| b0c6621429 | |||
| 999651e2f7 | |||
| 402fa3b8b3 | |||
| 620e3ee2c5 | |||
| c7bd410da1 | |||
| 322cd74896 | |||
| f0527e343d | |||
| 317dd3f01a | |||
| 1d4e1ae616 | |||
| 131977428a | |||
| 1178fdc33b | |||
| 255d2cc26f | |||
| 9972904e1b | |||
| 4102f1dfd5 | |||
| 2346111083 | |||
| a133dac63c | |||
| 585c678101 | |||
| c4691f2c54 | |||
| 524e92f1a4 | |||
| e4a6856510 | |||
| 3afb88eaef | |||
| 8622a64f24 | |||
| 75575e9ac7 | |||
| b7009ea267 | |||
| 09c074da7e | |||
| 284d3287fd | |||
| ce20c8a020 | |||
| af35d9190e | |||
| 19c96042e9 | |||
| 1033d7d688 | |||
| 8e4962743d | |||
| 1001265d1d | |||
| 026f8b735a | |||
| a38b10913a | |||
| 93431ca8e5 | |||
| 2ebbeacb86 | |||
| c4bf60a31e | |||
| 9ad8636d9b | |||
| 06910fdafb | |||
| 45fd0841b8 | |||
| f221c89443 | |||
| f58a52db7a |
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -11,7 +11,7 @@
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
@ -45,3 +45,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
notebook.ipynb filter=lfs diff=lfs merge=lfs -text
|
||||
82
README.md
82
README.md
@ -1,67 +1,85 @@
|
||||
---
|
||||
license: mit
|
||||
language:
|
||||
- en
|
||||
- zh
|
||||
base_model:
|
||||
- zai-org/GLM-4-9B-0414
|
||||
pipeline_tag: image-text-to-text
|
||||
library_name: transformers
|
||||
tags:
|
||||
- reasoning
|
||||
---
|
||||
|
||||
# GLM-4.1V-9B-Thinking
|
||||
|
||||
<div align="center">
|
||||
<img src=https://raw.githubusercontent.com/THUDM/GLM-4.1V-Thinking/99c5eb6563236f0ff43605d91d107544da9863b2/resources/logo.svg width="40%"/>
|
||||
<img src=https://raw.githubusercontent.com/zai-org/GLM-4.1V-Thinking/99c5eb6563236f0ff43605d91d107544da9863b2/resources/logo.svg width="40%"/>
|
||||
</div>
|
||||
<p align="center">
|
||||
📖 查看 GLM-4.1V-9B-Thinking <a href="https://arxiv.org/abs/2507.01006" target="_blank">论文</a> 。
|
||||
📖 View the GLM-4.1V-9B-Thinking <a href="https://arxiv.org/abs/2507.01006" target="_blank">paper</a>.
|
||||
<br>
|
||||
💡 立即在线体验 <a href="https://huggingface.co/spaces/THUDM/GLM-4.1V-9B-Thinking-Demo" target="_blank">Hugging Face</a> 或 <a href="https://modelscope.cn/studios/ZhipuAI/GLM-4.1V-9B-Thinking-Demo" target="_blank">ModelScope</a> 上的 GLM-4.1V-9B-Thinking。
|
||||
<br>
|
||||
📍 在 <a href="https://www.bigmodel.cn/dev/api/visual-reasoning-model/GLM-4.1V-Thinking">智谱大模型开放平台</a> 使用 GLM-4.1V-9B-Thinking 的API服务。
|
||||
📍 Using GLM-4.1V-9B-Thinking API at <a href="https://www.bigmodel.cn/dev/api/visual-reasoning-model/GLM-4.1V-Thinking">Zhipu Foundation Model Open Platform</a>
|
||||
</p>
|
||||
|
||||
## 模型介绍
|
||||
|
||||
视觉语言大模型(VLM)已经成为智能系统的关键基石。随着真实世界的智能任务越来越复杂,VLM模型也亟需在基本的多模态感知之外,
|
||||
逐渐增强复杂任务中的推理能力,提升自身的准确性、全面性和智能化程度,使得复杂问题解决、长上下文理解、多模态智能体等智能任务成为可能。
|
||||
## Model Introduction
|
||||
|
||||
基于 [GLM-4-9B-0414](https://github.com/THUDM/GLM-4) 基座模型,我们推出新版VLM开源模型 **GLM-4.1V-9B-Thinking**
|
||||
,引入思考范式,通过课程采样强化学习 RLCS(Reinforcement Learning with Curriculum Sampling)全面提升模型能力,
|
||||
达到 10B 参数级别的视觉语言模型的最强性能,在18个榜单任务中持平甚至超过8倍参数量的 Qwen-2.5-VL-72B。
|
||||
我们同步开源基座模型 **GLM-4.1V-9B-Base**,希望能够帮助更多研究者探索视觉语言模型的能力边界。
|
||||
Vision-Language Models (VLMs) have become foundational components of intelligent systems. As real-world AI tasks grow
|
||||
increasingly complex, VLMs must evolve beyond basic multimodal perception to enhance their reasoning capabilities in
|
||||
complex tasks. This involves improving accuracy, comprehensiveness, and intelligence, enabling applications such as
|
||||
complex problem solving, long-context understanding, and multimodal agents.
|
||||
|
||||

|
||||
Based on the [GLM-4-9B-0414](https://github.com/zai-org/GLM-4) foundation model, we present the new open-source VLM model
|
||||
**GLM-4.1V-9B-Thinking**, designed to explore the upper limits of reasoning in vision-language models. By introducing
|
||||
a "thinking paradigm" and leveraging reinforcement learning, the model significantly enhances its capabilities. It
|
||||
achieves state-of-the-art performance among 10B-parameter VLMs, matching or even surpassing the 72B-parameter
|
||||
Qwen-2.5-VL-72B on 18 benchmark tasks. We are also open-sourcing the base model GLM-4.1V-9B-Base to
|
||||
support further research into the boundaries of VLM capabilities.
|
||||
|
||||
与上一代的 CogVLM2 及 GLM-4V 系列模型相比,**GLM-4.1V-Thinking** 有如下改进:
|
||||

|
||||
|
||||
1. 系列中首个推理模型,不仅仅停留在数学领域,在多个子领域均达到世界前列的水平。
|
||||
2. 支持 **64k** 上下长度。
|
||||
3. 支持**任意长宽比**和高达 **4k** 的图像分辨率。
|
||||
4. 提供支持**中英文双语**的开源模型版本。
|
||||
Compared to the previous generation models CogVLM2 and the GLM-4V series, **GLM-4.1V-Thinking** offers the
|
||||
following improvements:
|
||||
|
||||
## 榜单信息
|
||||
1. The first reasoning-focused model in the series, achieving world-leading performance not only in mathematics but also
|
||||
across various sub-domains.
|
||||
2. Supports **64k** context length.
|
||||
3. Handles **arbitrary aspect ratios** and up to **4K** image resolution.
|
||||
4. Provides an open-source version supporting both **Chinese and English bilingual** usage.
|
||||
|
||||
GLM-4.1V-9B-Thinking 通过引入「思维链」(Chain-of-Thought)推理机制,在回答准确性、内容丰富度与可解释性方面,
|
||||
全面超越传统的非推理式视觉模型。在28项评测任务中有23项达到10B级别模型最佳,甚至有18项任务超过8倍参数量的Qwen-2.5-VL-72B。
|
||||
## Benchmark Performance
|
||||
|
||||

|
||||
By incorporating the Chain-of-Thought reasoning paradigm, GLM-4.1V-9B-Thinking significantly improves answer accuracy,
|
||||
richness, and interpretability. It comprehensively surpasses traditional non-reasoning visual models.
|
||||
Out of 28 benchmark tasks, it achieved the best performance among 10B-level models on 23 tasks,
|
||||
and even outperformed the 72B-parameter Qwen-2.5-VL-72B on 18 tasks.
|
||||
|
||||
## 快速推理
|
||||

|
||||
|
||||
## Quick Inference
|
||||
|
||||
This is a simple example of running single-image inference using the `transformers` library.
|
||||
First, install the `transformers` library from source:
|
||||
|
||||
这里展现了一个使用`transformers`进行单张图片推理的代码。首先,从源代码安装`transformers`库。
|
||||
```
|
||||
pip install git+https://github.com/huggingface/transformers.git
|
||||
pip install transformers>=4.57.1
|
||||
```
|
||||
|
||||
接着按照以下代码运行:
|
||||
Then, run the following code:
|
||||
|
||||
```python
|
||||
from transformers import AutoProcessor, Glm4vForConditionalGeneration
|
||||
import torch
|
||||
|
||||
MODEL_PATH = "THUDM/GLM-4.1V-9B-Thinking"
|
||||
MODEL_PATH = "zai-org/GLM-4.1V-9B-Thinking"
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image",
|
||||
"url": "https://model-demo.oss-cn-hangzhou.aliyuncs.com/Grayscale_8bits_palette_sample_image.png"
|
||||
"url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Grayscale_8bits_palette_sample_image.png"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
@ -70,13 +88,12 @@ messages = [
|
||||
],
|
||||
}
|
||||
]
|
||||
processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
|
||||
model = Glm4vForConditionalGeneration.from_pretrained(
|
||||
pretrained_model_name_or_path=MODEL_PATH,
|
||||
torch_dtype=torch.bfloat16,
|
||||
device_map="auto",
|
||||
)
|
||||
processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
|
||||
|
||||
inputs = processor.apply_chat_template(
|
||||
messages,
|
||||
tokenize=True,
|
||||
@ -89,6 +106,5 @@ output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:],
|
||||
print(output_text)
|
||||
```
|
||||
|
||||
|
||||
视频推理,网页端Demo部署等更代码请查看我们的 [github](https://github.com/THUDM/GLM-4.1V-Thinking)。
|
||||
|
||||
For video reasoning, web demo deployment, and more code, please check
|
||||
our [GitHub](https://github.com/zai-org/GLM-V).
|
||||
40
config.json
40
config.json
@ -3,6 +3,16 @@
|
||||
"Glm4vForConditionalGeneration"
|
||||
],
|
||||
"model_type": "glm4v",
|
||||
"image_start_token_id": 151339,
|
||||
"image_end_token_id": 151340,
|
||||
"video_start_token_id": 151341,
|
||||
"video_end_token_id": 151342,
|
||||
"image_token_id": 151343,
|
||||
"video_token_id": 151344,
|
||||
"tie_word_embeddings": false,
|
||||
"transformers_version": "4.57.1",
|
||||
"text_config": {
|
||||
"model_type": "glm4v_text",
|
||||
"attention_bias": true,
|
||||
"attention_dropout": 0.0,
|
||||
"pad_token_id": 151329,
|
||||
@ -12,12 +22,6 @@
|
||||
151338,
|
||||
151348
|
||||
],
|
||||
"image_start_token_id": 151339,
|
||||
"image_end_token_id": 151340,
|
||||
"video_start_token_id": 151341,
|
||||
"video_end_token_id": 151342,
|
||||
"image_token_id": 151343,
|
||||
"video_token_id": 151344,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
@ -27,14 +31,22 @@
|
||||
"num_hidden_layers": 40,
|
||||
"num_key_value_heads": 2,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_theta": 10000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.53.0dev",
|
||||
"dtype": "bfloat16",
|
||||
"use_cache": true,
|
||||
"vocab_size": 151552,
|
||||
"partial_rotary_factor": 0.5,
|
||||
"rope_theta": 10000,
|
||||
"rope_scaling": {
|
||||
"rope_type": "default",
|
||||
"mrope_section": [
|
||||
8,
|
||||
12,
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"vision_config": {
|
||||
"model_type": "glm4v",
|
||||
"hidden_size": 1536,
|
||||
"depth": 24,
|
||||
"num_heads": 12,
|
||||
@ -49,13 +61,5 @@
|
||||
"rms_norm_eps": 1e-05,
|
||||
"spatial_merge_size": 2,
|
||||
"temporal_patch_size": 2
|
||||
},
|
||||
"rope_scaling": {
|
||||
"type": "default",
|
||||
"mrope_section": [
|
||||
8,
|
||||
12,
|
||||
12
|
||||
]
|
||||
}
|
||||
}
|
||||
15
generation_config.json
Normal file
15
generation_config.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151329,
|
||||
151336,
|
||||
151338,
|
||||
151348
|
||||
],
|
||||
"pad_token_id": 151329,
|
||||
"top_p": 0.6,
|
||||
"temperature": 0.8,
|
||||
"top_k": 2,
|
||||
"transformers_version": "4.57.1"
|
||||
}
|
||||
BIN
notebook.ipynb
(Stored with Git LFS)
Normal file
BIN
notebook.ipynb
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user