From 419946e528dac008af2d0d183bc4a56409e1a4f4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-A4GQ6J5\\Administrator" Date: Mon, 27 Feb 2023 23:35:05 +0800 Subject: [PATCH] add install scripts --- install-cn.ps1 | 35 +++++++++++++++++++++++++++++++++++ install.ps1 | 12 ++++++++++++ models/Put Moderl here.txt | 0 run.ps1 | 7 +++++++ v2/chat.py | 1 + 5 files changed, 55 insertions(+) create mode 100644 install-cn.ps1 create mode 100644 install.ps1 create mode 100644 models/Put Moderl here.txt create mode 100644 run.ps1 diff --git a/install-cn.ps1 b/install-cn.ps1 new file mode 100644 index 00000000..c0225131 --- /dev/null +++ b/install-cn.ps1 @@ -0,0 +1,35 @@ +$Env:PIP_DISABLE_PIP_VERSION_CHECK = 1 +$Env:PIP_NO_CACHE_DIR = 1 +function InstallFail { + Write-Output "安装失败。" + Read-Host | Out-Null ; + Exit +} + +function Check { + param ( + $ErrorInfo + ) + if (!($?)) { + Write-Output $ErrorInfo + InstallFail + } +} + +if (!(Test-Path -Path "venv")) { + Write-Output "正在创建虚拟环境..." + python -m venv venv + Check "创建虚拟环境失败,请检查 python 是否安装完毕以及 python 版本。" +} + +.\venv\Scripts\activate +Check "激活虚拟环境失败。" + +Write-Output "安装程序所需依赖 (已进行国内加速,若无法使用加速源请用 install.ps1)..." +pip install torch==1.13.1+cu117 -f https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html -i https://mirrors.bfsu.edu.cn/pypi/web/simple +Check "torch 安装失败,请删除 venv 文件夹后重新运行。" +pip install numpy tokenizers prompt_toolkit -i https://pypi.tuna.tsinghua.edu.cn/simple/ +Check "其他依赖安装失败。" + +Write-Output "安装完毕。" +Read-Host | Out-Null ; \ No newline at end of file diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 00000000..cf8527c3 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,12 @@ +if (!(Test-Path -Path "venv")) { + Write-Output "Creating venv for python..." + python -m venv venv +} +.\venv\Scripts\activate + +Write-Output "Installing deps..." +pip install torch==1.13.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +pip install numpy tokenizers prompt_toolkit + +Write-Output "Install completed" +Read-Host | Out-Null ; \ No newline at end of file diff --git a/models/Put Moderl here.txt b/models/Put Moderl here.txt new file mode 100644 index 00000000..e69de29b diff --git a/run.ps1 b/run.ps1 new file mode 100644 index 00000000..adec3277 --- /dev/null +++ b/run.ps1 @@ -0,0 +1,7 @@ +# Activate python venv +.\venv\Scripts\activate + +Set-Location .\v2 +python chat.py + +Read-Host | Out-Null ; \ No newline at end of file diff --git a/v2/chat.py b/v2/chat.py index ccf02286..9633517e 100644 --- a/v2/chat.py +++ b/v2/chat.py @@ -76,6 +76,7 @@ elif CHAT_LANG == 'Chinese': # testNovel绯诲垪鏄綉鏂囨ā鍨嬶紝璇峰彧鐢 +gen 鎸囦护缁啓銆倀est4 绯诲垪鍙互闂瓟锛堝彧鐢ㄤ簡灏忎腑鏂囪鏂欏井璋冿紝绾睘濞变箰锛 args.MODEL_NAME = '/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-7b/RWKV-4-Pile-7B-EngChn-testNovel-441-ctx2048-20230217' + # args.MODEL_NAME = '../models/RWKV-4-Pile-7B-EngChn-testNovel-1053-ctx2048-20230225' # args.MODEL_NAME = '/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-3b/RWKV-4-Pile-3B-EngChn-testNovel-711-ctx2048-20230216' # args.MODEL_NAME = '/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-1b5/RWKV-4-Pile-1B5-EngChn-testNovel-671-ctx2048-20230216' # args.MODEL_NAME = '/fsx/BlinkDL/CODE/_PUBLIC_/RWKV-LM/RWKV-v4neo/7-run1z/rwkv-1058'