ChatPLUG
1.0.0
这是 ChatPLUG 项目的存储库,旨在构建和共享中文开放域对话系统。
爱用emoji的萌妹子小婉 | 富有智慧的得道高僧 | 会说古文的三国NPC关羽 |
---|---|---|
角色扮演聊天
与现有的开源模型相比,我们强调ChatPLUG的三个特点:
在推理过程中可以灵活地集成外部知识,并且这是可选的输入。您可以利用
search engine
获取最新信息或使用本地知识库获取领域知识。
通过设置
bot profiles
或使用role-paly instructions
可以轻松自定义对话和角色的风格。
它通过多轮对话展示了其在开放域对话方面的熟练程度,同时还在广泛的 NLP 任务上展示了令人印象深刻的
multi-task abilities
。
我们提供三种使用或继续开发 ChatPLUG 的方法,如下所示:
入门 | 推理 | 火车 | 部署 | |
---|---|---|---|---|
模型范围 | 简单的 | ✔️ 命令行 | 未准备好 | 未准备好 |
抱脸 | 中等的 | ✔️ 命令行 | 未准备好 | 未准备好 |
XDPX | 难的 | ✔️ 命令行 | ✔️ 支持 | ✔️ 服务 |
您可以从 ModelScope 下载并使用 ChatPLUG 模型。
型号名称 | 网址 |
---|---|
聊天PLUG-240M | ChatPLUG-开放域对话模型-240M |
聊天PLUG-3.7B | ChatPLUG-开放域对话模型-3.7B |
即将推出。
XDPX 是一个易于使用的库,允许研究人员和开发人员以简化的方式训练自定义模型并构建自己的聊天机器人。其一体化功能可提供一站式解决方案,简化复杂的流程。快速启动
使用 ChatPLUG-3.7B 时,可以设置
core_chat_half_precision : true
以节省内存。
# Requirement
# in the dir of XDPX
cd XDPX
pip install -e .
# Download checkpoints
# in the same dir as the download.sh
cd ..
sh download.sh
# Inference
# in the dir of XDPX
cd XDPX
CUDA_VISIBLE_DEVICES=0 x-script fidchat_new chat_pipeline/chatplug_3.7B_sftv2.6.0_instruction.hjson
# input `#exit` and exit the terminal
如果您的 GPU(例如 A100、A10)支持 bf16,请设置
deepspeed_bf16: true
和deepspeed_fp16: false
,否则设置deepspeed_bf16: false
和deepspeed_fp16: true
# 1. Download dataset from belle
# in ChatPLUG/data/belle dir
cd data/belle
git lfs install
git clone https://huggingface.co/datasets/BelleGroup/train_0.5M_CN
python process_belle_0.5M.py
# $ls data/belle
# train_0.jsonl dev.jsonl ...
# 2. Preprocess Data
# in XDPX dir
x-prepro chat_pipeline/chatplug_prepro_sft_instruction.hjson
# $ls data/dialogue/sft/chatplug/belle_instruction
# train_0.pt dev.pt
# 3. Training
# in XDPX dir
x-train chat_pipeline/chatplug_3.7B_train_sftv2.6.0_instruction.hjson
即将推出。
安装说明请参阅安装。
有关详细的用户指南,请参阅我们的文档:
用户指南
高级指南
如果您发现我们的项目对您的工作有用,请引用:
@misc{tian2023chatplug,
title={ChatPLUG: Open-Domain Generative Dialogue System with Internet-Augmented Instruction Tuning for Digital Human},
author={Junfeng Tian and Hehong Chen and Guohai Xu and Ming Yan and Xing Gao and Jianhai Zhang and Chenliang Li and Jiayi Liu and Wenshen Xu and Haiyang Xu and Qi Qian and Wei Wang and Qinghao Ye and Jiejing Zhang and Ji Zhang and Fei Huang and Jingren Zhou},
year={2023},
eprint={2304.07849},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{plug2021,
title = {{PLUG: Pre-training for Language Understanding and Generation}},
author={ModelScope},
publisher = {ModelScope},
journal = {ModelScope repository},
year = {2021},
howpublished = {url{https://modelscope.cn/models/damo/nlp_plug_text-generation_27B/summary}},
}
此代码根据 Apache 许可证(版本 2.0)获得许可。