CohereRAG多语言开源 开源模型

Command R(开源版) Command R

Command R系列 · Cohere · 2024-03发布

开源支持本地部署国内可直连有免费额度长上下文代码专用

模型介绍

Cohere 开源的企业 RAG 模型 Command R,35B 参数、128K 上下文,十种语言,检索增强能力强。

模型基础信息

模型系列Command R系列
开发机构Cohere
发布时间2024-03
参数规模35B
上下文窗口128K
模型类型文本
中文能力良好
使用方式网页体验 / API调用 / 本地部署

免费额度与收费政策

开放权重(非商业)

免费规则详情

CC-BY-NC 非商业;商业用 API。

收费标准简介

本地免费(非商业);API 计费。

模型能力介绍

✅ 核心优势

  • RAG 强
  • 多语�
  • 128K
  • 企业友好

⚠️ 短板与局限

  • 非商业许可
  • 中文一般
  • 生态小

🎯 适用场景

  • 企业知识库
  • 检索问答
  • 多语�
  • 私有化

模型使用教程

本章节整理 Command R(开源版) 的在线体验、API调用、本地部署全套入门教程,快速上手使用该模型。

  • 本地体验:ollama run command-r 或 Transformers / vLLM 加载。
  • 云端:HF 托管模型可在线体验。
ollama run command-r "用中文介绍一下Command R(开源版)"
HF_ENDPOINT=https://hf-mirror.com huggingface-cli download Cohere/Command R --local-dir ./command-r

或 ModelScope 国内直连下载。

from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('Cohere/Command R')
tok = AutoTokenizer.from_pretrained('Cohere/Command R')
code = tok.apply_chat_template([{'role':'user','content':'你好'}], tokenize=False)
print(model.generate(**tok(code, return_tensors='pt')))

Command R 是 Cohere 开放权重的 35B 检索增强模型(CC-BY-NC),vLLM/ollama 均可跑,适合本地 RAG。

  1. vLLM 部署:

pip install vllm && vllm serve CohereForAI/c4ai-command-r-v01 --port 8000

  1. 也可用 Ollama:

ollama pull command-r && ollama run command-r

  1. 接入测试:

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"c4ai-command-r-v01","messages":[{"role":"user","content":"用中文介绍检索增强"}]}'

Tips:35B 全量约 70GB 显存,4bit 量化可压到 24GB;与 llama-index 搭配做本地知识库很顺手。

💡 使用小技巧

商业用途走 Cohere API。

❓ 常见问题 FAQ

Q1:Command R 定位?\nA1:开源 RAG 模型。

访问备注与注意事项