alexrs commited on
Commit
a28ba30
·
verified ·
1 Parent(s): e949b16

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +230 -0
README.md CHANGED
@@ -56,3 +56,233 @@ tags:
56
  - conversational
57
  - chat
58
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  - conversational
57
  - chat
58
  ---
59
+
60
+ # **Model Card for Command A+**
61
+
62
+ ## **Model Summary**
63
+
64
+ Command A+ is an open source model with 25 billion active parameters and 218B total parameters model optimized for agentic, multilingual, and reasoning-heavy tasks with a focus on enterprise performance, while also providing support for vision inputs for processing image inputs.
65
+
66
+ Developed by: [Cohere](https://cohere.com/) and [Cohere Labs](https://cohere.com/research)
67
+
68
+ * Point of Contact: [**Cohere Labs**](https://cohere.com/research)
69
+ * License: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
70
+ * Model: command-a-plus-05-2026
71
+ * Model Size: 25B active parameters, 218B total parameters
72
+ * Context length: 128K input
73
+
74
+ For more details about this model, please check out our [blog post](http://cohere.com/blog/command-a-plus).
75
+
76
+ You can try out Command A+ before downloading the weights in our hosted [Hugging Face Space](https://huggingface.co/spaces/CohereLabs/command-a-plus-05-2026).
77
+
78
+
79
+ **Available quantizations**
80
+
81
+ The following quantizations are available with example minimum GPU requirements
82
+
83
+ | Quantization | Blackwell | Hopper |
84
+ | :---- | :---- | :---- |
85
+ | [BF16 (16-bit)](https://huggingface.co/CohereLabs/command-a-plus-05-2026-bf16) | 4 x B200 | 8 x H100 |
86
+ | [FP8 (8-bit)](https://huggingface.co/CohereLabs/command-a-plus-05-2026-fp8) | 2 x B200 | 4 x H100 |
87
+ | [W4A4 (4-bit)](https://huggingface.co/CohereLabs/command-a-plus-05-2026-w4a4) | 1 x B200 | 2 x H100 |
88
+
89
+ All three quantizations show negligible differences in benchmark quality and performance.
90
+
91
+ For more details, please check out our [blog post](http://cohere.com/blog/command-a-plus).
92
+
93
+
94
+ **Usage**
95
+
96
+ **Transformers**
97
+
98
+ Please install transformers from the source repository that includes the necessary changes for this model.
99
+
100
+ ```py
101
+ # pip install transformers
102
+ from transformers import AutoTokenizer, AutoModelForImageTextToText
103
+
104
+ model_id = "CohereLabs/command-a-plus-05-2026-bf16"
105
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
106
+ model = AutoModelForImageTextToText.from_pretrained(model_id)
107
+
108
+ # Format message with the command-a-plus-05-2026-bf16 chat template
109
+ messages = [{"role": "user", "content": "What has keys but can't open locks?"}]
110
+ input_ids = tokenizer.apply_chat_template(
111
+ messages,
112
+ tokenize=True,
113
+ add_generation_prompt=True,
114
+ return_tensors="pt",
115
+ )
116
+
117
+ gen_tokens = model.generate(
118
+ input_ids,
119
+ max_new_tokens=4096,
120
+ do_sample=True,
121
+ temperature=0.6,
122
+ top_p=0.95
123
+ )
124
+
125
+ gen_text = tokenizer.decode(gen_tokens[0])
126
+ print(gen_text)
127
+ ```
128
+
129
+ As a result, you should get an output that looks like this, where the thinking is generated between the `<START_THINKING>` and `<END_THINKING>`:
130
+
131
+ ```py
132
+ <|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|>
133
+ ```
134
+
135
+ You can also use the model directly using transformers pipeline abstraction:
136
+
137
+ ```py
138
+ from transformers import pipeline
139
+ import torch
140
+
141
+ model_id = "CohereLabs/command-a-plus-05-2026-bf16"
142
+
143
+ pipe = pipeline(
144
+ "text-generation",
145
+ model=model_id,
146
+ dtype="auto",
147
+ device_map="auto",
148
+ )
149
+
150
+ messages = [
151
+ {"role": "user", "content": "Explain the Transformer architecture"},
152
+ ]
153
+
154
+ tokenizer = pipe.tokenizer
155
+
156
+ text = tokenizer.apply_chat_template(
157
+ messages,
158
+ tokenize=False,
159
+ add_generation_prompt=True,
160
+ )
161
+
162
+
163
+ outputs = pipe(
164
+ messages,
165
+ max_new_tokens=300,
166
+ )
167
+ print(outputs[0]["generated_text"][-1])
168
+
169
+
170
+ ```
171
+
172
+ **vLLM**
173
+
174
+ You can also run the model in vLLM. `vllm>=0.21.0` is required for Command A+ and accurate response parsing also requires installing [Cohere’s `melody` library](https://pypi.org/project/cohere-melody/).
175
+
176
+ ```
177
+ uv pip install vllm>=0.21.0
178
+ uv pip install transformers uv pip install cohere_melody>=0.9.0
179
+ ```
180
+
181
+ Then the vllm server can be started with the following command:
182
+
183
+ ```
184
+ # This is for B200, adjust tp for your device vllm serve CohereLabs/command-a-plus-05-2026-bf16 -tp 4 --tool-call-parser cohere_command4 --reasoning-parser cohere_command4 --enable-auto-tool-choice
185
+ ```
186
+
187
+ ## **Model Details**
188
+
189
+ **Input**: Text and images.
190
+
191
+ **Output**: Model generates text.
192
+
193
+ **Model Architecture**: Command A+ is a decoder-only Sparse Mixture-of-Experts Transformer Model. With 25B active parameters and 218B total parameters, it has 128 experts, out of which 8 are active per token, and a single shared expert is applied to all tokens. The attention layers interleave sliding-window attention layers with Rotational Positional Embeddings and global attention layers without positional embeddings in a 3:1 ratio, as first introduced in Command A. The sparse MoE layer is trained in a fully dropless manner and uses a token-choice router. We use additive-bias-based load balancing to encourage balanced token load across all experts, and swap out the softmax router activation function with a normalized sigmoid over the topk expert logits per token.
194
+
195
+ **Languages covered:** The model has been trained on 48 languages: English, Arabic, Bulgarian, Bengali, Catalan, Czech, Danish, German, Greek, Spanish, Estonian, Persian, Finnish, Filipino, French, Irish, Hebrew, Hindi, Croatian, Hungarian, Indonesian, Icelandic, Italian, Japanese, Korean, Lithuanian, Latvian, Malay, Maltese, Dutch, Norwegian, Punjabi, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Serbian, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Chinese.
196
+
197
+ **Context Length:** Command A+ supports a context length of 128K & 64K output length.
198
+
199
+ ### **Tool Use Capabilities:**
200
+
201
+ Command A+ has been specifically trained with conversational tool use capabilities. This allows the model to interact with external tools like APIs, databases, or search engines.
202
+
203
+ Tool use with Command A+ is supported through [chat templates](https://huggingface.co/docs/transformers/main/en/chat_templating#advanced-tool-use--function-calling) in Transformers. We recommend providing tool descriptions using JSON schema.
204
+
205
+ **Tool Use Example \[CLICK TO EXPAND\]**
206
+
207
+ ```py
208
+ from transformers import AutoTokenizer
209
+
210
+ model_id = "CohereLabs/command-a-plus-05-2026-bf16"
211
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
212
+
213
+ # Define tools
214
+ tools = [{
215
+ "type": "function",
216
+ "function": {
217
+ "name": "query_daily_sales_report",
218
+ "description": "Connects to a database to retrieve overall sales volumes and sales information for a given day.",
219
+ "parameters": {
220
+ "type": "object",
221
+ "properties": {
222
+ "day": {
223
+ "description": "Retrieves sales data for this day, formatted as YYYY-MM-DD.",
224
+ "type": "string",
225
+ }
226
+ },
227
+ "required": ["day"],
228
+ },
229
+ },
230
+ }]
231
+
232
+ # Define conversation input
233
+ conversation = [
234
+ {"role": "user", "content": "Can you provide a sales summary for 29th September 2023?"}
235
+ ]
236
+
237
+ # Tokenize the Tool Use prompt directly
238
+ input_ids = tokenizer.apply_chat_template(
239
+ conversation=conversation,
240
+ tools=tools,
241
+ tokenize=True,
242
+ add_generation_prompt=True,
243
+ return_tensors="pt",
244
+ )
245
+ ```
246
+
247
+ You can then generate from this input as normal.
248
+
249
+ If the model generates a plan and tool calls, you should add them to the chat history like so:
250
+
251
+ ```py
252
+ tool_call = {"name": "query_daily_sales_report", "arguments": {"day": "2023-09-29"}}
253
+ thinking = "I will use the query_daily_sales_report tool to find the sales summary for 29th September 2023."
254
+ conversation.append({"role": "assistant", "tool_calls": [{"id": "0", "type": "function", "function": tool_call}], "thinking": thinking})
255
+ ```
256
+
257
+ and then call the tool and append the result, as a dictionary, with the tool role, like so:
258
+
259
+ ```py
260
+ 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!!
261
+
262
+ # Append tool results
263
+ conversation.append({"role": "tool", "tool_call_id": "0", "content": api_response_query_daily_sales_report})
264
+ ```
265
+
266
+ After that, you can generate() again to let the model use the tool result in the chat.
267
+
268
+ Note that this was a very brief introduction to tool calling \- for more information, see the Transformers [tool use documentation](https://huggingface.co/docs/transformers/main/chat_templating#advanced-tool-use--function-calling).
269
+
270
+ **Tool Use with citations**
271
+
272
+ Optionally, one can ask the model to include grounding spans (citations) in its response to indicate the source of the information, by using `enable_citations=True` in `tokenizer.apply_chat_template(*)`. The generation would look like this:
273
+
274
+ ```
275
+ On 29th September 2023, the total sales amount was <co>10000</co: 0:[0]> and the total units sold were <co>250.</co: 0:[0]>
276
+ ```
277
+
278
+ When citations are turned on, the model associates pieces of texts (called "spans") with those specific tool results that support them (called "sources"). Command A+ uses a pair of tags `<co>` and `</co>` to indicate when a span can be grounded onto a list of sources, listing them out in the closing tag. For example, `<co>span</co: 0:[1,2],1:[0]>` means that "span" is supported by result 1 and 2 from `tool_call_id=0` as well as result 0 from `tool_call_id=1`. Sources from the same tool call are grouped together and listed as `{tool_call_id}:[{list of result indices}]`, before they are joined together by ",".
279
+
280
+ ## **Model Card Contact**
281
+
282
+ For errors or additional questions about details in this model card, contact \[[labs@cohere.com](mailto:labs@cohere.com)\].
283
+
284
+ **Try it now:**
285
+
286
+ You can try Command A+ in the [playground](https://dashboard.cohere.com/playground/chat?model=command-a-plus-05-2026). You can also use it in our dedicated [Hugging Face Space](https://huggingface.co/spaces/CohereLabs/command-a-plus-05-2026).
287
+
288
+