From 00d82154dc2f8c2805b324fd1b78c2cb5a890106 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 10 May 2024 22:01:09 +0800 Subject: [PATCH] improve 2a55c825 --- backend-golang/rwkv.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend-golang/rwkv.go b/backend-golang/rwkv.go index 39d3f1e..7dd7e88 100644 --- a/backend-golang/rwkv.go +++ b/backend-golang/rwkv.go @@ -215,8 +215,12 @@ func (a *App) DepCheck(python string) error { func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) { var err error + torchWhlUrl := "torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cu117" if python == "" { python, err = GetPython() + if cnMirror && python == "py310/python.exe" { + torchWhlUrl = "https://mirrors.aliyun.com/pytorch-wheels/cu117/torch-1.13.1+cu117-cp310-cp310-win_amd64.whl" + } if runtime.GOOS == "windows" { python = `"%CD%/` + python + `"` } @@ -227,12 +231,8 @@ 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 " + torchIndexUrl + " --no-warn-script-location\n" + + python + " -m pip install " + torchWhlUrl + " --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 {