@ClementDelangue:Cohere 近来在开源方面进展非常出色。优秀的 Apache 2.0 模型!https://huggingface.co/CohereLabs/…
摘要
Cohere 发布了 Command A+,这是一个开源模型,拥有 250 亿活跃参数和 2180 亿总参数,采用 Apache 2.0 许可,针对智能体、多语言和重推理任务进行了优化。
查看缓存全文
缓存时间: 2026/05/20 20:35
Cohere 最近在开源领域的发展势头非常强劲。很棒的 Apache 2.0 模型! https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16… — # 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-aCommand 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 - 模型大小: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-bf16" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForImageTextToText.from_pretrained(model_id) # 使用 command-a-plus-05-2026-bf16 的聊天模板格式化消息 messages = [{"role": "user", "content": "什么东西有钥匙却不能开锁?"}] 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|>用户问了一个谜语:“什么东西有钥匙却不能开锁?”答案是钢琴(或键盘)。因此用答案回应。<|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": "解释 Transformer 架构"}, ] 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+ 是一个纯解码器稀疏混合专家 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-bf16#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-bf16" tokenizer = AutoTokenizer.from_pretrained(model_id) # 定义工具 tools = [{ "type": "function", "function": { "name": "query_daily_sales_report", "description": "连接到数据库以检索指定日期的总销售额和销售信息。", "parameters": { "type": "object", "properties": { "day": { "description": "检索该日期的销售数据,格式为 YYYY-MM-DD。", "type": "string", } }, "required": ["day"], }, }, }] # 定义对话输入 conversation = [ {"role": "user", "content": "你能提供 2023 年 9 月 29 日的销售摘要吗?"} ] # 直接对工具使用提示进行分词 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 = "我将使用 query_daily_sales_report 工具查找 2023 年 9 月 29 日的销售摘要。" 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": "总销售额:10000,总售出件数: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,要求模型在其响应中包含依据片段(引用)以指明信息来源。生成的回复可能如下所示: 在 2023 年 9 月 29 日,总销售额为 10000,总售出件数为 250。 当启用引用时,模型会将文本片段(称为“spans”)与支持这些片段的特定工具结果(称为“sources”)关联起来。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) 中使用它。 > Nick Frosst (@nickfrosst): > Cohere 的 Command A+ 现已发布 :) 这是我们迄今为止最好的模型,并且它是开源的,采用 Apache 2.0 许可。
相似文章
CohereLabs/command-a-plus-05-2026-bf16 · Hugging Face
Cohere发布了Command A+,这是一个开源模型,拥有250亿活跃参数(总计2180亿),针对代理型、多语言和重度推理任务进行了优化,支持视觉输入和128K上下文,采用Apache 2.0许可证。
Cohere 开源 Command A+,一款为智能体构建的 218B MoE 模型
Cohere 发布了 Command A+,一款总参数 218B、激活参数 25B 的混合专家模型,将之前五个模型整合为一个,在企业智能体任务上性能提升。该模型在 Apache 2.0 协议下开源,并可在 Hugging Face 上获取。
CohereLabs/command-a-plus-05-2026-w4a4
CohereLabs 发布了 Command A+,一个开源的 25B 活跃参数模型,针对智能体、多语言和推理任务进行了优化,支持视觉功能,采用 Apache 2.0 许可证。
回复:Cohere的Command-A系列模型后来怎么样了?
Cohere发布Command A+,其首个混合专家模型,采用Apache 2.0许可,具备高效量化,可在1-2块GPU上部署,优先考虑实用性和对开发者的开放访问。
Command A+
Cohere 发布了 Command A+,这是一款面向商业应用的开放企业级AI模型。