Introducing Cohere Command-R-Plus: Your Next-Gen Language Model for Chat and Beyond
We're excited to introduce Cohere Command-R-Plus 08-2024, a cutting-edge generative large language model optimized for a variety of use cases, including reasoning, summarization, and question answering.
Model Overview
Command R+ leverages an autoregressive language model with an optimized transformer architecture. It has been fine-tuned using supervised fine-tuning (SFT) and preference training to align with human preferences for helpfulness and safety. The model performs exceptionally well in multiple languages, including English, French, Spanish, Italian, German, Brazilian Portuguese, Japanese, Korean, simplified Chinese, and Arabic. Additionally, it supports pre-training data in 13 other languages such as Russian, Polish, Turkish, and more.
Key Features
- Conversational Capabilities: Ideal for chat applications, supporting multi-step tool use and retrieval augmented generation (RAG) workflows.
- Tool Use: Capable of generating a JSON-formatted list of actions for execution on a subset of available tools. Includes a
directly_answer
tool for scenarios where no external tools are needed. - Prompt Template: Uses a specific prompt template for optimal performance, particularly for tool use.
Usage
Online Access: Access Command R+ through the HuggingChat website or other platforms like Jan.ai.
Local Use: Download the model for local use, which requires over 30GB of RAM.
API Integration: Integrate the model using the Cohere API or platforms like Azure AI Studio and Amazon Bedrock.
Technical Details
To use the model, install transformers
version 4.39.1 or higher. Load the model using AutoTokenizer
and AutoModelForCausalLM
from the transformers
library.
Example Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "CohereForAI/c4ai-command-r-plus-08-2024"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
messages = [{"role": "user", "content": "Hello, how are you?"}]
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=100, do_sample=True, temperature=0.3)
gen_text = tokenizer.decode(gen_tokens)
print(gen_text)
This example demonstrates how to use the model for generating responses in a conversational context.
Additional Resources
For comprehensive documentation, including tool use prompt templates, visit the Hugging Face and Cohere documentation sites. The model is also available on platforms like Hugging Face, Azure AI Studio, and Amazon Bedrock.