Update README.md

This commit is contained in:
nomadlx
2025-01-20 15:59:25 +08:00
parent eaf9584c10
commit 152cb2dc21

154
README.md
View File

@@ -1,51 +1,103 @@
--- ---
frameworks: license: apache-2.0
- Pytorch language:
license: Apache License 2.0 - en
tasks: base_model: Qwen/Qwen2.5-14B-Instruct
- text-generation tags:
- chat
#model-type: library_name: transformers
##如 gpt、phi、llama、chatglm、baichuan 等 ---
#- gpt
# Confucius-o1-14B
#domain:
##如 nlp、cv、audio、multi-modal ## Introduction
#- nlp **Confucius-o1-14B** is a o1-like reasoning model developed by the NETEASE Youdao Team, it can be easily deployed on a single GPU without quantization. This model is based on the Qwen2.5-14B-Instruct model and adopts a two-stage learning strategy, enabling the lightweight 14B model to possess thinking abilities similar to those of o1. What sets it apart is that after generating the chain of thought, it can summarize a step-by-step problem-solving process from the chain of thought on its own. This can prevent users from getting bogged down in the complex chain of thought and allows them to easily obtain the correct problem-solving ideas and answers.
#language: However, there are some limitations that must be stated in advance:
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa 1. **Scenario Limitations**: Our optimization is only carried out on data from the K12 mathematics scenario, and the effectiveness has only been verified in math-related benchmark tests. The performance of the model in non-mathematical scenarios has not been tested, so we cannot guarantee its quality and effectiveness in other fields.
#- cn 2. **Language-related Issues**: In the “summary” block, the model has a stronger tendency to generate Chinese content. In the “thinking” block, the model may reason in an unexpected language environment or even present a mixture of languages. However, this does not affect the actual reasoning ability of the model. This indicates that the chain of thought itself may not have independent value, it is merely an easier-to-learn path leading to a correct summary.
3. **Invalid Results**: The model may sometimes fall into circular reasoning. Since we use explicit identifiers to divide the thinking and summary parts, when the model enters this mode, it may generate invalid results that cannot be parsed.
#metrics: 4. **Safety and Ethics**: This model has not undergone optimization and testing for alignment at the safety and ethical levels. Any output generated by the model does not represent the official positions, views, or attitudes of our company. When using this model, users should independently judge and evaluate the rationality and applicability of the output content and comply with relevant laws, regulations, and social ethics.
##如 CIDEr、Blue、ROUGE 等
#- CIDEr For more detailed information, please refer to our [blog]().
#tags: ## Quickstart
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他 The environmental requirements for running it are exactly the same as those of the [Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) model. Therefore, you can easily use Transformers or vLLM to load and run the model for inference, and deploy your services.
#- pretrained
The only thing you need to pay attention to is to use the predefined system message and user message templates provided below to request the model. Other templates may also be usable, but we haven't tested them yet.
#tools: ```python
##如 vllm、fastchat、llamacpp、AdaSeq 等 SYSTEM_PROMPT_TEMPLATE = """你叫"小P老师"是一位由网易有道「子曰」教育大模型创建的AI家庭教师。
#- vllm 尽你所能回答数学问题。
---
### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。 !!! 请记住:
#### 您可以通过如下git clone命令或者ModelScope SDK来下载模型 - 你应该先通过思考探索正确的解题思路然后按照你思考过程里正确的解题思路总结出一个包含3-5步解题过程的回答。
SDK下载 思考过程的一些准则:
```bash - 这个思考过程应该呈现出一种原始、自然且意识流的状态,就如同你在解题时内心的独白一样,因此可以包含一些喃喃自语。
#安装ModelScope - 在思考初期,你应该先按自己的理解重述问题,考虑问题暗含的更广泛的背景信息,并梳理出已知和未知的元素,及其与你所学知识的一些关联点,并发散思维考虑可能有几种潜在的解题思路。
pip install modelscope - 当你确定了一个解题思路时,你应该先逐步按预想的思路推进,但是一旦你发现矛盾或者不符合预期的地方,你应该及时停下来,提出你的质疑,认真验证该思路是否还可以继续。
``` - 当你发现一个思路已经不可行时,你应该灵活切换到其他思路上继续推进你的思考。
```python - 当你按照一个思路给出答案后,切记要仔细验证你的每一个推理和计算细节,这时候逆向思维可能有助于你发现潜在的问题。
#SDK模型下载 - 你的思考应该是细化的,需要包括详细的计算和推理的细节。
from modelscope import snapshot_download - 包含的喃喃自语应该是一个口语化的表达,需要和上下文语境匹配,并且尽量多样化。
model_dir = snapshot_download('netease-youdao/Confucius-o1-14B')
``` 总结的解题过程的格式要求:
Git下载 - 求解过程应该分为3-5步每个步骤前面都明确给出步骤序号比如“步骤1”及其小标题
``` - 每个步骤里只给出核心的求解过程和阶段性答案。
#Git模型下载 - 在最后一个步骤里,你应该总结一下最终的答案。
git clone https://www.modelscope.cn/netease-youdao/Confucius-o1-14B.git
``` 请使用以下模板。
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p> <question>待解答的数学问题</question>
<thinking>
这里记录你详细的思考过程
</thinking>
<summary>
根据思考过程里正确的解题路径总结出的包含3-5步解题过程的回答。
</summary>"""
USER_PROMPT_TEMPLATE = """现在,让我们开始吧!
<question>{question}</question>"""
```
Then you can create your `messages` as follows and use them to request model results. You just need to fill in your instructions in the "question" field.
```python
messages = [
{'role': 'system', 'content': SYSTEM_PROMPT_TEMPLATE},
{'role': 'user', 'content': USER_PROMPT_TEMPLATE.format(question=question)},
]
```
After obtaining the model results, you can parse out the "thinking" and "summary" parts as follows.
```python
def parse_result_nostep(result):
thinking_pattern = r"<thinking>(.*?)</thinking>"
summary_pattern = r"<summary>(.*?)</summary>"
thinking_list = re.findall(thinking_pattern, result, re.DOTALL)
summary_list = re.findall(summary_pattern, result, re.DOTALL)
assert len(thinking_list) == 1 and len(summary_list) == 1, \
f"The parsing results do not meet the expectations.\n{result}"
thinking = thinking_list[0].strip()
summary = summary_list[0].strip()
return thinking, summary
thinking, summary = parse_result_nostep(result)
```
## Citation
If you find our work helpful, feel free to give us a cite.
```
@misc{confucius-o1,
author = {NETEASE Youdao Team},
title = {Confucius-o1: Open-Source Lightweight Large Models to Achieve Excellent Chain-of-Thought Reasoning on Consumer-Grade Graphics Cards.},
url = {},
month = {January},
year = {2025}
}
```