CohereLabs/command-a-plus-05-2026-bf16 · Hugging Face

Reddit r/LocalLLaMA 模型

摘要

Cohere发布了Command A+,这是一个开源模型,拥有250亿活跃参数(总计2180亿),针对代理型、多语言和重度推理任务进行了优化,支持视觉输入和128K上下文,采用Apache 2.0许可证。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/05/20 16:34

CohereLabs/command-a-plus-05-2026-bf16 · Hugging Face 来源:https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16

https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16#model-card-for-command-a

Command A+ 模型卡

https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16#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
  • 模型大小: 25B 激活参数,218B 总参数
  • 上下文长度: 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-bf16"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id)

# 使用 command-a-plus-05-2026-bf16 聊天模板格式化消息
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|><|END_THINKING|> 之间:

<|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-bf16"
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
您也可以在 vLLM 中运行该模型。Command A+ 需要使用 vllm>=0.21.0,并且准确的响应解析还需要安装 Cohere 的 melody 库 (https://pypi.org/project/cohere-melody/)。

uv pip install vllm>=0.21.0
uv pip install transformers
uv pip install cohere_melody>=0.9.0

然后可以使用以下命令启动 vLLM 服务器:

# 以下适用于 B200,请根据您的设备调整 tp 参数
vllm serve CohereLabs/command-a-plus-05-2026-bf16 -tp 4 --tool-call-parser cohere_command4 --reasoning-parser cohere_command4 --enable-auto-tool-choice

https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16#model-details

模型详情

  • 输入: 文本和图像。
  • 输出: 模型生成文本。
  • 模型架构: Command A+ 是一个仅解码器的稀疏混合专家(Sparse Mixture-of-Experts)Transformer 模型。它拥有 25B 激活参数和 218B 总参数,包含 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-bf16#tool-use-capabilities

工具调用能力:
Command A+ 经过专门训练,具备对话式工具调用能力。这使得模型能够与外部工具(如 API、数据库或搜索引擎)进行交互。通过 Transformers 中的聊天模板 (https://huggingface.co/docs/transformers/main/en/chat_templating#advanced-tool-use–function-calling) 支持工具调用。我们建议使用 JSON 模式提供工具描述。

工具调用示例 [点击展开]

from transformers import AutoTokenizer

model_id = "CohereLabs/command-a-plus-05-2026-bf16"
tokenizer = AutoTokenizer.from_pretrained(model_id)

# 定义工具
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"],
        },
    },
}]

# 定义对话输入
conversation = [
    {"role": "user", "content": "Can you provide a sales summary for 29th September 2023?"}
]

# 直接分词工具调用提示
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"}
# 这必须是一个字典!!

# 追加工具结果
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+ 使用一对标签 <c></c> 来指示某个跨度可以基于来源列表进行基础化,并在结束标签中列出这些来源。例如,<c>span</c> 表示“span”由 tool_call_id=0 的结果 1 和 2 以及 tool_call_id=1 的结果 0 支持。来自同一工具调用的来源将分组并列出为 {tool_call_id}:[{结果索引列表}],然后以逗号连接。

https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16#model-card-contact

模型卡联系方式
如果关于此模型卡存在错误或需要进一步的问题,请联系 [email protected]

立即试用: 您可以在 Playground (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-w4a4

Hugging Face Models Trending

CohereLabs 发布了 Command A+,一个开源的 25B 活跃参数模型,针对智能体、多语言和推理任务进行了优化,支持视觉功能,采用 Apache 2.0 许可证。

Cohere 开源 Command A+,一款为智能体构建的 218B MoE 模型

Reddit r/ArtificialInteligence

Cohere 发布了 Command A+,一款总参数 218B、激活参数 25B 的混合专家模型,将之前五个模型整合为一个,在企业智能体任务上性能提升。该模型在 Apache 2.0 协议下开源,并可在 Hugging Face 上获取。

Command A+

Product Hunt

Cohere 发布了 Command A+,这是一款面向商业应用的开放企业级AI模型。

Command A Plus GGUFs 已发布

Reddit r/LocalLLaMA

Cohere 已发布其 Command A+ 模型的 GGUF 量化版本(25B 活跃参数 / 218B 总参数,Apache 2.0),用于本地推理,针对智能体和多语言任务进行了优化。