Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Jul 25, 2024
1 parent 8127ea4 commit 97a3cd3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
ref: master
- uses: actions/setup-go@v5
with:
go-version: "1.20.5"
go-version: "1.22.5"
- uses: actions/setup-python@v5
id: cp310
with:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
ref: master
- uses: actions/setup-go@v5
with:
go-version: "1.20.5"
go-version: "1.22.5"
- run: |
wget https://github.com/josStorer/ai00_rwkv_server/releases/latest/download/webgpu_server_linux_x86_64 -O ./backend-rust/webgpu_server
wget https://github.com/josStorer/web-rwkv-converter/releases/latest/download/web-rwkv-converter_linux_x86_64 -O ./backend-rust/web-rwkv-converter
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
ref: master
- uses: actions/setup-go@v5
with:
go-version: "1.20.5"
go-version: "1.22.5"
- run: |
wget https://github.com/josStorer/ai00_rwkv_server/releases/latest/download/webgpu_server_darwin_aarch64 -O ./backend-rust/webgpu_server
wget https://github.com/josStorer/web-rwkv-converter/releases/latest/download/web-rwkv-converter_darwin_aarch64 -O ./backend-rust/web-rwkv-converter
Expand Down
5 changes: 2 additions & 3 deletions backend-golang/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,12 @@ func (a *App) OnStartup(ctx context.Context) {
if err == nil {
if runtime.GOOS == "darwin" {
a.exDir = filepath.Dir(ex) + "/../../../"
a.cmdPrefix = "cd " + a.exDir + " && "
} else {
a.exDir = filepath.Dir(ex) + "/"
a.cmdPrefix = "cd " + a.exDir + " && "
}
a.cmdPrefix = "cd " + a.exDir + " && "
if a.Dev {
a.exDir = ""
a.exDir = a.exDir + "../../"
} else {
os.Chdir(a.exDir)
}
Expand Down
16 changes: 8 additions & 8 deletions backend-golang/rwkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (a *App) StartServer(python string, port int, host string, webui bool, rwkv
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand Down Expand Up @@ -65,7 +65,7 @@ func (a *App) ConvertModel(python string, modelPath string, strategy string, out
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand Down Expand Up @@ -98,7 +98,7 @@ func (a *App) ConvertSafetensorsWithPython(python string, modelPath string, outP
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand All @@ -113,7 +113,7 @@ func (a *App) ConvertGGML(python string, modelPath string, outPath string, Q51 b
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand All @@ -132,7 +132,7 @@ func (a *App) ConvertData(python string, input string, outputPrefix string, voca
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand Down Expand Up @@ -185,7 +185,7 @@ func (a *App) MergeLora(python string, useGpu bool, loraAlpha int, baseModel str
return "", err
}
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return "", err
Expand All @@ -201,7 +201,7 @@ func (a *App) MergeLora(python string, useGpu bool, loraAlpha int, baseModel str
func (a *App) DepCheck(python string) error {
var err error
if python == "" {
python, err = GetPython()
python, err = GetPython(a)
}
if err != nil {
return err
Expand All @@ -217,7 +217,7 @@ 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()
python, err = GetPython(a)
if cnMirror && python == "py310/python.exe" {
torchWhlUrl = "https://mirrors.aliyun.com/pytorch-wheels/cu117/torch-1.13.1+cu117-cp310-cp310-win_amd64.whl"
}
Expand Down
15 changes: 5 additions & 10 deletions backend-golang/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,17 @@ func CopyEmbed(efs embed.FS) error {
return err
}

func GetPython() (string, error) {
func GetPython(a *App) (string, error) {
switch platform := runtime.GOOS; platform {
case "windows":
ex, err := os.Executable()
if err != nil {
return "", err
}
exDir := filepath.Dir(ex) + "/"
pyexe := exDir + "py310/python.exe"
_, err = os.Stat(pyexe)
pyexe := a.exDir + "py310/python.exe"
_, err := os.Stat(pyexe)
if err != nil {
_, err := os.Stat(exDir + "python-3.10.11-embed-amd64.zip")
_, err := os.Stat(a.exDir + "python-3.10.11-embed-amd64.zip")
if err != nil {
return "", errors.New("python zip not found")
} else {
err := Unzip(exDir+"python-3.10.11-embed-amd64.zip", exDir+"py310")
err := Unzip(a.exDir+"python-3.10.11-embed-amd64.zip", a.exDir+"py310")
if err != nil {
return "", errors.New("failed to unzip python")
} else {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module rwkv-runner

go 1.20
go 1.22

require (
github.com/cavaliergopher/grab/v3 v3.0.1
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aead.dev/minisign v0.2.0 h1:kAWrq/hBRu4AARY6AlciO83xhNnW9UaC8YipS2uhLPk=
aead.dev/minisign v0.2.0/go.mod h1:zdq6LdSd9TbuSxchxwhpA9zEb9YXcVGoE8JakuiGaIQ=
github.com/0xrawsec/golang-utils v1.3.2 h1:ww4jrtHRSnX9xrGzJYbalx5nXoZewy4zPxiY+ubJgtg=
github.com/0xrawsec/golang-utils v1.3.2/go.mod h1:m7AzHXgdSAkFCD9tWWsApxNVxMlyy7anpPVOyT/yM7E=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/cavaliergopher/grab/v3 v3.0.1 h1:4z7TkBfmPjmLAAmkkAZNX/6QJ1nNFdv3SdIHXju0Fr4=
Expand Down Expand Up @@ -64,6 +65,7 @@ github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/ubuntu/decorate v0.0.0-20230125165522-2d5b0a9bb117 h1:XQpsQG5lqRJlx4mUVHcJvyyc1rdTI9nHvwrdfcuy8aM=
Expand Down Expand Up @@ -122,3 +124,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit 97a3cd3

Please sign in to comment.