Text Generation
Transformers
Safetensors
cohere
conversational
text-generation-inference
4-bit precision
gptq
Instructions to use alpindale/c4ai-command-r-plus-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alpindale/c4ai-command-r-plus-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alpindale/c4ai-command-r-plus-GPTQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("alpindale/c4ai-command-r-plus-GPTQ") model = AutoModelForCausalLM.from_pretrained("alpindale/c4ai-command-r-plus-GPTQ", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use alpindale/c4ai-command-r-plus-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alpindale/c4ai-command-r-plus-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alpindale/c4ai-command-r-plus-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/alpindale/c4ai-command-r-plus-GPTQ
- SGLang
How to use alpindale/c4ai-command-r-plus-GPTQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "alpindale/c4ai-command-r-plus-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alpindale/c4ai-command-r-plus-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "alpindale/c4ai-command-r-plus-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alpindale/c4ai-command-r-plus-GPTQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use alpindale/c4ai-command-r-plus-GPTQ with Docker Model Runner:
docker model run hf.co/alpindale/c4ai-command-r-plus-GPTQ
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -16,6 +16,8 @@ language:
|
|
| 16 |
|
| 17 |
# Model Card for C4AI Command R+
|
| 18 |
|
|
|
|
|
|
|
| 19 |
|
| 20 |
## Model Summary
|
| 21 |
|
|
@@ -92,32 +94,7 @@ print(gen_text)
|
|
| 92 |
|
| 93 |
**Quantized model through bitsandbytes, 4-bit precision**
|
| 94 |
|
| 95 |
-
|
| 96 |
-
# pip install 'git+https://github.com/huggingface/transformers.git' bitsandbytes accelerate
|
| 97 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
| 98 |
-
|
| 99 |
-
bnb_config = BitsAndBytesConfig(load_in_4bit=True)
|
| 100 |
-
|
| 101 |
-
model_id = "CohereForAI/c4ai-command-r-plus"
|
| 102 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 103 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config)
|
| 104 |
-
|
| 105 |
-
# Format message with the command-r-plus chat template
|
| 106 |
-
messages = [{"role": "user", "content": "Hello, how are you?"}]
|
| 107 |
-
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
| 108 |
-
## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
|
| 109 |
-
|
| 110 |
-
gen_tokens = model.generate(
|
| 111 |
-
input_ids,
|
| 112 |
-
max_new_tokens=100,
|
| 113 |
-
do_sample=True,
|
| 114 |
-
temperature=0.3,
|
| 115 |
-
)
|
| 116 |
-
|
| 117 |
-
gen_text = tokenizer.decode(gen_tokens[0])
|
| 118 |
-
print(gen_text)
|
| 119 |
-
```
|
| 120 |
-
|
| 121 |
|
| 122 |
## Model Details
|
| 123 |
|
|
@@ -133,6 +110,25 @@ Pre-training data additionally included the following 13 languages: Russian, Pol
|
|
| 133 |
|
| 134 |
**Context length**: Command R+ supports a context length of 128K.
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
### Tool use & multihop capabilities:
|
| 137 |
|
| 138 |
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.
|
|
|
|
| 16 |
|
| 17 |
# Model Card for C4AI Command R+
|
| 18 |
|
| 19 |
+
🚨 **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)**.
|
| 20 |
+
|
| 21 |
|
| 22 |
## Model Summary
|
| 23 |
|
|
|
|
| 94 |
|
| 95 |
**Quantized model through bitsandbytes, 4-bit precision**
|
| 96 |
|
| 97 |
+
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
## Model Details
|
| 100 |
|
|
|
|
| 110 |
|
| 111 |
**Context length**: Command R+ supports a context length of 128K.
|
| 112 |
|
| 113 |
+
## Evaluations
|
| 114 |
+
|
| 115 |
+
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.
|
| 116 |
+
|
| 117 |
+
| Model | Average | Arc (Challenge) | Hella Swag | MMLU | Truthful QA | Winogrande | GSM8k |
|
| 118 |
+
|:--------------------------------|----------:|------------------:|-------------:|-------:|--------------:|-------------:|--------:|
|
| 119 |
+
| **CohereForAI/c4ai-command-r-plus** | 74.6 | 70.99 | 88.6 | 75.7 | 56.3 | 85.4 | 70.7 |
|
| 120 |
+
| [DBRX Instruct](https://huggingface.co/databricks/dbrx-instruct) | 74.5 | 68.9 | 89 | 73.7 | 66.9 | 81.8 | 66.9 |
|
| 121 |
+
| [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 |
|
| 122 |
+
| [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 |
|
| 123 |
+
| [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 |
|
| 124 |
+
| [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 |
|
| 125 |
+
| [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 |
|
| 126 |
+
| [Gemma-7B](https://huggingface.co/google/gemma-7b) | 63.8 | 61.1 | 82.2 | 64.6 | 44.8 | 79 | 50.9 |
|
| 127 |
+
| [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 |
|
| 128 |
+
| [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) | 61 | 60 | 83.3 | 64.2 | 42.2 | 78.4 | 37.8 |
|
| 129 |
+
|
| 130 |
+
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/).
|
| 131 |
+
|
| 132 |
### Tool use & multihop capabilities:
|
| 133 |
|
| 134 |
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.
|