Model
zai-org

zai-org/glm-4v-9b

GLM-4V-9B Read this in English(READMEen.md) 2024/08/12, 本仓库代码已更新并使用 transforemrs=4.44.0, 请及时更新依赖。 GLM-4V-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开源多模态版本。 GLM-4V-9B 具备 1120 1120 高分辨率下的中英双语多轮对话能力,在中英文综合能力、感知推理、文字识别、图表理解等多方面多模态评测中,GLM-4V-9B 表现出超越 GPT-4-turbo-...

269likes
11.0kdownloads
1views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: thudm

#1 Repository of the month

1
TINIX TRENDING·Topic: arxiv:2311.03079

#1 Repository of the month

1
TINIX TRENDING·Topic: arxiv:2406.12793

#1 Repository of the month

GLM-4V-9B

Read this in English

2024/08/12, 本仓库代码已更新并使用 transforemrs>=4.44.0, 请及时更新依赖。

GLM-4V-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开源多模态版本。 GLM-4V-9B 具备 1120 * 1120 高分辨率下的中英双语多轮对话能力,在中英文综合能力、感知推理、文字识别、图表理解等多方面多模态评测中,GLM-4V-9B 表现出超越 GPT-4-turbo-2024-04-09、Gemini 1.0 Pro、Qwen-VL-Max 和 Claude 3 Opus 的卓越性能。

多模态能力

GLM-4V-9B 是一个多模态语言模型,具备视觉理解能力,其相关经典任务的评测结果如下:

MMBench-EN-TestMMBench-CN-TestSEEDBench_IMGMMStarMMMUMMEHallusionBenchAI2DOCRBench
英文综合中文综合综合能力综合能力学科综合感知推理幻觉性图表理解文字识别
GPT-4o, 2024051383.482.177.163.969.22310.35584.6736
GPT-4v, 202404098180.2735661.72070.243.978.6656
GPT-4v, 202311067774.472.349.753.81771.546.575.9516
InternVL-Chat-V1.582.380.775.257.146.82189.647.480.6720
LlaVA-Next-Yi-34B81.17975.751.648.82050.234.878.9574
Step-1V80.779.970.35049.92206.448.479.2625
MiniCPM-Llama3-V2.577.673.872.351.845.82024.642.478.4725
Qwen-VL-Max77.675.772.749.5522281.741.275.7684
GeminiProVision73.674.370.738.6492148.945.772.9680
Claude-3V Opus63.359.26445.754.91586.837.870.6694
GLM-4v-9B81.179.476.858.747.22163.846.681.1786

本仓库是 GLM-4V-9B 的模型仓库,支持8K上下文长度。

运行模型

更多推理代码和依赖信息,请访问我们的 github。

请严格按照依赖安装,否则无法正常运行。 。

import torch
from PIL import Image
from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda"

tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4v-9b", trust_remote_code=True)

query = '描述这张图片'
image = Image.open("your image").convert('RGB')
inputs = tokenizer.apply_chat_template([{"role": "user", "image": image, "content": query}],
                                       add_generation_prompt=True, tokenize=True, return_tensors="pt",
                                       return_dict=True)  # chat mode

inputs = inputs.to(device)
model = AutoModelForCausalLM.from_pretrained(
    "THUDM/glm-4v-9b",
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True
).to(device).eval()

gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1}
with torch.no_grad():
    outputs = model.generate(**inputs, **gen_kwargs)
    outputs = outputs[:, inputs['input_ids'].shape[1]:]
    print(tokenizer.decode(outputs[0]))

协议

GLM-4 模型的权重的使用则需要遵循 LICENSE。

引用

如果你觉得我们的工作有帮助的话,请考虑引用下列论文。

@misc{glm2024chatglm,
      title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools}, 
      author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
      year={2024},
      eprint={2406.12793},
      archivePrefix={arXiv},
      primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
}
@misc{wang2023cogvlm,
      title={CogVLM: Visual Expert for Pretrained Language Models}, 
      author={Weihan Wang and Qingsong Lv and Wenmeng Yu and Wenyi Hong and Ji Qi and Yan Wang and Junhui Ji and Zhuoyi Yang and Lei Zhao and Xixuan Song and Jiazheng Xu and Bin Xu and Juanzi Li and Yuxiao Dong and Ming Ding and Jie Tang},
      year={2023},
      eprint={2311.03079},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Similar Projects

Discover other similar projects and AI models.

Model
zai-org/chatglm-6b

ChatGLM-6B 🌐 Blog • 💻 Github Repo • 🐦 Twitter • 📃 GLM@ACL 22 GitHub • 📃 GLM-130B@ICLR 23 GitHub 👋 Join our Slack and WeChat 📍Experience the larger-scale ChatGLM model at chatglm.cn 我们发布了 ChatGLM2-6B(https://github.com/THUDM/ChatGLM2-6B),ChatG...

♥0
1.6k
Aug 4, 2024
Model
zai-org/chatglm2-6b

ChatGLM2-6B 💻 Github Repo • 🐦 Twitter • 📃 GLM@ACL 22 GitHub • 📃 GLM-130B@ICLR 23 GitHub 👋 Join our Slack and WeChat 📍Experience the larger-scale ChatGLM model at chatglm.cn 介绍 ChatGLM2-6B 是开源中英双语对话模型 ChatGLM-6B(https://github.com/THUDM/ChatGLM...

♥0
337.7k
Aug 4, 2024
Modelautomatic-speech-recognition
openai/whisper-large-v3

Whisper Whisper is a state-of-the-art model for automatic speech recognition (ASR) and speech translation, proposed in the paper Robust Speech Recognition via Large-Scale Weak Supervision(https://huggingface.co/papers/2212.04356) by Alec Radford et...

♥0
3.0M
Aug 12, 2024
Modeltext-generation
xtools-at/DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic

This is a decensored version of Jackrong/DeepSeek-V4-Pro-Qwen3.5-9B(https://huggingface.co/Jackrong/DeepSeek-V4-Pro-Qwen3.5-9B), made using Heretic(https://heretic-project.org) v2.0.0.dev0 Arbitrary-Rank Ablation (ARA) parameters | Parameter | Value...

♥0
48.8k
Nov 12, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
Modelimage-text-to-text
moonshotai/Kimi-K3

📰  Tech Blog |     📄  Full Report 1. Model Introduction Kimi K3 is an open-weight, native multimodal agentic model and our most capable model to date. It is a 2.8T-parameter model built on Kimi Delta Attention (K...

♥0
498.3k
Sep 2, 2026
Modelmask-generation
facebook/sam3

SAM 3 is a unified foundation model for promptable segmentation in images and videos. It can detect, segment, and track objects using text or visual prompts such as points, boxes, and masks. Compared to its predecessor SAM 2(https://github.com/facebo...

♥0
1.6M
Nov 20, 2025
Modelimage-to-video
Lightricks/LTX-2.5

LTX-2.5 — Video, Audio & World Simulation Full control and customization — self-host on your infrastructure. Homepage Docs GitHub Research API Playground Discord LTX License LTX-2.5 — Video, Audio & World Simulation Full control and customiz...

♥0
3.1M
Nov 26, 2026
Modelimage-text-to-text
baidu/Unlimited-OCR

Unlimited OCR Works Welcome the Era of One-shot Long-horizon Parsing. Release - 2026/06/23 📄 Our paper is now available on arXiv(https://arxiv.org/abs/2606.23050). - 2026/06/23 🤝 Thanks to the ModelScope community for their support. Our model is n...

♥0
5.1M
Oct 14, 2026