diff --git a/README.md b/README.md index ec5afde..1cce62c 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ -**EmoLLM**是一个能够支持 **理解用户-支持用户-帮助用户** 心理健康辅导链路的心理健康大模型,由[InternLM2](https://github.com/InternLM/InternLM)指令微调而来,欢迎大家star~⭐⭐ +**EmoLLM** 是一个能够支持 **理解用户-支持用户-帮助用户** 心理健康辅导链路的心理健康大模型,由 [InternLM2](https://github.com/InternLM/InternLM) 指令微调而来,欢迎大家star~⭐⭐ --- @@ -60,20 +60,19 @@ - [EmoLLM-心理健康大模型](#emollm-心理健康大模型) - [目录](#目录) - - [开发前的配置要求](#开发前的配置要求) - - [**使用指南**](#使用指南) + - [开发前的配置要求](#开发前的配置要求) + - [**使用指南**](#使用指南) - [文件目录说明](#文件目录说明) - [数据构建](#数据构建) - [微调指南](#微调指南) - - [demo部署](#demo部署) + - [部署指南](#部署指南) - [使用到的框架](#使用到的框架) - [贡献者](#贡献者) - [如何参与开源项目](#如何参与开源项目) - [版本控制](#版本控制) - - [作者](#作者) + - [作者(排名不分先后)](#作者排名不分先后) - [版权说明](#版权说明) - - [鸣谢](#鸣谢) - - [Star History](#star-history) + - [特别鸣谢](#特别鸣谢) - [🌟 Contributors](#-contributors) ###### 开发前的配置要求 @@ -90,7 +89,7 @@ git clone https://github.com/aJupyter/EmoLLM.git - [文件目录说明](#文件目录说明) - [数据构建](#数据构建) - [微调指南](#微调指南) - - [demo部署](#demo部署) + - [部署指南](#部署指南) - 查看更多详情 @@ -119,7 +118,6 @@ filetree ├── /templates/ ├── useless.md └── /util/ - ``` @@ -133,13 +131,9 @@ filetree 详见[微调指南](xtuner_config/README.md) -### demo部署 - -详见[demo](https://github.com/aJupyter/EmoLLM/demo) - - - +### 部署指南 +详见[部署指南](demo/README.md) ### 使用到的框架 @@ -150,7 +144,7 @@ filetree ### 贡献者 -请阅读**CONTRIBUTING.md** 查阅为该项目做出贡献的开发者。 +请阅读 **CONTRIBUTING.md** 查阅为该项目做出贡献的开发者。 #### 如何参与开源项目 @@ -175,7 +169,7 @@ filetree [aJupyter](https://github.com/aJupyter)@datawhale成员、南开大学在读硕士 -[jujimeizup](https://github.com/jujimeizuo)@ +[jujimeizuo](https://github.com/jujimeizuo)@江南大学硕士 [Smiling&Weeping](https://github.com/Smiling-Weeping-zhr)@ @@ -197,9 +191,10 @@ filetree -## Star History + + ## 🌟 Contributors diff --git a/assets/deploy_1.png b/assets/deploy_1.png new file mode 100644 index 0000000..5264123 Binary files /dev/null and b/assets/deploy_1.png differ diff --git a/assets/deploy_2.png b/assets/deploy_2.png new file mode 100644 index 0000000..1ca8859 Binary files /dev/null and b/assets/deploy_2.png differ diff --git a/assets/deploy_3.png b/assets/deploy_3.png new file mode 100644 index 0000000..17cdfbd Binary files /dev/null and b/assets/deploy_3.png differ diff --git a/assets/deploy_4.png b/assets/deploy_4.png new file mode 100644 index 0000000..298d5e4 Binary files /dev/null and b/assets/deploy_4.png differ diff --git a/demo/README.md b/demo/README.md new file mode 100644 index 0000000..f21d41b --- /dev/null +++ b/demo/README.md @@ -0,0 +1,60 @@ +# EmoLLM 部署指南 + +## 本地部署 + +- Clone repo + +```bash +git clone https://github.com/aJupyter/EmoLLM.git +``` + +- 安装依赖 + +```bash +pip install -r requirements.txt +``` + +- 下载模型 + + - 模型权重:https://openxlab.org.cn/models/detail/jujimeizuo/EmoLLM_Model + - 通过 openxlab.model.download 下载,详情请看 [cli_internlm2](./cli_internlm2.py) + + ```bash + from openxlab.model import download + + download(model_repo='jujimeizuo/EmoLLM_Model', + output='model') + ``` + - 可以手动下载,放在 `./model` 目录下,然后把上面的代码删掉 + +- cli_demo + +```bash +python ./demo/cli_internlm2.py +``` + +- web_demo + +```bash +python ./app.py +``` + +如果在服务器上部署,需要配置本地端口映射 + +## OpenXLab 上部署 + +- 登陆 OpenXLab,创建 Gradio 应用 + +![Login OpenXLab](../assets/deploy_1.png) + +- 选择配置,立即创建 + +![config](../assets/deploy_2.png) + +- 等待构建、启动 + +![wait a minutes](../assets/deploy_3.png) + +- 项目体验 + +![enjoy](../assets/deploy_4.png) \ No newline at end of file diff --git a/demo/cli_internlm2.py b/demo/cli_internlm2.py index 6886802..0a5ba2e 100644 --- a/demo/cli_internlm2.py +++ b/demo/cli_internlm2.py @@ -1,8 +1,11 @@ import torch from transformers import AutoTokenizer, AutoModelForCausalLM +from openxlab.model import download +download(model_repo='jujimeizuo/EmoLLM_Model', + output='model') -model_name_or_path = "./model" +model_name_or_path = "model" tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained(model_name_or_path, trust_remote_code=True, torch_dtype=torch.bfloat16, device_map='auto')