baseten/GLM-5.2-Vision-NVFP4

Hugging Face Models Trending 模型

摘要

Baseten 发布了 GLM-5.2-Vision,这是一个视觉语言模型,通过训练好的 PatchMerger 投影器将 MoonViT 视觉编码器添加到 GLM-5.2,同时保持文本主干和视觉塔冻结。该模型被量化到 NVFP4,以在 Blackwell 硬件上进行高效推理。

任务:图像-文本到文本 Tags: sglang, safetensors, glm5v, multimodal, vision-language, glm, image-text-to-text, conversational, custom_code, base_model:zai-org/GLM-5.2, base_model:quantized:zai-org/GLM-5.2, license:mit, 8-bit, modelopt, region:us
查看原文
查看缓存全文

缓存时间: 2026/07/24 10:59

baseten/GLM-5.2-Vision-NVFP4 · Hugging Face

来源:https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4 **带视觉能力的GLM-5.2。**一个视觉语言模型,通过经过训练的PatchMerger投影器,将Kimi-K2.6(https://huggingface.co/moonshotai/Kimi-K2.6)中的MoonViT视觉编码器与GLM-5.2(https://huggingface.co/zai-org/GLM-5.2)对接。

GLM-5.2是一个强大的开放推理模型,没有视觉输入。这个检查点为其添加了视觉能力,且未改动任何GLM权重:文本骨干网络和视觉塔均被冻结,与上游版本字节级一致。唯一新训练的参数是49.5M参数的投影器,它将MoonViT的1152维patch嵌入映射到GLM的6144维token空间。

组件详情
文本骨干网络GLM-5.2(总744B / 激活40B,MoE + MLA + DSA稀疏注意力)— 已冻结
视觉塔来自Kimi-K2.6的MoonViT-3d,27层,1152维 — 已冻结
投影器PatchMerger MLP(pre_norm → linear_1 → GELU → linear_2),1152→4608→6144 — 已训练
文本权重NVFP4,来自 nvidia/GLM-5.2-NVFP4(https://huggingface.co/nvidia/GLM-5.2-NVFP4)
大小~466 GB
硬件8×B200,或4×B200(上下文256k)— 仅限Blackwell
图像token每张图像最多4096个(16384个MoonViT patch,2×2合并)
最大上下文1048576(1M tokens)

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#quickstart 快速上手

由于 Glm5vForConditionalGeneration 尚未成为上游架构,SGLang需要一个小的外部插件。该插件包含在此仓库中,无需额外克隆:

uvx --from huggingface-hub hf download baseten/GLM-5.2-Vision-NVFP4 \ --include 'plugins/*' --local-dir ./glm5v uv pip install ./glm5v/plugins

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#sglang SGLang

export SGLANG_EXTERNAL_MODEL_PACKAGE=sglang_glm5v export SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE=sglang_glm5v export SGLANG_EXTERNAL_MM_MODEL_ARCH=Glm5vForConditionalGeneration python -m sglang_glm5v.patch

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#8%C3%97b200–full-1m-context 8×B200 — 完整1M上下文

python -m sglang.launch_server \ --model-path baseten/GLM-5.2-Vision-NVFP4 --trust-remote-code \ --tp-size 8 \ --quantization modelopt_fp4 \ --disable-shared-experts-fusion --disable-flashinfer-autotune \ --attention-backend dsa --mm-attention-backend sdpa \ --kv-cache-dtype fp8_e4m3 --page-size 64 \ --mem-fraction-static 0.85 \ --context-length 1048576 \ --reasoning-parser glm45 --tool-call-parser glm47 \ --served-model-name glm-5.2-vision \ --port 30000

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#4%C3%97b200–256k-context 4×B200 — 256k上下文

相同命令,使用 --tp-size 4、更高的内存比例和更小的上下文:

python -m sglang.launch_server \ --model-path baseten/GLM-5.2-Vision-NVFP4 --trust-remote-code \ --tp-size 4 \ --quantization modelopt_fp4 \ --disable-shared-experts-fusion --disable-flashinfer-autotune \ --attention-backend dsa --mm-attention-backend sdpa \ --kv-cache-dtype fp8_e4m3 --page-size 64 \ --mem-fraction-static 0.90 \ --context-length 262144 \ --reasoning-parser glm45 --tool-call-parser glm47 \ --served-model-name glm-5.2-vision \ --port 30000

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#query-it 查询模型

标准的OpenAI多模态消息通过 image_url 传递图像:

`` from openai import OpenAI

client = OpenAI(base_url=“http://localhost:30000/v1”, api_key=“none”) r = client.chat.completions.create( model=“glm-5.2-vision”, messages=[{“role”: “user”, “content”: [ {“type”: “image_url”, “image_url”: {“url”: “https://ultralytics.com/images/bus.jpg”}}, {“type”: “text”, “text”: “详细描述这张图片。”}, ]}], temperature=1.0, top_p=0.95, max_tokens=512, ) print(r.choices[0].message.content) ``

GLM-5.2是一个推理模型:使用 --reasoning-parser glm45 时,思维链出现在 message.reasoning_content 中,答案在 message.content 中。

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#deploy-on-baseten 在Baseten上部署

仓库包含可直接推送的 Truss(https://truss.baseten.co/)配置。您只需要自己的Baseten账户的API密钥;不需要Hugging Face令牌或预先创建的Baseten密钥。

  1. 安装 uv(https://docs.astral.sh/uv/getting-started/installation/)并创建Baseten API密钥。
  2. 导出密钥,下载小的Truss目录,然后部署两个配置之一:

`` export BASETEN_API_KEY=“your-baseten-api-key” uvx truss login –api-key “$BASETEN_API_KEY” –remote baseten –non-interactive

uvx –from huggingface-hub hf download baseten/GLM-5.2-Vision-NVFP4
–include ‘truss/*’ –local-dir ./glm5v cd glm5v/truss

推荐起点:4×B200 和 256k 上下文。

uvx truss push –remote baseten –config config_nvfp4_4gpu.yaml –wait –output json

或者使用 8×B200 获得完整的 1M-token 上下文。

uvx truss push –remote baseten –config config_nvfp4.yaml –wait –output json

``

该命令将在您的Baseten账户中创建一个新模型和已发布的部署,并输出包含 model_id、model_version_id、predict_url 和 logs_url 的JSON。它不会将部署升级到生产环境。

将 PREDICT_URL 设置为返回的 predict_url,然后查询模型:

`` export PREDICT_URL=“https://model-…api.baseten.co/deployment/…/predict”

curl -fsS “$PREDICT_URL”
-H “Authorization: Api-Key $BASETEN_API_KEY”
-H “Content-Type: application/json”
-d ‘{ “model”: “glm-5.2-vision”, “messages”: [{ “role”: “user”, “content”: [ {“type”: “image_url”, “image_url”: {“url”: “https://ultralytics.com/images/bus.jpg”}}, {“type”: “text”, “text”: “详细描述这张图片。”} ] }], “max_tokens”: 512, “temperature”: 1.0, “top_p”: 0.95 }’ ``

首次部署将下载约466 GB的权重并初始化SGLang,因此启动可能需要几分钟。

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#license 许可证

MIT,遵循两个上游项目:GLM-5.2(MIT)和Kimi-K2.6(修改版MIT)。投影器权重以MIT许可发布。重新分发的上游权重保持其原始条款。

https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4#acknowledgements 致谢

基于 Z.ai(https://huggingface.co/zai-org)的GLM-5.2和 Moonshot AI(https://huggingface.co/moonshotai)的Kimi-K2.6构建。两个团队均未参与此项工作;请勿就此检查点的问题联系他们。

相似文章

Hugging Face 上带视觉能力的 GLM 5.2

Reddit r/LocalLLaMA

Baseten 在 Hugging Face 上发布了 GLM 5.2 Vision,将 Kimi k2.6 的视觉编码器集成到 GLM 5.2 模型中,解决了缺乏视觉能力的问题。

nvidia/GLM-5.2-NVFP4

Hugging Face Models Trending

NVIDIA 发布了 GLM-5.2-NVFP4,这是 ZAI 的 GLM-5.2 MoE 语言模型的量化版本,使用 Model Optimizer 进行了优化,适用于 NVIDIA Blackwell GPU 上的推理。

cuuupid/glm-4v-9b

Replicate Explore

GLM-4V-9B 是Zhipu AI开发的一款开源视觉语言模型,据称在多模态评估中性能优于GPT-4-turbo和Gemini 1.0 Pro等模型。