alt.freeweights.glm / cogvlm-chat-hf
From: zai-org <huggingface.co/zai-org>Newsgroups: alt.freeweights.glmSubject:

cogvlm-chat-hf

Date: 2026-11-14Commit: e29dc3bSigned: 2DC28CC7B26A283B ✓

Text generation model with 17.6B parameters. Safetensors weights, 35.3 GB in all. Published by zai-org under Apache-2.0.

17.6B params35.3GBcogvlm-chat-hfsafetensorspermissive
FactsParams17.6BSize35.3 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get zai-org/cogvlm-chat-hf
# manifest sha256 1e35144d7b1b… · 35.3 GB · 16 files
$ fw verify ./cogvlm-chat-hf zai-org/cogvlm-chat-hf
From sourceHosted (signed)zai-org/cogvlm-chat-hfLast check: 2026-11-14 21:26 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Overview

Size
35.3 GB
Weights
35.3 GB (safetensors)
Parameters
17.6B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
16, each with a sha256
Publisher
zai-org
Added
2026-11-14
Section
alt.freeweights.glm
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:26 UTCpassed

Model card

From the publisher at commit e29dc3b. Shown as plain text with links; images open at the publisher.

CogVLM#

CogVLM 是一个强大的开源视觉语言模型(VLM)。CogVLM-17B 拥有 100 亿视觉参数和 70 亿语言参数,在 10 个经典跨模态基准测试上取得了 SOTA 性能,包括 NoCaps、Flicker30k captioning、RefCOCO、RefCOCO+、RefCOCOg、Visual7W、GQA、ScienceQA、VizWiz VQA 和 TDIUC,而在 VQAv2、OKVQA、TextVQA、COCO captioning 等方面则排名第二,超越或与 PaLI-X 55B 持平。您可以通过线上 demo 体验 CogVLM 多模态对话。

CogVLM is a powerful open-source visual language model (VLM). CogVLM-17B has 10 billion vision parameters and 7 billion language parameters. CogVLM-17B achieves state-of-the-art performance on 10 classic cross-modal benchmarks, including NoCaps, Flicker30k captioning, RefCOCO, RefCOCO+, RefCOCOg, Visual7W, GQA, ScienceQA, VizWiz VQA and TDIUC, and rank the 2nd on VQAv2, OKVQA, TextVQA, COCO captioning, etc., surpassing or matching PaLI-X 55B. CogVLM can also chat with you about images.

Image: img

以上权重对学术研究完全开放,在填写问卷进行登记后亦允许免费商业使用。

快速开始(Qiuckstart)#

硬件需求(hardware requirement)

需要近 40GB GPU 显存用于模型推理。如果没有一整块GPU显存超过40GB,则需要使用accelerate的将模型切分到多个有较小显存的GPU设备上。

40GB VRAM for inference. If there is no single GPU with more than 40GB of VRAM, you will need to use the "accelerate" library to dispatch the model into multiple GPUs with smaller VRAM.

安装依赖(dependencies)

pip install torch==2.1.0 transformers==4.35.0 accelerate==0.24.1 sentencepiece==0.1.99 einops==0.7.0 xformers==0.0.22.post7 triton==2.1.0

代码示例(example)

import torch
import requests
from PIL import Image
from transformers import AutoModelForCausalLM, LlamaTokenizer

tokenizer = LlamaTokenizer.from_pretrained('lmsys/vicuna-7b-v1.5')
model = AutoModelForCausalLM.from_pretrained(
    'THUDM/cogvlm-chat-hf',
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True
).to('cuda').eval()


# chat example
query = 'Describe this image'
image = Image.open(requests.get('https://github.com/THUDM/CogVLM/blob/main/examples/1.png?raw=true', stream=True).raw).convert('RGB')
inputs = model.build_conversation_input_ids(tokenizer, query=query, history=[], images=[image])  # chat mode
inputs = {
    'input_ids': inputs['input_ids'].unsqueeze(0).to('cuda'),
    'token_type_ids': inputs['token_type_ids'].unsqueeze(0).to('cuda'),
    'attention_mask': inputs['attention_mask'].unsqueeze(0).to('cuda'),
    'images': [[inputs['images'][0].to('cuda').to(torch.bfloat16)]],
}
gen_kwargs = {"max_length": 2048, "do_sample": False}

with torch.no_grad():
    outputs = model.generate(**inputs, **gen_kwargs)
    outputs = outputs[:, inputs['input_ids'].shape[1]:]
    print(tokenizer.decode(outputs[0]))

# This image captures a moment from a basketball game. Two players are prominently featured: one wearing a yellow jersey with the number
# 24 and the word 'Lakers' written on it, and the other wearing a navy blue jersey with the word 'Washington' and the number 34. The player
# in yellow is holding a basketball and appears to be dribbling it, while the player in navy blue is reaching out with his arm, possibly
# trying to block or defend. The background shows a filled stadium with spectators, indicating that this is a professional game.</s>



# vqa example
query = 'How many houses are there in this cartoon?'
image = Image.open(requests.get('https://github.com/THUDM/CogVLM/blob/main/examples/3.jpg?raw=true', stream=True).raw).convert('RGB')
inputs = model.build_conversation_input_ids(tokenizer, query=query, history=[], images=[image], template_version='vqa')   # vqa mode
inputs = {
    'input_ids': inputs['input_ids'].unsqueeze(0).to('cuda'),
    'token_type_ids': inputs['token_type_ids'].unsqueeze(0).to('cuda'),
    'attention_mask': inputs['attention_mask'].unsqueeze(0).to('cuda'),
    'images': [[inputs['images'][0].to('cuda').to(torch.bfloat16)]],
}
gen_kwargs = {"max_length": 2048, "do_sample": False}

with torch.no_grad():
    outputs = model.generate(**inputs, **gen_kwargs)
    outputs = outputs[:, inputs['input_ids'].shape[1]:]
    print(tokenizer.decode(outputs[0]))

# 4</s>

当单卡显存不足时,可以将模型切分到多个小显存GPU上。以下是个当你有两张24GB的GPU,16GBCPU内存的例子。 你可以将infer_auto_device_map的参数改成你的配置。注意这里将GPU显存少写了一点,这是为推理时中间状态预留出一部分显存。

dispatch the model into multiple GPUs with smaller VRAM. This is an example for you have two 24GB GPU and 16GB CPU memory. you can change the arguments of infer_auto_device_map with your own setting.

import torch
import requests
from PIL import Image
from transformers import AutoModelForCausalLM, LlamaTokenizer
from accelerate import init_empty_weights, infer_auto_device_map, load_checkpoint_and_dispatch

tokenizer = LlamaTokenizer.from_pretrained('lmsys/vicuna-7b-v1.5')
with init_empty_weights():
    model = AutoModelForCausalLM.from_pretrained(
        'THUDM/cogvlm-chat-hf',
        torch_dtype=torch.bfloat16,
        low_cpu_mem_usage=True,
        trust_remote_code=True,
    )
device_map = infer_auto_device_map(model, max_memory={0:'20GiB',1:'20GiB','cpu':'16GiB'}, no_split_module_classes=['CogVLMDecoderLayer', 'TransformerLayer'])
model = load_checkpoint_and_dispatch(
    model,
    'local/path/to/hf/version/chat/model',   # typical, '~/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/balabala'
    device_map=device_map,
)
model = model.eval()

# check device for weights if u want to
for n, p in model.named_parameters():
    print(f"{n}: {p.device}")

# chat example
query = 'Describe this image'
image = Image.open(requests.get('https://github.com/THUDM/CogVLM/blob/main/examples/1.png?raw=true', stream=True).raw).convert('RGB')
inputs = model.build_conversation_input_ids(tokenizer, query=query, history=[], images=[image])  # chat mode
inputs = {
    'input_ids': inputs['input_ids'].unsqueeze(0).to('cuda'),
    'token_type_ids': inputs['token_type_ids'].unsqueeze(0).to('cuda'),
    'attention_mask': inputs['attention_mask'].unsqueeze(0).to('cuda'),
    'images': [[inputs['images'][0].to('cuda').to(torch.bfloat16)]],
}
gen_kwargs = {"max_length": 2048, "do_sample": False}

with torch.no_grad():
    outputs = model.generate(**inputs, **gen_kwargs)
    outputs = outputs[:, inputs['input_ids'].shape[1]:]
    print(tokenizer.decode(outputs[0]))

方法(Method)#

CogVLM 模型包括四个基本组件:视觉变换器(ViT)编码器、MLP适配器、预训练的大型语言模型(GPT)和一个视觉专家模块。更多细节请参见Paper。

CogVLM model comprises four fundamental components: a vision transformer (ViT) encoder, an MLP adapter, a pretrained large language model (GPT), and a visual expert module. See Paper for more details.

Image: image

许可(License)#

此存储库中的代码是根据 Apache-2.0 许可 开放源码,而使用 CogVLM 模型权重必须遵循 模型许可。

The code in this repository is open source under the Apache-2.0 license, while the use of the CogVLM model weights must comply with the Model License.

引用(Citation)#

If you find our work helpful, please consider citing the following papers

@article{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}
}

Files

16 files · 35.3 GBWeights 35.3 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 16 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md8.70 KB902aecca0bb5c68afcad8e02062605f26beb29b6c6d13a8adeff7cd8eadbe5dd
config.json994 B36e3d421f619f0e96ef1ad96628e176cb604b754ae91aba509b8c859c0c8234c
configuration_cogvlm.py1.51 KBa30b92835cb79a57ec6b4fa2c533993056ca0ac71053575e635ed64393eba3d9
generation_config.json132 Bee3e5c066bd362ffef25af83a590e87022b58cde1864f3d85779000f62eed594
model-00001-of-00008.safetensors4.94 GBe29f6ec471ca55789ab14947b527729b9c30313ceb1e7726590b85f9f6406cca
model-00002-of-00008.safetensors4.95 GBe82356882701b1a778408f31e676d17c2aff799c543e8596ed74bc805b4a1213
model-00003-of-00008.safetensors4.95 GB04096f84f42798d0c89319ff8254995a2a3512c16ec88dfd078ce421867d92ec
model-00004-of-00008.safetensors4.99 GB2b42af0bb16647959b3e55def4b3c66ab8c3a25fd948a5245c81d070f2b4313d
model-00005-of-00008.safetensors4.99 GB38c07825790e055dd169376479994a58a4f59775ba7cf31d5ca25d8a465e7b0c
model-00006-of-00008.safetensors4.97 GBd01880ca5677e69a5f8632f9dda62814f0c549b5a40d4f7e136065e5d64c1a7d
model-00007-of-00008.safetensors4.96 GBe70b0e10d2ac8800e69e514b6a9b04ac28cd7db43985ce62daa4e0e639b4e5ba
model-00008-of-00008.safetensors533 MBa756381ef65b92af7f1fb97da3d59cb04586080982de86d76805299898223294
model.safetensors.index.json116 KB5cd329bd2bd797c18d9fbffb6814a27a68935164125f0c3030018041ffcdaa72
modeling_cogvlm.py35.9 KB2b1a7ad0c854414fffe460525c6bb158648ab81da46e637bb2020e605c0b5629
visual.py5.38 KBd8ba367c364ccf3fda6d5c15b177b593c6375f034c432ac4cd5d339e225c39a0
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
e29dc3ba20 pinned now manifest updated, same commit2026-11-14 21:26 UTC16 files · 35.3 GB
e29dc3ba202026-11-14 21:26 UTC16 files · 35.3 GB

Use it

$ fw get zai-org/cogvlm-chat-hf
# manifest sha256 1e35144d7b1b… · 35.3 GB · 16 files
$ fw verify ./cogvlm-chat-hf zai-org/cogvlm-chat-hf
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/zai-org/cogvlm-chat-hf.json --dir ./cogvlm-chat-hf $ python3 fw.py verify ./cogvlm-chat-hf ./zai-org__cogvlm-chat-hf.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download zai-org/cogvlm-chat-hf --revision e29dc3ba206d524bf8efbfc60d80fc4556ab0e3c --local-dir ./cogvlm-chat-hf
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("zai-org/cogvlm-chat-hf", revision="e29dc3ba206d524bf8efbfc60d80fc4556ab0e3c") model = AutoModelForCausalLM.from_pretrained("zai-org/cogvlm-chat-hf", revision="e29dc3ba206d524bf8efbfc60d80fc4556ab0e3c", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve zai-org/cogvlm-chat-hf --revision e29dc3ba206d524bf8efbfc60d80fc4556ab0e3c

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
902aecca0bb5c68afcad8e02062605f26beb29b6c6d13a8adeff7cd8eadbe5dd
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: zai-org <huggingface.co/zai-org>Newsgroups: alt.freeweights.glmSubject: cogvlm-chat-hfDate: 2026-11-14Commit: e29dc3bSigned: 2DC28CC7B26A283B ✓
Upstream
zai-org/cogvlm-chat-hf
Pinned commit
e29dc3ba206d524bf8efbfc60d80fc4556ab0e3c
Manifest
cogvlm-chat-hf.json · .minisig
Manifest sha256
1e35144d7b1bd1fdd1b924758d8a3be9e4b1f96b2226b89bde8675e08b23818d
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:26 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/zai-org/cogvlm-chat-hf.json $ curl -O https://freeweights.allternit.com/manifests/zai-org/cogvlm-chat-hf.json.minisig $ minisign -Vm cogvlm-chat-hf.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download zai-org/cogvlm-chat-hf
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. cogvlm-chat-hf.json. Provenance. Takedown history: none.
From: bartowski <huggingface.co/bartowski>Subject: arcee-ai_GLM-4-32B-Base-32K-GGUF
From: ggml-org <huggingface.co/ggml-org>Subject: AutoGLM-Phone-9B-GGUF
From: zai-org <huggingface.co/zai-org>Subject: cogagent-chat-hf
From: zai-org <huggingface.co/zai-org>Subject: CogView3-Plus-3B
From: zai-org <huggingface.co/zai-org>Subject: cogvlm-base-490-hf
From: laion <huggingface.co/laion>Subject: dev_set_part1_10k_glm_4_7_traces_jupiter