mirror of
https://www.modelscope.cn/ZhipuAI/GLM-4.1V-9B-Thinking.git
synced 2026-04-03 03:22:55 +08:00
Merge branch 'master' of https://www.modelscope.cn/ZhipuAI/GLM-4.1V-9B-Thinking
This commit is contained in:
186
README.md
186
README.md
@ -1,93 +1,93 @@
|
|||||||
---
|
---
|
||||||
license: mit
|
license: mit
|
||||||
---
|
---
|
||||||
|
|
||||||
# GLM-4.1V-9B-Thinking
|
# GLM-4.1V-9B-Thinking
|
||||||
|
|
||||||
<div align="center">
|
<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/THUDM/GLM-4.1V-Thinking/99c5eb6563236f0ff43605d91d107544da9863b2/resources/logo.svg width="40%"/>
|
||||||
</div>
|
</div>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
📖 查看 GLM-4.1V-9B-Thinking <a href="https://arxiv.org/abs/2507.01006" target="_blank">论文</a> 。
|
📖 查看 GLM-4.1V-9B-Thinking <a href="https://arxiv.org/abs/2507.01006" target="_blank">论文</a> 。
|
||||||
<br>
|
<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。
|
💡 立即在线体验 <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>
|
<br>
|
||||||
📍 在 <a href="https://www.bigmodel.cn/dev/api/visual-reasoning-model/GLM-4.1V-Thinking">智谱大模型开放平台</a> 使用 GLM-4.1V-9B-Thinking 的API服务。
|
📍 在 <a href="https://www.bigmodel.cn/dev/api/visual-reasoning-model/GLM-4.1V-Thinking">智谱大模型开放平台</a> 使用 GLM-4.1V-9B-Thinking 的API服务。
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 模型介绍
|
## 模型介绍
|
||||||
|
|
||||||
视觉语言大模型(VLM)已经成为智能系统的关键基石。随着真实世界的智能任务越来越复杂,VLM模型也亟需在基本的多模态感知之外,
|
视觉语言大模型(VLM)已经成为智能系统的关键基石。随着真实世界的智能任务越来越复杂,VLM模型也亟需在基本的多模态感知之外,
|
||||||
逐渐增强复杂任务中的推理能力,提升自身的准确性、全面性和智能化程度,使得复杂问题解决、长上下文理解、多模态智能体等智能任务成为可能。
|
逐渐增强复杂任务中的推理能力,提升自身的准确性、全面性和智能化程度,使得复杂问题解决、长上下文理解、多模态智能体等智能任务成为可能。
|
||||||
|
|
||||||
基于 [GLM-4-9B-0414](https://github.com/THUDM/GLM-4) 基座模型,我们推出新版VLM开源模型 **GLM-4.1V-9B-Thinking**
|
基于 [GLM-4-9B-0414](https://github.com/THUDM/GLM-4) 基座模型,我们推出新版VLM开源模型 **GLM-4.1V-9B-Thinking**
|
||||||
,引入思考范式,通过课程采样强化学习 RLCS(Reinforcement Learning with Curriculum Sampling)全面提升模型能力,
|
,引入思考范式,通过课程采样强化学习 RLCS(Reinforcement Learning with Curriculum Sampling)全面提升模型能力,
|
||||||
达到 10B 参数级别的视觉语言模型的最强性能,在18个榜单任务中持平甚至超过8倍参数量的 Qwen-2.5-VL-72B。
|
达到 10B 参数级别的视觉语言模型的最强性能,在18个榜单任务中持平甚至超过8倍参数量的 Qwen-2.5-VL-72B。
|
||||||
我们同步开源基座模型 **GLM-4.1V-9B-Base**,希望能够帮助更多研究者探索视觉语言模型的能力边界。
|
我们同步开源基座模型 **GLM-4.1V-9B-Base**,希望能够帮助更多研究者探索视觉语言模型的能力边界。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
与上一代的 CogVLM2 及 GLM-4V 系列模型相比,**GLM-4.1V-Thinking** 有如下改进:
|
与上一代的 CogVLM2 及 GLM-4V 系列模型相比,**GLM-4.1V-Thinking** 有如下改进:
|
||||||
|
|
||||||
1. 系列中首个推理模型,不仅仅停留在数学领域,在多个子领域均达到世界前列的水平。
|
1. 系列中首个推理模型,不仅仅停留在数学领域,在多个子领域均达到世界前列的水平。
|
||||||
2. 支持 **64k** 上下长度。
|
2. 支持 **64k** 上下长度。
|
||||||
3. 支持**任意长宽比**和高达 **4k** 的图像分辨率。
|
3. 支持**任意长宽比**和高达 **4k** 的图像分辨率。
|
||||||
4. 提供支持**中英文双语**的开源模型版本。
|
4. 提供支持**中英文双语**的开源模型版本。
|
||||||
|
|
||||||
## 榜单信息
|
## 榜单信息
|
||||||
|
|
||||||
GLM-4.1V-9B-Thinking 通过引入「思维链」(Chain-of-Thought)推理机制,在回答准确性、内容丰富度与可解释性方面,
|
GLM-4.1V-9B-Thinking 通过引入「思维链」(Chain-of-Thought)推理机制,在回答准确性、内容丰富度与可解释性方面,
|
||||||
全面超越传统的非推理式视觉模型。在28项评测任务中有23项达到10B级别模型最佳,甚至有18项任务超过8倍参数量的Qwen-2.5-VL-72B。
|
全面超越传统的非推理式视觉模型。在28项评测任务中有23项达到10B级别模型最佳,甚至有18项任务超过8倍参数量的Qwen-2.5-VL-72B。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 快速推理
|
## 快速推理
|
||||||
|
|
||||||
这里展现了一个使用`transformers`进行单张图片推理的代码。首先,从源代码安装`transformers`库。
|
这里展现了一个使用`transformers`进行单张图片推理的代码。首先,从源代码安装`transformers`库。
|
||||||
```
|
```
|
||||||
pip install git+https://github.com/huggingface/transformers.git
|
pip install git+https://github.com/huggingface/transformers.git
|
||||||
```
|
```
|
||||||
|
|
||||||
接着按照以下代码运行:
|
接着按照以下代码运行:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from transformers import AutoProcessor, Glm4vForConditionalGeneration
|
from transformers import AutoProcessor, Glm4vForConditionalGeneration
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
MODEL_PATH = "THUDM/GLM-4.1V-9B-Thinking"
|
MODEL_PATH = "THUDM/GLM-4.1V-9B-Thinking"
|
||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": [
|
"content": [
|
||||||
{
|
{
|
||||||
"type": "image",
|
"type": "image",
|
||||||
"url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Grayscale_8bits_palette_sample_image.png"
|
"url": "https://model-demo.oss-cn-hangzhou.aliyuncs.com/Grayscale_8bits_palette_sample_image.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": "describe this image"
|
"text": "describe this image"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
|
processor = AutoProcessor.from_pretrained(MODEL_PATH, use_fast=True)
|
||||||
model = Glm4vForConditionalGeneration.from_pretrained(
|
model = Glm4vForConditionalGeneration.from_pretrained(
|
||||||
pretrained_model_name_or_path=MODEL_PATH,
|
pretrained_model_name_or_path=MODEL_PATH,
|
||||||
torch_dtype=torch.bfloat16,
|
torch_dtype=torch.bfloat16,
|
||||||
device_map="auto",
|
device_map="auto",
|
||||||
)
|
)
|
||||||
inputs = processor.apply_chat_template(
|
inputs = processor.apply_chat_template(
|
||||||
messages,
|
messages,
|
||||||
tokenize=True,
|
tokenize=True,
|
||||||
add_generation_prompt=True,
|
add_generation_prompt=True,
|
||||||
return_dict=True,
|
return_dict=True,
|
||||||
return_tensors="pt"
|
return_tensors="pt"
|
||||||
).to(model.device)
|
).to(model.device)
|
||||||
generated_ids = model.generate(**inputs, max_new_tokens=8192)
|
generated_ids = model.generate(**inputs, max_new_tokens=8192)
|
||||||
output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
|
output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
|
||||||
print(output_text)
|
print(output_text)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
视频推理,网页端Demo部署等更代码请查看我们的 [github](https://github.com/THUDM/GLM-4.1V-Thinking)。
|
视频推理,网页端Demo部署等更代码请查看我们的 [github](https://github.com/THUDM/GLM-4.1V-Thinking)。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user