Cogito V1 Preview Qwen 32B Exl2 4.65bpw
Cogito v1 預覽版是基於Qwen2.5-32B的指令調優生成式模型,支持30多種語言,上下文長度達128k,針對編程、STEM、指令遵循和通用幫助性進行了優化。
下載量 27
發布時間 : 4/9/2025
模型概述
Cogito 大語言模型是指令調優的生成式模型(文本輸入/文本輸出),支持混合推理模式(標準模式和深度思考模式),採用迭代蒸餾與放大(IDA)訓練策略,適用於多語言、編程和工具調用場景。
模型特點
混合推理模式
支持標準模式和深度思考模式(自我反思推理),可根據需求切換。
迭代蒸餾與放大(IDA)訓練
採用可擴展且高效的對齊策略,通過迭代自我改進實現超智能。
多語言支持
支持30多種語言訓練,上下文長度達128k。
工具調用能力
支持單次、並行、多次及並行多次工具調用,適用於標準和深度思考模式。
模型能力
文本生成
指令遵循
編程輔助
STEM問題解答
多語言處理
工具調用
使用案例
編程輔助
腳本生成
生成bash腳本處理特定任務,如矩陣轉置。
可生成功能完整的腳本代碼。
通用問答
知識問答
回答各類知識性問題,如解釋大語言模型。
提供準確且詳細的解釋。
工具集成
天氣查詢
通過工具調用獲取指定地點的當前溫度。
正確調用工具並返回結果。
🚀 Cogito v1預覽版 - 32B
Cogito是經過指令調優的生成式大語言模型(文本輸入/文本輸出),所有模型均在開放許可下發布,可用於商業用途。該模型具有混合推理能力,支持多語言、編碼和工具調用,在常見行業基準測試中表現出色。
✨ 主要特性
- 混合推理能力:Cogito模型是混合推理模型,每個模型既可以直接回答問題(標準大語言模型模式),也可以在回答前進行自我反思(類似推理模型)。
- 先進的訓練策略:這些大語言模型使用迭代蒸餾與放大(Iterated Distillation and Amplification,IDA) 進行訓練,這是一種可擴展且高效的對齊策略,通過迭代自我改進實現超級智能。
- 多方面能力優化:模型在編碼、STEM、指令遵循和通用實用性方面進行了優化,在多語言、編碼和工具調用能力上顯著高於同等規模的同類模型。在標準和推理模式下,Cogito v1預覽版模型在常見行業基準測試中均優於同等規模的同類模型。
- 多語言支持與長上下文:每個模型使用30多種語言進行訓練,並支持128k的上下文長度。
📚 詳細文檔
評估
我們將模型在直接模式和推理模式下與同等規模的先進模型進行了比較。在直接模式下,我們與Llama / Qwen的指令模型進行比較;在推理模式下,我們使用Deepseek的R1蒸餾模型 / Qwen的QwQ模型進行對比。
Livebench全球平均得分:
如需詳細評估,請參考博客文章。
💻 使用示例
基礎用法
以下是使用Transformers庫調用模型的示例代碼:
import transformers
import torch
model_id = "deepcogito/cogito-v1-preview-qwen-32B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Give me a short introduction to LLMs."},
]
outputs = pipeline(
messages,
max_new_tokens=512,
)
print(outputs[0]["generated_text"][-1])
高級用法
啟用深度思考
- 默認情況下,模型將以標準模式回答問題。
- 若要啟用思考模式,可通過以下兩種方法之一實現:
- 方法一:添加特定系統提示
若要啟用思考模式,只需在系統提示中使用
system_instruction = 'Enable deep thinking subroutine.'
。若已有系統提示,則使用system_instruction = 'Enable deep thinking subroutine.' + '\n\n' + system_instruction
。
- 方法一:添加特定系統提示
若要啟用思考模式,只需在系統提示中使用
import transformers
import torch
model_id = "deepcogito/cogito-v1-preview-qwen-32B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
DEEP_THINKING_INSTRUCTION = "Enable deep thinking subroutine."
messages = [
{"role": "system", "content": DEEP_THINKING_INSTRUCTION},
{"role": "user", "content": "Write a bash script that takes a matrix represented as a string with format '[1,2],[3,4],[5,6]' and prints the transpose in the same format."},
]
outputs = pipeline(
messages,
max_new_tokens=512,
)
print(outputs[0]["generated_text"][-1])
若已有系統提示,可按以下方式將 DEEP_THINKING_INSTRUCTION
添加到開頭:
DEEP_THINKING_INSTRUCTION = "Enable deep thinking subroutine."
system_prompt = "Reply to each prompt with only the actual code - no explanations."
prompt = "Write a bash script that takes a matrix represented as a string with format '[1,2],[3,4],[5,6]' and prints the transpose in the same format."
messages = [
{"role": "system", "content": DEEP_THINKING_INSTRUCTION + '\n\n' + system_prompt},
{"role": "user", "content": prompt}
]
- 方法二:在分詞器中設置
enable_thinking=True
如果你使用Huggingface分詞器,可以在應用聊天模板時添加參數enable_thinking=True
。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "deepcogito/cogito-v1-preview-qwen-32B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to LLMs."
messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
工具調用
Cogito模型在標準和擴展思考模式下均支持工具調用(單工具、並行、多工具和並行多工具)。
# First, define a tool
def get_current_temperature(location: str) -> float:
"""
Get the current temperature at a location.
Args:
location: The location to get the temperature for, in the format "City, Country"
Returns:
The current temperature at the specified location in the specified units, as a float.
"""
return 22. # A real function should probably actually get the temperature!
# Next, create a chat and apply the chat template
messages = [
{"role": "user", "content": "Hey, what's the temperature in Paris right now?"}
]
model_inputs = tokenizer.apply_chat_template(messages, tools=[get_current_temperature], add_generation_prompt=True)
text = tokenizer.apply_chat_template(messages, tools=[get_current_temperature], add_generation_prompt=True, tokenize=False)
inputs = tokenizer(text, return_tensors="pt", add_special_tokens=False).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
output_text = tokenizer.batch_decode(outputs)[0][len(text):]
print(output_text)
這將產生以下輸出:
<tool_call>
{"name": "get_current_temperature", "arguments": {"location": "Paris, France"}}
</tool_call><|im_end|>
你可以像往常一樣從這個輸入生成文本。如果模型生成了工具調用,你應該將其添加到聊天中:
tool_call = {"name": "get_current_temperature", "arguments": {"location": "Paris, France"}}
messages.append({"role": "assistant", "tool_calls": [{"type": "function", "function": tool_call}]})
然後調用工具並將結果以 tool
角色添加到聊天中:
messages.append({"role": "tool", "name": "get_current_temperature", "content": "22.0"})
之後,你可以再次調用 generate()
讓模型在聊天中使用工具結果:
text = tokenizer.apply_chat_template(messages, tools=[get_current_temperature], add_generation_prompt=True, tokenize=False)
inputs = tokenizer(text, return_tensors="pt", add_special_tokens=False).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
output_text = tokenizer.batch_decode(outputs)[0][len(text):]
這將產生以下字符串輸出:
'The current temperature in Paris is 22.0 degrees.<|im_end|>'
📄 許可證
本倉庫和模型權重遵循Apache 2.0許可協議。
📞 聯繫我們
如果您想聯繫我們的團隊,請發送電子郵件至 contact@deepcogito.com。
Phi 2 GGUF
其他
Phi-2是微軟開發的一個小型但強大的語言模型,具有27億參數,專注於高效推理和高質量文本生成。
大型語言模型 支持多種語言
P
TheBloke
41.5M
205
Roberta Large
MIT
基於掩碼語言建模目標預訓練的大型英語語言模型,採用改進的BERT訓練方法
大型語言模型 英語
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基礎模型的蒸餾版本,在保持相近性能的同時更輕量高效,適用於序列分類、標記分類等自然語言處理任務。
大型語言模型 英語
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一個多語言大語言模型,針對多語言對話用例進行了優化,在常見的行業基準測試中表現優異。
大型語言模型 英語
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基於100種語言的2.5TB過濾CommonCrawl數據預訓練的多語言模型,採用掩碼語言建模目標進行訓練。
大型語言模型 支持多種語言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基於Transformer架構的英語預訓練模型,通過掩碼語言建模目標在海量文本上訓練,支持文本特徵提取和下游任務微調
大型語言模型 英語
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI發佈的開放預訓練Transformer語言模型套件,參數量從1.25億到1750億,旨在對標GPT-3系列性能,同時促進大規模語言模型的開放研究。
大型語言模型 英語
O
facebook
6.3M
198
1
基於transformers庫的預訓練模型,適用於多種NLP任務
大型語言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多語言大語言模型系列,包含8B、70B和405B參數規模,支持8種語言和代碼生成,優化了多語言對話場景。
大型語言模型
Transformers 支持多種語言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基礎版是由Google開發的文本到文本轉換Transformer模型,參數規模2.2億,支持多語言NLP任務。
大型語言模型 支持多種語言
T
google-t5
5.4M
702
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98