intervitens
commited on
Commit
•
e7b6068
1
Parent(s):
59cb1eb
Upload folder using huggingface_hub
Browse files- .gitattributes +8 -0
- README.md +361 -0
- c4ai-command-r-plus-IQ3_M-iMat.gguf +3 -0
- c4ai-command-r-plus-IQ3_S-iMat.gguf +3 -0
- c4ai-command-r-plus-IQ3_XS-iMat.gguf +3 -0
- c4ai-command-r-plus-IQ3_XXS-iMat.gguf +3 -0
- c4ai-command-r-plus-IQ4_XS-iMat-00001-of-00002.gguf +3 -0
- c4ai-command-r-plus-IQ4_XS-iMat-00002-of-00002.gguf +3 -0
- c4ai-command-r-plus-Q3_K_M-iMat-00001-of-00002.gguf +3 -0
- c4ai-command-r-plus-Q3_K_M-iMat-00002-of-00002.gguf +3 -0
- cmdrplus_imx_c512.bin +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
c4ai-command-r-plus-IQ3_M-iMat.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
c4ai-command-r-plus-IQ3_S-iMat.gguf filter=lfs diff=lfs merge=lfs -text
|
38 |
+
c4ai-command-r-plus-IQ3_XS-iMat.gguf filter=lfs diff=lfs merge=lfs -text
|
39 |
+
c4ai-command-r-plus-IQ3_XXS-iMat.gguf filter=lfs diff=lfs merge=lfs -text
|
40 |
+
c4ai-command-r-plus-IQ4_XS-iMat-00001-of-00002.gguf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
c4ai-command-r-plus-IQ4_XS-iMat-00002-of-00002.gguf filter=lfs diff=lfs merge=lfs -text
|
42 |
+
c4ai-command-r-plus-Q3_K_M-iMat-00001-of-00002.gguf filter=lfs diff=lfs merge=lfs -text
|
43 |
+
c4ai-command-r-plus-Q3_K_M-iMat-00002-of-00002.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,361 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
library_name: transformers
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
- fr
|
7 |
+
- de
|
8 |
+
- es
|
9 |
+
- it
|
10 |
+
- pt
|
11 |
+
- ja
|
12 |
+
- ko
|
13 |
+
- zh
|
14 |
+
- ar
|
15 |
+
---
|
16 |
+
|
17 |
+
Original model link: [CohereForAI/c4ai-command-r-plus](https://huggingface.co/CohereForAI/c4ai-command-r-plus).
|
18 |
+
|
19 |
+
For imatrix data generation, kalomaze's `groups_merged.txt` were used, you can find it [here](https://github.com/ggerganov/llama.cpp/files/14194570/groups_merged.txt).
|
20 |
+
|
21 |
+
Original model README below.
|
22 |
+
|
23 |
+
|
24 |
+
# Model Card for C4AI Command R+
|
25 |
+
|
26 |
+
🚨 **This model is non-quantized version of C4AI Command R+. You can find the quantized version of C4AI Command R+ using bitsandbytes [here](https://huggingface.co/CohereForAI/c4ai-command-r-plus-4bit)**.
|
27 |
+
|
28 |
+
|
29 |
+
## Model Summary
|
30 |
+
|
31 |
+
C4AI Command R+ is an open weights research release of a 104B billion parameter model with highly advanced capabilities, this includes Retrieval Augmented Generation (RAG) and tool use to automate sophisticated tasks. The tool use in this model generation enables multi-step tool use which allows the model to combine multiple tools over multiple steps to accomplish difficult tasks. C4AI Command R+ is a multilingual model evaluated in 10 languages for performance: English, French, Spanish, Italian, German, Brazilian Portuguese, Japanese, Korean, Arabic, and Simplified Chinese. Command R+ is optimized for a variety of use cases including reasoning, summarization, and question answering.
|
32 |
+
|
33 |
+
C4AI Command R+ is part of a family of open weight releases from Cohere For AI and Cohere. Our smaller companion model is [C4AI Command R](https://huggingface.co/CohereForAI/c4ai-command-r-v01)
|
34 |
+
|
35 |
+
Developed by: [Cohere](https://cohere.com/) and [Cohere For AI](https://cohere.for.ai)
|
36 |
+
|
37 |
+
- Point of Contact: Cohere For AI: [cohere.for.ai](https://cohere.for.ai/)
|
38 |
+
- License: [CC-BY-NC](https://cohere.com/c4ai-cc-by-nc-license), requires also adhering to [C4AI's Acceptable Use Policy](https://docs.cohere.com/docs/c4ai-acceptable-use-policy)
|
39 |
+
- Model: c4ai-command-r-plus
|
40 |
+
- Model Size: 104 billion parameters
|
41 |
+
- Context length: 128K
|
42 |
+
|
43 |
+
**Try C4AI Command R+**
|
44 |
+
|
45 |
+
You can try out C4AI Command R+ before downloading the weights in our hosted [Hugging Face Space](https://huggingface.co/spaces/CohereForAI/c4ai-command-r-plus).
|
46 |
+
|
47 |
+
**Usage**
|
48 |
+
|
49 |
+
Please install `transformers` from the source repository that includes the necessary changes for this model.
|
50 |
+
```python
|
51 |
+
# pip install 'git+https://github.com/huggingface/transformers.git'
|
52 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
53 |
+
|
54 |
+
model_id = "CohereForAI/c4ai-command-r-plus"
|
55 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
56 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
57 |
+
|
58 |
+
# Format message with the command-r-plus chat template
|
59 |
+
messages = [{"role": "user", "content": "Hello, how are you?"}]
|
60 |
+
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
61 |
+
## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
62 |
+
|
63 |
+
gen_tokens = model.generate(
|
64 |
+
input_ids,
|
65 |
+
max_new_tokens=100,
|
66 |
+
do_sample=True,
|
67 |
+
temperature=0.3,
|
68 |
+
)
|
69 |
+
|
70 |
+
gen_text = tokenizer.decode(gen_tokens[0])
|
71 |
+
print(gen_text)
|
72 |
+
```
|
73 |
+
|
74 |
+
**Quantized model through bitsandbytes, 8-bit precision**
|
75 |
+
|
76 |
+
```python
|
77 |
+
# pip install 'git+https://github.com/huggingface/transformers.git' bitsandbytes accelerate
|
78 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
79 |
+
|
80 |
+
bnb_config = BitsAndBytesConfig(load_in_8bit=True)
|
81 |
+
|
82 |
+
model_id = "CohereForAI/c4ai-command-r-plus"
|
83 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
84 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config)
|
85 |
+
|
86 |
+
# Format message with the command-r-plus chat template
|
87 |
+
messages = [{"role": "user", "content": "Hello, how are you?"}]
|
88 |
+
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
89 |
+
## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
90 |
+
|
91 |
+
gen_tokens = model.generate(
|
92 |
+
input_ids,
|
93 |
+
max_new_tokens=100,
|
94 |
+
do_sample=True,
|
95 |
+
temperature=0.3,
|
96 |
+
)
|
97 |
+
|
98 |
+
gen_text = tokenizer.decode(gen_tokens[0])
|
99 |
+
print(gen_text)
|
100 |
+
```
|
101 |
+
|
102 |
+
**Quantized model through bitsandbytes, 4-bit precision**
|
103 |
+
|
104 |
+
This model is non-quantized version of C4AI Command R+. You can find the quantized version of C4AI Command R+ using bitsandbytes [here](https://huggingface.co/CohereForAI/c4ai-command-r-plus-4bit).
|
105 |
+
|
106 |
+
## Model Details
|
107 |
+
|
108 |
+
**Input**: Models input text only.
|
109 |
+
|
110 |
+
**Output**: Models generate text only.
|
111 |
+
|
112 |
+
**Model Architecture**: This is an auto-regressive language model that uses an optimized transformer architecture. After pretraining, this model uses supervised fine-tuning (SFT) and preference training to align model behavior to human preferences for helpfulness and safety.
|
113 |
+
|
114 |
+
**Languages covered**: The model is optimized to perform well in the following languages: English, French, Spanish, Italian, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, and Arabic.
|
115 |
+
|
116 |
+
Pre-training data additionally included the following 13 languages: Russian, Polish, Turkish, Vietnamese, Dutch, Czech, Indonesian, Ukrainian, Romanian, Greek, Hindi, Hebrew, Persian.
|
117 |
+
|
118 |
+
**Context length**: Command R+ supports a context length of 128K.
|
119 |
+
|
120 |
+
## Evaluations
|
121 |
+
|
122 |
+
Command R+ has been submitted to the [Open LLM leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard). We include the results below, along with a direct comparison to the strongest state-of-art open weights models currently available on Hugging Face. We note that these results are only useful to compare when evaluations are implemented for all models in a [standardized way](https://github.com/EleutherAI/lm-evaluation-harness) using publically available code, and hence shouldn't be used for comparison outside of models submitted to the leaderboard or compared to self-reported numbers which can't be replicated in the same way.
|
123 |
+
|
124 |
+
| Model | Average | Arc (Challenge) | Hella Swag | MMLU | Truthful QA | Winogrande | GSM8k |
|
125 |
+
|:--------------------------------|----------:|------------------:|-------------:|-------:|--------------:|-------------:|--------:|
|
126 |
+
| **CohereForAI/c4ai-command-r-plus** | 74.6 | 70.99 | 88.6 | 75.7 | 56.3 | 85.4 | 70.7 |
|
127 |
+
| [DBRX Instruct](https://huggingface.co/databricks/dbrx-instruct) | 74.5 | 68.9 | 89 | 73.7 | 66.9 | 81.8 | 66.9 |
|
128 |
+
| [Mixtral 8x7B-Instruct](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) | 72.7 | 70.1 | 87.6 | 71.4 | 65 | 81.1 | 61.1 |
|
129 |
+
| [Mixtral 8x7B Chat](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) | 72.6 | 70.2 | 87.6 | 71.2 | 64.6 | 81.4 | 60.7 |
|
130 |
+
| [CohereForAI/c4ai-command-r-v01](https://huggingface.co/CohereForAI/c4ai-command-r-v01) | 68.5 | 65.5 | 87 | 68.2 | 52.3 | 81.5 | 56.6 |
|
131 |
+
| [Llama 2 70B](https://huggingface.co/meta-llama/Llama-2-70b-hf) | 67.9 | 67.3 | 87.3 | 69.8 | 44.9 | 83.7 | 54.1 |
|
132 |
+
| [Yi-34B-Chat](https://huggingface.co/01-ai/Yi-34B-Chat) | 65.3 | 65.4 | 84.2 | 74.9 | 55.4 | 80.1 | 31.9 |
|
133 |
+
| [Gemma-7B](https://huggingface.co/google/gemma-7b) | 63.8 | 61.1 | 82.2 | 64.6 | 44.8 | 79 | 50.9 |
|
134 |
+
| [LLama 2 70B Chat](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) | 62.4 | 64.6 | 85.9 | 63.9 | 52.8 | 80.5 | 26.7 |
|
135 |
+
| [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) | 61 | 60 | 83.3 | 64.2 | 42.2 | 78.4 | 37.8 |
|
136 |
+
|
137 |
+
We include these metrics here because they are frequently requested, but note that these metrics do not capture RAG, multilingual, tooling performance or the evaluation of open ended generations which we believe Command R+ to be state-of-art at. For evaluations of RAG, multilingual and tooling read more [here](https://txt.cohere.com/command-r-plus-microsoft-azure/). For evaluation of open ended generation, Command R+ is currently being evaluated on the [chatbot arena](https://chat.lmsys.org/).
|
138 |
+
|
139 |
+
### Tool use & multihop capabilities:
|
140 |
+
|
141 |
+
Command R+ has been specifically trained with conversational tool use capabilities. These have been trained into the model via a mixture of supervised fine-tuning and preference fine-tuning, using a specific prompt template. Deviating from this prompt template will likely reduce performance, but we encourage experimentation.
|
142 |
+
|
143 |
+
Command R+’s tool use functionality takes a conversation as input (with an optional user-system preamble), along with a list of available tools. The model will then generate a json-formatted list of actions to execute on a subset of those tools. Command R+ may use one of its supplied tools more than once.
|
144 |
+
|
145 |
+
The model has been trained to recognise a special `directly_answer` tool, which it uses to indicate that it doesn’t want to use any of its other tools. The ability to abstain from calling a specific tool can be useful in a range of situations, such as greeting a user, or asking clarifying questions.
|
146 |
+
We recommend including the `directly_answer` tool, but it can be removed or renamed if required.
|
147 |
+
|
148 |
+
Comprehensive documentation for working with command R+'s tool use prompt template can be found [here](https://docs.cohere.com/docs/prompting-command-r).
|
149 |
+
|
150 |
+
The code snippet below shows a minimal working example on how to render a prompt.
|
151 |
+
|
152 |
+
<details>
|
153 |
+
<summary><b>Usage: Rendering Tool Use Prompts [CLICK TO EXPAND]</b> </summary>
|
154 |
+
|
155 |
+
```python
|
156 |
+
from transformers import AutoTokenizer
|
157 |
+
|
158 |
+
model_id = "CohereForAI/c4ai-command-r-plus"
|
159 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
160 |
+
|
161 |
+
# define conversation input:
|
162 |
+
conversation = [
|
163 |
+
{"role": "user", "content": "Whats the biggest penguin in the world?"}
|
164 |
+
]
|
165 |
+
# Define tools available for the model to use:
|
166 |
+
tools = [
|
167 |
+
{
|
168 |
+
"name": "internet_search",
|
169 |
+
"description": "Returns a list of relevant document snippets for a textual query retrieved from the internet",
|
170 |
+
"parameter_definitions": {
|
171 |
+
"query": {
|
172 |
+
"description": "Query to search the internet with",
|
173 |
+
"type": 'str',
|
174 |
+
"required": True
|
175 |
+
}
|
176 |
+
}
|
177 |
+
},
|
178 |
+
{
|
179 |
+
'name': "directly_answer",
|
180 |
+
"description": "Calls a standard (un-augmented) AI chatbot to generate a response given the conversation history",
|
181 |
+
'parameter_definitions': {}
|
182 |
+
}
|
183 |
+
]
|
184 |
+
|
185 |
+
# render the tool use prompt as a string:
|
186 |
+
tool_use_prompt = tokenizer.apply_tool_use_template(
|
187 |
+
conversation,
|
188 |
+
tools=tools,
|
189 |
+
tokenize=False,
|
190 |
+
add_generation_prompt=True,
|
191 |
+
)
|
192 |
+
print(tool_use_prompt)
|
193 |
+
```
|
194 |
+
|
195 |
+
</details>
|
196 |
+
|
197 |
+
<details>
|
198 |
+
<summary><b>Example Rendered Tool Use Prompt [CLICK TO EXPAND]</b></summary>
|
199 |
+
|
200 |
+
````
|
201 |
+
<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
202 |
+
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
203 |
+
|
204 |
+
# System Preamble
|
205 |
+
## Basic Rules
|
206 |
+
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
207 |
+
|
208 |
+
# User Preamble
|
209 |
+
## Task and Context
|
210 |
+
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
211 |
+
|
212 |
+
## Style Guide
|
213 |
+
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.
|
214 |
+
|
215 |
+
## Available Tools
|
216 |
+
Here is a list of tools that you have available to you:
|
217 |
+
|
218 |
+
```python
|
219 |
+
def internet_search(query: str) -> List[Dict]:
|
220 |
+
"""Returns a list of relevant document snippets for a textual query retrieved from the internet
|
221 |
+
|
222 |
+
Args:
|
223 |
+
query (str): Query to search the internet with
|
224 |
+
"""
|
225 |
+
pass
|
226 |
+
```
|
227 |
+
|
228 |
+
```python
|
229 |
+
def directly_answer() -> List[Dict]:
|
230 |
+
"""Calls a standard (un-augmented) AI chatbot to generate a response given the conversation history
|
231 |
+
"""
|
232 |
+
pass
|
233 |
+
```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Whats the biggest penguin in the world?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write 'Action:' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user's last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:
|
234 |
+
```json
|
235 |
+
[
|
236 |
+
{
|
237 |
+
"tool_name": title of the tool in the specification,
|
238 |
+
"parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters
|
239 |
+
}
|
240 |
+
]```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
241 |
+
|
242 |
+
````
|
243 |
+
|
244 |
+
</details>
|
245 |
+
|
246 |
+
<details>
|
247 |
+
<summary><b>Example Rendered Tool Use Completion [CLICK TO EXPAND]</b></summary>
|
248 |
+
|
249 |
+
````
|
250 |
+
Action: ```json
|
251 |
+
[
|
252 |
+
{
|
253 |
+
"tool_name": "internet_search",
|
254 |
+
"parameters": {
|
255 |
+
"query": "biggest penguin in the world"
|
256 |
+
}
|
257 |
+
}
|
258 |
+
]
|
259 |
+
```
|
260 |
+
````
|
261 |
+
</details>
|
262 |
+
|
263 |
+
### Grounded Generation and RAG Capabilities:
|
264 |
+
|
265 |
+
Command R+ has been specifically trained with grounded generation capabilities. This means that it can generate responses based on a list of supplied document snippets, and it will include grounding spans (citations) in its response indicating the source of the information. This can be used to enable behaviors such as grounded summarization and the final step of Retrieval Augmented Generation (RAG). This behavior has been trained into the model via a mixture of supervised fine-tuning and preference fine-tuning, using a specific prompt template. Deviating from this prompt template may reduce performance, but we encourage experimentation.
|
266 |
+
|
267 |
+
Command R+’s grounded generation behavior takes a conversation as input (with an optional user-supplied system preamble, indicating task, context and desired output style), along with a list of retrieved document snippets. The document snippets should be chunks, rather than long documents, typically around 100-400 words per chunk. Document snippets consist of key-value pairs. The keys should be short descriptive strings, the values can be text or semi-structured.
|
268 |
+
|
269 |
+
By default, Command R+ will generate grounded responses by first predicting which documents are relevant, then predicting which ones it will cite, then generating an answer. Finally, it will then insert grounding spans into the answer. See below for an example. This is referred to as `accurate` grounded generation.
|
270 |
+
|
271 |
+
The model is trained with a number of other answering modes, which can be selected by prompt changes. A `fast` citation mode is supported in the tokenizer, which will directly generate an answer with grounding spans in it, without first writing the answer out in full. This sacrifices some grounding accuracy in favor of generating fewer tokens.
|
272 |
+
|
273 |
+
Comprehensive documentation for working with Command R+'s grounded generation prompt template can be found [here](https://docs.cohere.com/docs/prompting-command-r).
|
274 |
+
|
275 |
+
The code snippet below shows a minimal working example on how to render a prompt.
|
276 |
+
|
277 |
+
<details>
|
278 |
+
<summary> <b>Usage: Rendering Grounded Generation prompts [CLICK TO EXPAND]</b> </summary>
|
279 |
+
|
280 |
+
````python
|
281 |
+
from transformers import AutoTokenizer
|
282 |
+
|
283 |
+
model_id = "CohereForAI/c4ai-command-r-plus"
|
284 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
285 |
+
|
286 |
+
# define conversation input:
|
287 |
+
conversation = [
|
288 |
+
{"role": "user", "content": "Whats the biggest penguin in the world?"}
|
289 |
+
]
|
290 |
+
# define documents to ground on:
|
291 |
+
documents = [
|
292 |
+
{ "title": "Tall penguins", "text": "Emperor penguins are the tallest growing up to 122 cm in height." },
|
293 |
+
{ "title": "Penguin habitats", "text": "Emperor penguins only live in Antarctica."}
|
294 |
+
]
|
295 |
+
|
296 |
+
# render the tool use prompt as a string:
|
297 |
+
grounded_generation_prompt = tokenizer.apply_grounded_generation_template(
|
298 |
+
conversation,
|
299 |
+
documents=documents,
|
300 |
+
citation_mode="accurate", # or "fast"
|
301 |
+
tokenize=False,
|
302 |
+
add_generation_prompt=True,
|
303 |
+
)
|
304 |
+
print(grounded_generation_prompt)
|
305 |
+
````
|
306 |
+
</details>
|
307 |
+
|
308 |
+
<details>
|
309 |
+
<summary><b>Example Rendered Grounded Generation Prompt [CLICK TO EXPAND]</b></summary>
|
310 |
+
|
311 |
+
````<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble
|
312 |
+
The instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.
|
313 |
+
|
314 |
+
# System Preamble
|
315 |
+
## Basic Rules
|
316 |
+
You are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions.
|
317 |
+
|
318 |
+
# User Preamble
|
319 |
+
## Task and Context
|
320 |
+
You help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.
|
321 |
+
|
322 |
+
## Style Guide
|
323 |
+
Unless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Whats the biggest penguin in the world?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|><results>
|
324 |
+
Document: 0
|
325 |
+
title: Tall penguins
|
326 |
+
text: Emperor penguins are the tallest growing up to 122 cm in height.
|
327 |
+
|
328 |
+
Document: 1
|
329 |
+
title: Penguin habitats
|
330 |
+
text: Emperor penguins only live in Antarctica.
|
331 |
+
</results><|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Carefully perform the following instructions, in order, starting each with a new line.
|
332 |
+
Firstly, Decide which of the retrieved documents are relevant to the user's last input by writing 'Relevant Documents:' followed by comma-separated list of document numbers. If none are relevant, you should instead write 'None'.
|
333 |
+
Secondly, Decide which of the retrieved documents contain facts that should be cited in a good answer to the user's last input by writing 'Cited Documents:' followed a comma-separated list of document numbers. If you dont want to cite any of them, you should instead write 'None'.
|
334 |
+
Thirdly, Write 'Answer:' followed by a response to the user's last input in high quality natural english. Use the retrieved documents to help you. Do not insert any citations or grounding markup.
|
335 |
+
Finally, Write 'Grounded answer:' followed by a response to the user's last input in high quality natural english. Use the symbols <co: doc> and </co: doc> to indicate when a fact comes from a document in the search result, e.g <co: 0>my fact</co: 0> for a fact from document 0.<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
336 |
+
````
|
337 |
+
|
338 |
+
</details>
|
339 |
+
|
340 |
+
<details>
|
341 |
+
<summary><b>Example Rendered Grounded Generation Completion [CLICK TO EXPAND]</b></summary>
|
342 |
+
|
343 |
+
````
|
344 |
+
Relevant Documents: 0,1
|
345 |
+
Cited Documents: 0,1
|
346 |
+
Answer: The Emperor Penguin is the tallest or biggest penguin in the world. It is a bird that lives only in Antarctica and grows to a height of around 122 centimetres.
|
347 |
+
Grounded answer: The <co: 0>Emperor Penguin</co: 0> is the <co: 0>tallest</co: 0> or biggest penguin in the world. It is a bird that <co: 1>lives only in Antarctica</co: 1> and <co: 0>grows to a height of around 122 centimetres.</co: 0>
|
348 |
+
````
|
349 |
+
</details>
|
350 |
+
|
351 |
+
### Code Capabilities:
|
352 |
+
Command R+ has been optimized to interact with your code, by requesting code snippets, code explanations, or code rewrites. It might not perform well out-of-the-box for pure code completion. For better performance, we also recommend using a low temperature (and even greedy decoding) for code-generation related instructions.
|
353 |
+
|
354 |
+
### Model Card Contact
|
355 |
+
For errors or additional questions about details in this model card, contact [info@for.ai](mailto:info@for.ai).
|
356 |
+
|
357 |
+
### Terms of Use:
|
358 |
+
We hope that the release of this model will make community-based research efforts more accessible, by releasing the weights of a highly performant 104 billion parameter model to researchers all over the world. This model is governed by a [CC-BY-NC](https://cohere.com/c4ai-cc-by-nc-license) License with an acceptable use addendum, and also requires adhering to [C4AI's Acceptable Use Policy](https://docs.cohere.com/docs/c4ai-acceptable-use-policy).
|
359 |
+
|
360 |
+
### Try Chat:
|
361 |
+
You can try Command R+ chat in the playground [here](https://dashboard.cohere.com/playground/chat). You can also use it in our dedicated Hugging Face Space [here](https://huggingface.co/spaces/CohereForAI/c4ai-command-r-plus).
|
c4ai-command-r-plus-IQ3_M-iMat.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:daa5789ff19992e5306f0ce79c8658471a45cef54f7e7731df3ee4ef64b99b2b
|
3 |
+
size 47683347744
|
c4ai-command-r-plus-IQ3_S-iMat.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:987bcc9d8ac97bee5025a8a950b3fc8539b8a40f6eef2af393b87348a8615fa9
|
3 |
+
size 45958702368
|
c4ai-command-r-plus-IQ3_XS-iMat.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b4193fdc88491902b38bf48e4aede49d5a5bb5f4fe89c5e4898739d8fd7f798b
|
3 |
+
size 43599406368
|
c4ai-command-r-plus-IQ3_XXS-iMat.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14e8d6846663f4211c3d44a35d1663c3d540a48412e38f1699c8d1ec6462f928
|
3 |
+
size 40658740512
|
c4ai-command-r-plus-IQ4_XS-iMat-00001-of-00002.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:764ca4de996eba2e6ac12a8f6ae03d924d063ba810e39c43de8730f5d7ac05dd
|
3 |
+
size 45311657536
|
c4ai-command-r-plus-IQ4_XS-iMat-00002-of-00002.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eee2f4f6d7bdcc32f7b5e963e82072ceca4c201d4ce70e4b058dd59dcf42da7f
|
3 |
+
size 10889535392
|
c4ai-command-r-plus-Q3_K_M-iMat-00001-of-00002.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:739ace61c378dab613e499e837f9b39038c64620c05a1ef5e872dafe6bedf4f6
|
3 |
+
size 41195767360
|
c4ai-command-r-plus-Q3_K_M-iMat-00002-of-00002.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e46ff9ae32fd3680ebf37e51e02b7e21793b046e684f51d8a1e5ff595bdf0c0f
|
3 |
+
size 9786662816
|
cmdrplus_imx_c512.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ad2e07b30b1b7200d1c33b29e925c3c02dfb32f2fdeecc9eafb6df6513d6df2f
|
3 |
+
size 27539966
|