文件最后提交记录最后更新时间
!7390 add DeepSeek-R1-Safe Merge pull request !7390 from ZJUAISafety/master 8 个月前
!7390 add DeepSeek-R1-Safe Merge pull request !7390 from ZJUAISafety/master 8 个月前
!7390 add DeepSeek-R1-Safe Merge pull request !7390 from ZJUAISafety/master 8 个月前
!7390 add DeepSeek-R1-Safe Merge pull request !7390 from ZJUAISafety/master 8 个月前
文档整改,gitee->gitcode Co-authored-by: Lighters_c<zyh13227@163.com> # message auto-generated for no-merge-commit merge: !7469 merge ffffix into master 文档整改,gitee->gitcode Created-by: addsubmuldiv Commit-by: Lighters_c Merged-by: ascend-robot Description: ## Motivation Please describe the motivation of this PR and the goal you want to achieve through this PR. ## Modification Please briefly describe what modification is made in this PR. ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [ ] The new code needs to comply with the Clean Code specification. - [ ] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [ ] CLA has been signed and all committers have signed the CLA in this PR. - [ ] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/ModelZoo-PyTorch!74695 个月前
README.md

icon text

DeepSeek-R1-Safe 框架

DeepSeek-R1-Safe是由浙江大学网络空间安全学院和华为合作的基于DeepSeek衍生的安全大模型,在华为昇腾芯片MindSpeedLLM等框架的基础上开发。

该模型的训练流程如下:

  1. 训练数据生成:构建安全、合规的数据集

  2. 安全监督训练:在训练过程中引入安全约束

  3. 安全强化学习:通过 RLHF 等方法优化模型行为

  4. 模型性能评测:对安全性能和通用性能进行全面评估

本仓库发布了相关流程介绍,为研究者和开发者提供参考和实践基础。

📚 项目介绍

🛡️ 安全语料

我们基于国内外法律法规与核心价值观,构建了中英文双语的安全语料。其中语料不仅包含了带有安全思维链的标注,还提供了相应的安全回复,可用于大模型的安全训练、微调以及测试

🔒 安全模型

我们开源了经过安全训练的DeepSeek-R1满血版模型。该模型在保持推理性能的同时,显著提升了安全性与合规性。
模型权重已托管在modelscope魔搭社区上,研究者与开发者可通过以下链接进行访问:

👉 DeepSeek-R1-Safe 模型权重

📁 文件结构

DeepSeek-R1-Safe
├── Code  # directory for code
│   ├── MindSpeed-LLM  # directory of the specific version of MindSpeed-LLM
├── scripts  # contains running scripts
│   ├── generate_deepseekr1safe_ptd.sh
└── README.md

运行推理

💻 所需硬件环境

运行DeepSeek-R1-Safe推理需要至少8台Atlas 800T A2服务器

🤖 环境配置

DeepSeek-R1-Safe 的环境依赖如下表所示,具体安装指导请参考:安装指导

依赖软件 版本
昇腾NPU驱动
昇腾NPU固件
在研版本
Toolkit(开发套件)
Kernel(算子包)
NNAL(Ascend Transformer Boost加速库)
在研版本
Python 3.10
PyTorch 2.6
torch_npu插件
apex
在研版本

请将链接中指定版本的MindSpeed-LLM仓库置于Code/MindSpeed-LLM。

🚀 运行推理脚本

在配置好环境后,请依次在8台服务器上按照实际运行环境修改推理脚本中的包括但不限于主节点IP、路径等各种参数以及对应的NODE_RANK(从0-7编号,编号0为主节点)

随后在8台服务器上同时运行推理脚本

💡 测试示例

英文示例

中文示例