From 2a55c8256db5949693b53830f2e285dbf410611c Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 10 May 2024 16:37:31 +0800 Subject: [PATCH] add torch cnMirror --- backend-golang/rwkv.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend-golang/rwkv.go b/backend-golang/rwkv.go index 1c12e5b..39d3f1e 100644 --- a/backend-golang/rwkv.go +++ b/backend-golang/rwkv.go @@ -227,8 +227,12 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) { if runtime.GOOS == "windows" { ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages") + torchIndexUrl := "https://download.pytorch.org/whl/cu117" + if cnMirror { + torchIndexUrl = "https://mirrors.aliyun.com/pytorch-wheels/cu117" + } installScript := python + " ./backend-python/get-pip.py -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" + - python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cu117 --no-warn-script-location\n" + + python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url " + torchIndexUrl + " --no-warn-script-location\n" + python + " -m pip install -r ./backend-python/requirements.txt -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" + "exit" if !cnMirror {