Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka17032 authored Oct 3, 2021
1 parent b3f228b commit 7a96d28
Show file tree
Hide file tree
Showing 26 changed files with 34,685 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 THU-PLM

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Asoul-reply

本项目使用来自b站评论区的30w条评论对微调[CPM](https://github.com/TsinghuaAI/CPM-1-Generate)的大模型,并且在此基础上蒸馏而成。

大模型效果:[b站视频](https://www.bilibili.com/video/BV1L44y1b7gE)

本项目是蒸馏后的模型,效果比源模型略低。

## 安装

首先安装pytorch等基础依赖,再安装[APEX](https://github.com/NVIDIA/apex#quick-start)以支持fp16:
```
pip install -r requirements.txt
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
```

或者使用智源提供的Docker容器。安装方式如下:
```
docker pull dmye/cpm:v0
```
参考运行指令如下:
```
sudo docker run --gpus '"device=0,1"' -it -v <path>:/CPM --name=cpm cpm:v0
```
其中`<path>`为代码所在目录,-v进行文件目录挂载

## 使用

下载好模型后放在项目根目录`models`文件夹中。

提供了命令行交互式生成:
```
bash scripts/generate_text.sh
```
运行该脚本需要两块GPU。
367 changes: 367 additions & 0 deletions arguments.py

Large diffs are not rendered by default.

Binary file added bpe_3w_new/chinese_vocab.model
Binary file not shown.
Loading

0 comments on commit 7a96d28

Please sign in to comment.