CohereLabs/command-a-plus-05-2026-w4a4
摘要
CohereLabs 发布了 Command A+,一个开源的 25B 活跃参数模型,针对智能体、多语言和推理任务进行了优化,支持视觉功能,采用 Apache 2.0 许可证。
任务:image-text-to-text
标签:transformers, safetensors, cohere2_vision, image-text-to-text, conversational, chat, en, ar, bg, bn, ca, cs, da, de, el, es, et, fa, fi, fil, fr, ga, he, hi, hr, hu, id, is, it, ja, ko, lt, lv, ms, mt, nl, no, pa, pl, pt, ro, ru, sk, sl, sr, sv, ta, te, th, tr, uk, ur, vi, zh, 基础模型:CohereLabs/command-a-plus-05-2026-bf16, 基础模型(量化):CohereLabs/command-a-plus-05-2026-bf16, 许可证:apache-2.0, 8位, 压缩张量, 区域:us
查看缓存全文
缓存时间: 2026/05/21 06:35
CohereLabs/command-a-plus-05-2026-w4a4 · Hugging Face 来源:https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4 ## https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4#model-card-for-command-aCommand A+ 模型卡 ## https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4#model-summary模型概述 Command A+ 是一个开源模型,拥有 250 亿活跃参数和 2180 亿总参数,专为智能体、多语言和深度推理任务优化,聚焦企业级性能,同时支持视觉输入以处理图像。 开发者:Cohere (https://cohere.com/) 和 Cohere Labs (https://cohere.com/research) - 联系人:Cohere Labs (https://cohere.com/research) - 许可证:Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) - 模型:command-a-plus-05-2026 - 模型大小:250 亿活跃参数,2180 亿总参数 - 上下文长度:128K 输入 更多详情请查看我们的博客文章 (http://cohere.com/blog/command-a-plus)。在下载权重之前,您可以在我们托管的 Hugging Face Space (https://huggingface.co/spaces/CohereLabs/command-a-plus-05-2026) 中试用 Command A+。 可用量化版本 以下量化版本可用,并附有示例最低 GPU 需求。所有三种量化版本在基准测试质量和性能上的差异极小。 我们对大多数使用场景推荐 W4A4 (https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4) 量化方案,它具有更优的速度和延迟特性,且硬件占用更小。 更多详情请查看我们的博客文章 (http://cohere.com/blog/command-a-plus)。 用法 Transformers 请从包含此模型必要更改的源仓库中安装 transformers。 # pip install transformers from transformers import AutoTokenizer, AutoModelForImageTextToText model_id = "CohereLabs/command-a-plus-05-2026-w4a4" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForImageTextToText.from_pretrained(model_id) # Format message with the command-a-plus-05-2026-w4a4 chat template messages = [{"role": "user", "content": "What has keys but can't open locks?"}] input_ids = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt", ) gen_tokens = model.generate( input_ids, max_new_tokens=4096, do_sample=True, temperature=0.6, top_p=0.95 ) gen_text = tokenizer.decode(gen_tokens[0]) print(gen_text) 这样您会得到类似如下的输出,其中思考过程在 和 之间生成: <|START_THINKING|>The user asks a riddle: "What has keys but can't open locks?" The answer is a piano (or keyboard). So respond with answer.<|END_THINKING|> 您也可以直接使用 transformers 的 pipeline 抽象: from transformers import pipeline import torch model_id = "CohereLabs/command-a-plus-05-2026-w4a4" tokenizer = AutoTokenizer.from_pretrained(model_id) pipe = pipeline( "text-generation", model=model_id, dtype="auto", device_map="auto", ) messages = [ {"role": "user", "content": "Explain the Transformer architecture"}, ] text = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, ) outputs = pipe( messages, max_new_tokens=300, ) print(outputs[0]["generated_text"][-1]) vLLM — W4A4 特殊说明 Command A+ w4a4 仅能在 vLLM >= 0.21.0 上运行。W4A4 及精确的响应解析还需要安装 Cohere 的 melody 库。 uv pip install vllm>=0.21.0 uv pip install transformers uv pip install cohere_melody>=0.9.0 然后可以使用以下命令启动 vLLM 服务器: # This is for B200, adjust tp for your device vllm serve CohereLabs/command-a-plus-05-2026-w4a4 -tp 1 --tool-call-parser cohere_command4 --reasoning-parser cohere_command4 --enable-auto-tool-choice 我们建议在生成时使用以下采样参数:temperature=0.9、top_p=0.95、repetition_penalty=1.04。 量化方法: 推理模型承受着不成比例的量化代价:长解码轨迹会累积每个 token 的错误,因此简单的低位转换通常会在困难基准测试上出现明显的性能下降。为解决此问题,我们选择性地进行量化,并使用蒸馏来缩小残留的质量差距。我们对 MoE 专家层应用 NVFP4 W4A4 量化(4 位权重和激活,采用两级缩放)。注意力路径(即 Q/K/V/O 投影、KV 缓存和注意力计算)保持全精度。MoE 专家层占用了绝大部分参数,因此将其量化为 4 位可将模型内存开销控制在单个 B200 的预算内,并加速了在短到中上下文解码中成为瓶颈的专家 GEMM 运算。此外,在训练后阶段我们使用了量化感知蒸馏(QAD):量化后的学生模型通过前向传播中的伪量化算子,使用直通估计器进行反向传播,以匹配全精度教师模型的输出分布。 ## https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4#model-details模型详情 输入:文本和图像。输出:模型生成文本。 模型架构:Command A+ 是一个纯解码器稀疏混合专家 Transformer 模型。拥有 250 亿活跃参数和 2180 亿总参数,包含 128 个专家,其中每个 token 激活 8 个专家,还有一个共享专家应用于所有 token。注意力层交替使用滑动窗口注意力层(带旋转位置嵌入)和全局注意力层(无位置嵌入),比例为 3:1,该结构由 Command A 首次引入。稀疏 MoE 层采用完全无丢弃训练,并使用基于 token 选择的路由器。我们使用基于加性偏置的负载均衡来促进所有专家间的 token 负载均衡,并将 softmax 路由器激活函数替换为在每 token 的 topk 专家 logits 上归一化的 sigmoid 函数。 支持的语言:模型已在 48 种语言上训练:英语、阿拉伯语、保加利亚语、孟加拉语、加泰罗尼亚语、捷克语、丹麦语、德语、希腊语、西班牙语、爱沙尼亚语、波斯语、芬兰语、菲律宾语、法语、爱尔兰语、希伯来语、印地语、克罗地亚语、匈牙利语、印尼语、冰岛语、意大利语、日语、韩语、立陶宛语、拉脱维亚语、马来语、马耳他语、荷兰语、挪威语、旁遮普语、波兰语、葡萄牙语、罗马尼亚语、俄语、斯洛伐克语、斯洛文尼亚语、塞尔维亚语、瑞典语、泰米尔语、泰卢固语、泰语、土耳其语、乌克兰语、乌尔都语、越南语、中文。 上下文长度:Command A+ 支持 128K 输入上下文长度和 64K 输出长度。 ### https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4#tool-use-capabilities工具使用能力 Command A+ 经过专门训练,具备对话式工具使用能力。这使模型能够与外部工具(如 API、数据库或搜索引擎)进行交互。通过 Transformers 中的聊天模板 (https://huggingface.co/docs/transformers/main/en/chat_templating#advanced-tool-use–function-calling) 支持 Command A+ 的工具使用。我们建议使用 JSON Schema 提供工具描述。 工具使用示例 [点击展开] from transformers import AutoTokenizer model_id = "CohereLabs/command-a-plus-05-2026-w4a4" tokenizer = AutoTokenizer.from_pretrained(model_id) # Define tools tools = [{ "type": "function", "function": { "name": "query_daily_sales_report", "description": "Connects to a database to retrieve overall sales volumes and sales information for a given day.", "parameters": { "type": "object", "properties": { "day": { "description": "Retrieves sales data for this day, formatted as YYYY-MM-DD.", "type": "string", } }, "required": ["day"], }, }, }] # Define conversation input conversation = [ {"role": "user", "content": "Can you provide a sales summary for 29th September 2023?"} ] # Tokenize the Tool Use prompt directly input_ids = tokenizer.apply_chat_template( conversation=conversation, tools=tools, tokenize=True, add_generation_prompt=True, return_tensors="pt", ) 然后像往常一样从此输入进行生成。如果模型生成了计划和工具调用,您应将其添加到聊天历史中,如下所示: tool_call = {"name": "query_daily_sales_report", "arguments": {"day": "2023-09-29"}} thinking = "I will use the query_daily_sales_report tool to find the sales summary for 29th September 2023." conversation.append({"role": "assistant", "tool_calls": [{"id": "0", "type": "function", "function": tool_call}], "thinking": thinking}) 然后调用工具并以字典形式追加结果,角色为 tool: api_response_query_daily_sales_report = {"date": "2023-09-29", "summary": "Total Sales Amount: 10000, Total Units Sold: 250"} # this needs to be a dictionary!! # Append tool results conversation.append({"role": "tool", "tool_call_id": "0", "content": api_response_query_daily_sales_report}) 之后,您可以再次使用 generate() 让模型在聊天中利用工具结果。注意这只是对工具调用的简要介绍 — 更多信息请参阅 Transformers 的工具使用文档 (https://huggingface.co/docs/transformers/main/chat_templating#advanced-tool-use–function-calling)。 带引用的工具使用 [点击展开] 您可以选择让模型在响应中包含依据跨度(引用)以指示信息来源,方法是在 tokenizer.apply_chat_template(*) 中使用 enable_citations=True。生成结果如下所示: On 29th September 2023, the total sales amount was 10000 and the total units sold were 250. 当引用开启时,模型会将文本片段(称为“跨度”)与支持这些片段的具体工具结果(称为“来源”)关联起来。Command A+ 使用一对标签 和 来指示跨度可以依据哪些来源列表,并在结束标签中列出它们。例如,span 表示“span”由来自 tool_call_id=0 的结果 1 和 2 以及来自 tool_call_id=1 的结果 0 支持。同一工具调用的来源被分组在一起,列为 {tool_call_id}:[{结果索引列表}],然后用逗号连接。 ## https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4#model-card-contact模型卡联系方式 如果对本模型卡中的详情有疑问或需要更多信息,请联系 [[email protected]]。 立即试用:您可以在演示场 (https://dashboard.cohere.com/playground/chat?model=command-a-plus-05-2026) 中试用 Command A+。您也可以在我们的专用 Hugging Face Space (https://huggingface.co/spaces/CohereLabs/command-a-plus-05-2026) 中使用它。
相似文章
CohereLabs/command-a-plus-05-2026-bf16 · Hugging Face
Cohere发布了Command A+,这是一个开源模型,拥有250亿活跃参数(总计2180亿),针对代理型、多语言和重度推理任务进行了优化,支持视觉输入和128K上下文,采用Apache 2.0许可证。
Command A+
Cohere 发布了 Command A+,这是一款面向商业应用的开放企业级AI模型。
Cohere 开源 Command A+,一款为智能体构建的 218B MoE 模型
Cohere 发布了 Command A+,一款总参数 218B、激活参数 25B 的混合专家模型,将之前五个模型整合为一个,在企业智能体任务上性能提升。该模型在 Apache 2.0 协议下开源,并可在 Hugging Face 上获取。
@ClementDelangue:Cohere 近来在开源方面进展非常出色。优秀的 Apache 2.0 模型!https://huggingface.co/CohereLabs/…
Cohere 发布了 Command A+,这是一个开源模型,拥有 250 亿活跃参数和 2180 亿总参数,采用 Apache 2.0 许可,针对智能体、多语言和重推理任务进行了优化。
Command A Plus GGUFs 已发布
Cohere 已发布其 Command A+ 模型的 GGUF 量化版本(25B 活跃参数 / 218B 总参数,Apache 2.0),用于本地推理,针对智能体和多语言任务进行了优化。