Compare commits
106 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88a5d11e15 | ||
|
|
1ecb0b444b | ||
|
|
72d601370d | ||
|
|
4814b88172 | ||
|
|
cfad67a922 | ||
|
|
c28f5604ab | ||
|
|
5853b8ca8d | ||
|
|
ebfc0ce672 | ||
|
|
e62fcd152a | ||
|
|
9bd9b9ecbd | ||
|
|
17faa9c5b8 | ||
|
|
4cd445bf77 | ||
|
|
4fb35845b0 | ||
|
|
f373f1caa8 | ||
|
|
4e75531651 | ||
|
|
539c538d65 | ||
|
|
d90186db33 | ||
|
|
a2d8729ae3 | ||
|
|
edc6ac7297 | ||
|
|
e89e23621c | ||
|
|
6b9ec4c6fa | ||
|
|
ced0966ffc | ||
|
|
966b912013 | ||
|
|
dc71054e61 | ||
|
|
408f3c1a4d | ||
|
|
38b775c937 | ||
|
|
f2ec1067bf | ||
|
|
b01584c49e | ||
|
|
01e56382a3 | ||
|
|
391c067250 | ||
|
|
5b98b5c0a7 | ||
|
|
5bde0abb8d | ||
|
|
1036852924 | ||
|
|
2b10ccd507 | ||
|
|
e1df1bfc3f | ||
|
|
b41a2e7039 | ||
|
|
b63370928d | ||
|
|
06a125b8d7 | ||
|
|
b03b00419b | ||
|
|
2f5a7d2d51 | ||
|
|
e318331909 | ||
|
|
796e5f22c0 | ||
|
|
b49968c145 | ||
|
|
cf16e54463 | ||
|
|
7bc8da2e29 | ||
|
|
26174d4c10 | ||
|
|
3c18ce34c7 | ||
|
|
c8b2bb53ef | ||
|
|
9f5d15a7d5 | ||
|
|
8291c50058 | ||
|
|
1f3f6cf9a8 | ||
|
|
83905c65c7 | ||
|
|
9af2b1d208 | ||
|
|
67c9381b82 | ||
|
|
4bdfa2d54c | ||
|
|
9945338458 | ||
|
|
d93157bde4 | ||
|
|
4db9b13803 | ||
|
|
69ab273706 | ||
|
|
d4ce828e99 | ||
|
|
8838b60e97 | ||
|
|
cbb249725d | ||
|
|
53b6a5ffe0 | ||
|
|
11b743aa53 | ||
|
|
a8c936a885 | ||
|
|
7fb27b927c | ||
|
|
50bee24e8c | ||
|
|
a196ce6da8 | ||
|
|
154827f367 | ||
|
|
deb9e030cb | ||
|
|
da033ab096 | ||
|
|
0fc429f5a3 | ||
|
|
142e30622e | ||
|
|
81d050d596 | ||
|
|
5e698a8312 | ||
|
|
55bb33bcbb | ||
|
|
b4efce15f4 | ||
|
|
3694ac5015 | ||
|
|
6fc5a335fb | ||
|
|
d66c30698c | ||
|
|
fecdf238c1 | ||
|
|
3e11128c9d | ||
|
|
822f2d729c | ||
|
|
a16c85b07d | ||
|
|
4e678eff6f | ||
|
|
94971bb666 | ||
|
|
b7fb8ed898 | ||
|
|
2ca8f5eba9 | ||
|
|
2431ff68e6 | ||
|
|
06e21badc0 | ||
|
|
52c3b7e9bf | ||
|
|
bd490b4fac | ||
|
|
48b09c4310 | ||
|
|
ffa90d89d1 | ||
|
|
e0781be9a9 | ||
|
|
33b21a0f5c | ||
|
|
bf5ac7efef | ||
|
|
06622b79aa | ||
|
|
537f11cbf1 | ||
|
|
c6500c6b3a | ||
|
|
6f629dbc55 | ||
|
|
5729d9fc62 | ||
|
|
bb8af451f6 | ||
|
|
ed330566e3 | ||
|
|
673ecb489e | ||
|
|
5192e31bac |
6
.gitattributes
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
backend-python/rwkv_pip/** linguist-vendored
|
||||
backend-python/wkv_cuda_utils/** linguist-vendored
|
||||
backend-python/get-pip.py linguist-vendored
|
||||
backend-python/convert_model.py linguist-vendored
|
||||
build/** linguist-vendored
|
||||
frontend/wailsjs/** linguist-generated
|
||||
4
.gitignore
vendored
@@ -10,10 +10,12 @@ __pycache__
|
||||
/cache.json
|
||||
/frontend/stats.html
|
||||
/frontend/package.json.md5
|
||||
/backend-python/get-pip.py
|
||||
/py310
|
||||
*.zip
|
||||
/cmd-helper.bat
|
||||
/backend-python/wkv_cuda
|
||||
*.exe
|
||||
*.old
|
||||
.DS_Store
|
||||
*.log.*
|
||||
*.log
|
||||
19
.vscode/launch.json
vendored
@@ -10,9 +10,24 @@
|
||||
"name": "Python",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "./backend-python/main.py",
|
||||
"program": "${workspaceFolder}/backend-python/main.py",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"justMyCode": false
|
||||
},
|
||||
{
|
||||
"name": "Golang",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "exec",
|
||||
"program": "${workspaceFolder}/build/bin/testwails.exe",
|
||||
"console": "integratedTerminal",
|
||||
"preLaunchTask": "build dev"
|
||||
},
|
||||
{
|
||||
"name": "Frontend",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "wails dev -browser"
|
||||
}
|
||||
]
|
||||
}
|
||||
40
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build dev",
|
||||
"type": "shell",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"CGO_ENABLED": "1"
|
||||
}
|
||||
},
|
||||
"osx": {
|
||||
"options": {
|
||||
"env": {
|
||||
"CGO_CFLAGS": "-mmacosx-version-min=10.13",
|
||||
"CGO_LDFLAGS": "-framework UniformTypeIdentifiers -mmacosx-version-min=10.13"
|
||||
}
|
||||
}
|
||||
},
|
||||
"windows": {
|
||||
"options": {
|
||||
"env": {
|
||||
"CGO_ENABLED": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"command": "go",
|
||||
"args": [
|
||||
"build",
|
||||
"-tags",
|
||||
"dev",
|
||||
"-gcflags",
|
||||
"all=-N -l",
|
||||
"-o",
|
||||
"build/bin/testwails.exe"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
11
Makefile
@@ -1,15 +1,22 @@
|
||||
ifeq ($(OS), Windows_NT)
|
||||
build: build-windows
|
||||
else
|
||||
else ifeq ($(shell uname -s), Darwin)
|
||||
build: build-macos
|
||||
else
|
||||
build: build-linux
|
||||
endif
|
||||
|
||||
build-windows:
|
||||
@echo ---- build for windows
|
||||
wails build -upx -ldflags "-s -w"
|
||||
wails build -upx -ldflags "-s -w" -platform windows/amd64
|
||||
|
||||
build-macos:
|
||||
@echo ---- build for macos
|
||||
wails build -ldflags "-s -w" -platform darwin/universal
|
||||
|
||||
build-linux:
|
||||
@echo ---- build for linux
|
||||
wails build -upx -ldflags "-s -w" -platform linux/amd64
|
||||
|
||||
dev:
|
||||
wails dev
|
||||
|
||||
27
README.md
@@ -15,7 +15,7 @@ compatible with the OpenAI API, which means that every ChatGPT client is an RWKV
|
||||
|
||||
English | [简体中文](README_ZH.md)
|
||||
|
||||
[Preview](#Preview) | [Download][download-url]
|
||||
[FAQs](https://github.com/josStorer/RWKV-Runner/wiki/FAQs) | [Preview](#Preview) | [Download][download-url]
|
||||
|
||||
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg
|
||||
|
||||
@@ -25,7 +25,7 @@ English | [简体中文](README_ZH.md)
|
||||
|
||||
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
|
||||
|
||||
[download-url]: https://github.com/josStorer/RWKV-Runner/releases/download/v1.0.2/RWKV-Runner_windows_x64.exe
|
||||
[download-url]: https://github.com/josStorer/RWKV-Runner/releases
|
||||
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,8 @@ English | [简体中文](README_ZH.md)
|
||||
- Fully compatible with the OpenAI API, making every ChatGPT client an RWKV client. After starting the model,
|
||||
open http://127.0.0.1:8000/docs to view more details.
|
||||
- Automatic dependency installation, requiring only a lightweight executable program
|
||||
- User-friendly chat interaction interface included
|
||||
- Configs with 2G to 32G VRAM are included, works well on almost all computers
|
||||
- User-friendly chat and completion interaction interface included
|
||||
- Easy-to-understand and operate parameter configuration
|
||||
- Built-in model conversion tool
|
||||
- Built-in download management and remote model inspection
|
||||
@@ -47,12 +48,32 @@ English | [简体中文](README_ZH.md)
|
||||
- Theme switching
|
||||
- Automatic updates
|
||||
|
||||
## API Concurrency Stress Testing
|
||||
|
||||
```bash
|
||||
ab -p body.json -T application/json -c 20 -n 100 -l http://127.0.0.1:8000/chat/completions
|
||||
```
|
||||
|
||||
body.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
- [ ] Model training functionality
|
||||
- [x] CUDA operator int8 acceleration
|
||||
- [ ] macOS support
|
||||
- [ ] Linux support
|
||||
- [ ] Local State Cache DB
|
||||
|
||||
## Related Repositories:
|
||||
|
||||
|
||||
27
README_ZH.md
@@ -14,7 +14,7 @@ API兼容的接口,这意味着一切ChatGPT客户端都是RWKV客户端。
|
||||
|
||||
[English](README.md) | 简体中文
|
||||
|
||||
[视频演示](https://www.bilibili.com/video/BV1hM4y1v76R) | [预览](#Preview) | [下载][download-url]
|
||||
[视频演示](https://www.bilibili.com/video/BV1hM4y1v76R) | [疑难解答](https://www.bilibili.com/read/cv23921171) | [预览](#Preview) | [下载][download-url] | [懒人包](https://pan.baidu.com/s/1wchIUHgne3gncIiLIeKBEQ?pwd=1111)
|
||||
|
||||
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg
|
||||
|
||||
@@ -24,7 +24,7 @@ API兼容的接口,这意味着一切ChatGPT客户端都是RWKV客户端。
|
||||
|
||||
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
|
||||
|
||||
[download-url]: https://github.com/josStorer/RWKV-Runner/releases/download/v1.0.2/RWKV-Runner_windows_x64.exe
|
||||
[download-url]: https://github.com/josStorer/RWKV-Runner/releases
|
||||
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,8 @@ API兼容的接口,这意味着一切ChatGPT客户端都是RWKV客户端。
|
||||
- RWKV模型管理,一键启动
|
||||
- 与OpenAI API完全兼容,一切ChatGPT客户端,都是RWKV客户端。启动模型后,打开 http://127.0.0.1:8000/docs 查看详细内容
|
||||
- 全自动依赖安装,你只需要一个轻巧的可执行程序
|
||||
- 自带用户友好的聊天交互页面
|
||||
- 预设了2G至32G显存的配置,几乎在各种电脑上工作良好
|
||||
- 自带用户友好的聊天和补全交互页面
|
||||
- 易于理解和操作的参数配置
|
||||
- 内置模型转换工具
|
||||
- 内置下载管理和远程模型检视
|
||||
@@ -47,12 +48,32 @@ API兼容的接口,这意味着一切ChatGPT客户端都是RWKV客户端。
|
||||
- 主题切换
|
||||
- 自动更新
|
||||
|
||||
## API并发压力测试
|
||||
|
||||
```bash
|
||||
ab -p body.json -T application/json -c 20 -n 100 -l http://127.0.0.1:8000/chat/completions
|
||||
```
|
||||
|
||||
body.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
- [ ] 模型训练功能
|
||||
- [x] CUDA算子int8提速
|
||||
- [ ] macOS支持
|
||||
- [ ] linux支持
|
||||
- [ ] 本地状态缓存数据库
|
||||
|
||||
## 相关仓库:
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/minio/selfupdate"
|
||||
@@ -13,7 +14,9 @@ import (
|
||||
|
||||
// App struct
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
ctx context.Context
|
||||
exDir string
|
||||
cmdPrefix string
|
||||
}
|
||||
|
||||
// NewApp creates a new App application struct
|
||||
@@ -25,6 +28,14 @@ func NewApp() *App {
|
||||
// so we can call the runtime methods
|
||||
func (a *App) OnStartup(ctx context.Context) {
|
||||
a.ctx = ctx
|
||||
a.exDir = ""
|
||||
a.cmdPrefix = ""
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
ex, _ := os.Executable()
|
||||
a.exDir = filepath.Dir(ex) + "/../../../"
|
||||
a.cmdPrefix = "cd " + a.exDir + " && "
|
||||
}
|
||||
|
||||
a.downloadLoop()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package backend_golang
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@@ -9,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func (a *App) DownloadFile(path string, url string) error {
|
||||
_, err := grab.Get(path, url)
|
||||
_, err := grab.Get(a.exDir+path, url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -18,6 +19,7 @@ func (a *App) DownloadFile(path string, url string) error {
|
||||
|
||||
type DownloadStatus struct {
|
||||
resp *grab.Response
|
||||
cancel context.CancelFunc
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Url string `json:"url"`
|
||||
@@ -29,7 +31,7 @@ type DownloadStatus struct {
|
||||
Done bool `json:"done"`
|
||||
}
|
||||
|
||||
var downloadList []DownloadStatus
|
||||
var downloadList []*DownloadStatus
|
||||
|
||||
func existsInDownloadList(url string) bool {
|
||||
for _, ds := range downloadList {
|
||||
@@ -41,49 +43,58 @@ func existsInDownloadList(url string) bool {
|
||||
}
|
||||
|
||||
func (a *App) PauseDownload(url string) {
|
||||
for i, ds := range downloadList {
|
||||
for _, ds := range downloadList {
|
||||
if ds.Url == url {
|
||||
if ds.resp != nil {
|
||||
ds.resp.Cancel()
|
||||
}
|
||||
|
||||
downloadList[i] = DownloadStatus{
|
||||
resp: ds.resp,
|
||||
Name: ds.Name,
|
||||
Path: ds.Path,
|
||||
Url: ds.Url,
|
||||
Downloading: false,
|
||||
if ds.cancel != nil {
|
||||
ds.cancel()
|
||||
}
|
||||
ds.resp = nil
|
||||
ds.Downloading = false
|
||||
ds.Speed = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) ContinueDownload(url string) {
|
||||
for i, ds := range downloadList {
|
||||
for _, ds := range downloadList {
|
||||
if ds.Url == url {
|
||||
client := grab.NewClient()
|
||||
req, _ := grab.NewRequest(ds.Path, ds.Url)
|
||||
resp := client.Do(req)
|
||||
if !ds.Downloading && ds.resp == nil && !ds.Done {
|
||||
ds.Downloading = true
|
||||
|
||||
downloadList[i] = DownloadStatus{
|
||||
resp: resp,
|
||||
Name: ds.Name,
|
||||
Path: ds.Path,
|
||||
Url: ds.Url,
|
||||
Downloading: true,
|
||||
req, err := grab.NewRequest(ds.Path, ds.Url)
|
||||
if err != nil {
|
||||
ds.Downloading = false
|
||||
break
|
||||
}
|
||||
// if PauseDownload() is called before the request finished, ds.Downloading will be false
|
||||
// if the user keeps clicking pause and resume, it may result in multiple requests being successfully downloaded at the same time
|
||||
// so we have to create a context and cancel it when PauseDownload() is called
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ds.cancel = cancel
|
||||
req = req.WithContext(ctx)
|
||||
resp := grab.DefaultClient.Do(req)
|
||||
|
||||
if resp != nil && resp.HTTPResponse != nil &&
|
||||
resp.HTTPResponse.StatusCode >= 200 && resp.HTTPResponse.StatusCode < 300 {
|
||||
ds.resp = resp
|
||||
} else {
|
||||
ds.Downloading = false
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) AddToDownloadList(path string, url string) {
|
||||
if !existsInDownloadList(url) {
|
||||
downloadList = append(downloadList, DownloadStatus{
|
||||
downloadList = append(downloadList, &DownloadStatus{
|
||||
resp: nil,
|
||||
Name: filepath.Base(path),
|
||||
Path: path,
|
||||
Path: a.exDir + path,
|
||||
Url: url,
|
||||
Downloading: true,
|
||||
Downloading: false,
|
||||
})
|
||||
a.ContinueDownload(url)
|
||||
} else {
|
||||
@@ -96,32 +107,17 @@ func (a *App) downloadLoop() {
|
||||
go func() {
|
||||
for {
|
||||
<-ticker.C
|
||||
for i, ds := range downloadList {
|
||||
transferred := int64(0)
|
||||
size := int64(0)
|
||||
speed := float64(0)
|
||||
progress := float64(0)
|
||||
downloading := ds.Downloading
|
||||
done := false
|
||||
for _, ds := range downloadList {
|
||||
if ds.resp != nil {
|
||||
transferred = ds.resp.BytesComplete()
|
||||
size = ds.resp.Size()
|
||||
speed = ds.resp.BytesPerSecond()
|
||||
progress = 100 * ds.resp.Progress()
|
||||
downloading = !ds.resp.IsComplete()
|
||||
done = ds.resp.Progress() == 1
|
||||
}
|
||||
downloadList[i] = DownloadStatus{
|
||||
resp: ds.resp,
|
||||
Name: ds.Name,
|
||||
Path: ds.Path,
|
||||
Url: ds.Url,
|
||||
Transferred: transferred,
|
||||
Size: size,
|
||||
Speed: speed,
|
||||
Progress: progress,
|
||||
Downloading: downloading,
|
||||
Done: done,
|
||||
ds.Transferred = ds.resp.BytesComplete()
|
||||
ds.Size = ds.resp.Size()
|
||||
ds.Speed = ds.resp.BytesPerSecond()
|
||||
ds.Progress = 100 * ds.resp.Progress()
|
||||
ds.Downloading = !ds.resp.IsComplete()
|
||||
ds.Done = ds.resp.Progress() == 1
|
||||
if !ds.Downloading {
|
||||
ds.resp = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
runtime.EventsEmit(a.ctx, "downloadList", downloadList)
|
||||
|
||||
@@ -2,12 +2,13 @@ package backend_golang
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -17,14 +18,14 @@ func (a *App) SaveJson(fileName string, jsonData any) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(fileName, text, 0644); err != nil {
|
||||
if err := os.WriteFile(a.exDir+fileName, text, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) ReadJson(fileName string) (any, error) {
|
||||
file, err := os.ReadFile(fileName)
|
||||
file, err := os.ReadFile(a.exDir + fileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -39,7 +40,7 @@ func (a *App) ReadJson(fileName string) (any, error) {
|
||||
}
|
||||
|
||||
func (a *App) FileExists(fileName string) bool {
|
||||
_, err := os.Stat(fileName)
|
||||
_, err := os.Stat(a.exDir + fileName)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ type FileInfo struct {
|
||||
}
|
||||
|
||||
func (a *App) ReadFileInfo(fileName string) (FileInfo, error) {
|
||||
info, err := os.Stat(fileName)
|
||||
info, err := os.Stat(a.exDir + fileName)
|
||||
if err != nil {
|
||||
return FileInfo{}, err
|
||||
}
|
||||
@@ -64,7 +65,7 @@ func (a *App) ReadFileInfo(fileName string) (FileInfo, error) {
|
||||
}
|
||||
|
||||
func (a *App) ListDirFiles(dirPath string) ([]FileInfo, error) {
|
||||
files, err := os.ReadDir(dirPath)
|
||||
files, err := os.ReadDir(a.exDir + dirPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -86,7 +87,7 @@ func (a *App) ListDirFiles(dirPath string) ([]FileInfo, error) {
|
||||
}
|
||||
|
||||
func (a *App) DeleteFile(path string) error {
|
||||
err := os.Remove(path)
|
||||
err := os.Remove(a.exDir + path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -94,13 +95,18 @@ func (a *App) DeleteFile(path string) error {
|
||||
}
|
||||
|
||||
func (a *App) CopyFile(src string, dst string) error {
|
||||
sourceFile, err := os.Open(src)
|
||||
sourceFile, err := os.Open(a.exDir + src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer sourceFile.Close()
|
||||
|
||||
destFile, err := os.Create(dst)
|
||||
err = os.MkdirAll(a.exDir+dst[:strings.LastIndex(dst, "/")], 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
destFile, err := os.Create(a.exDir + dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -114,7 +120,7 @@ func (a *App) CopyFile(src string, dst string) error {
|
||||
}
|
||||
|
||||
func (a *App) OpenFileFolder(path string) error {
|
||||
absPath, err := filepath.Abs(path)
|
||||
absPath, err := filepath.Abs(a.exDir + path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -125,10 +131,21 @@ func (a *App) OpenFileFolder(path string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case "darwin":
|
||||
fmt.Println("Running on macOS")
|
||||
cmd := exec.Command("open", "-R", absPath)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case "linux":
|
||||
fmt.Println("Running on Linux")
|
||||
cmd := exec.Command("xdg-open", absPath)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return errors.New("unsupported OS")
|
||||
}
|
||||
|
||||
@@ -3,42 +3,58 @@ package backend_golang
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (a *App) StartServer(port int, host string) (string, error) {
|
||||
python, err := GetPython()
|
||||
func (a *App) StartServer(python string, port int, host string) (string, error) {
|
||||
var err error
|
||||
if python == "" {
|
||||
python, err = GetPython()
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return Cmd(python, "./backend-python/main.py", strconv.Itoa(port), host)
|
||||
}
|
||||
|
||||
func (a *App) ConvertModel(modelPath string, strategy string, outPath string) (string, error) {
|
||||
python, err := GetPython()
|
||||
func (a *App) ConvertModel(python string, modelPath string, strategy string, outPath string) (string, error) {
|
||||
var err error
|
||||
if python == "" {
|
||||
python, err = GetPython()
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return Cmd(python, "./backend-python/convert_model.py", "--in", modelPath, "--out", outPath, "--strategy", strategy)
|
||||
}
|
||||
|
||||
func (a *App) DepCheck() error {
|
||||
python, err := GetPython()
|
||||
func (a *App) DepCheck(python string) error {
|
||||
var err error
|
||||
if python == "" {
|
||||
python, err = GetPython()
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out, err := exec.Command(python, "./backend-python/dep_check.py").CombinedOutput()
|
||||
out, err := exec.Command(python, a.exDir+"./backend-python/dep_check.py").CombinedOutput()
|
||||
if err != nil {
|
||||
return errors.New("DepCheck Error: " + string(out))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) InstallPyDep(cnMirror bool) (string, error) {
|
||||
python, err := GetPython()
|
||||
func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
|
||||
var err error
|
||||
if python == "" {
|
||||
python, err = GetPython()
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages")
|
||||
}
|
||||
if cnMirror {
|
||||
_, err = Cmd(python, "./backend-python/get-pip.py", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple")
|
||||
} else {
|
||||
@@ -47,8 +63,11 @@ func (a *App) InstallPyDep(cnMirror bool) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages")
|
||||
_, err = Cmd(python, "-m", "pip", "install", "torch==1.13.1", "torchvision==0.14.1", "torchaudio==0.13.1", "--index-url", "https://download.pytorch.org/whl/cu117")
|
||||
if runtime.GOOS == "windows" {
|
||||
_, err = Cmd(python, "-m", "pip", "install", "torch==1.13.1", "torchvision==0.14.1", "torchaudio==0.13.1", "--index-url", "https://download.pytorch.org/whl/cu117")
|
||||
} else {
|
||||
_, err = Cmd(python, "-m", "pip", "install", "torch", "torchvision", "torchaudio")
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package backend_golang
|
||||
import (
|
||||
"archive/zip"
|
||||
"bufio"
|
||||
"embed"
|
||||
"errors"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -13,22 +15,89 @@ import (
|
||||
)
|
||||
|
||||
func Cmd(args ...string) (string, error) {
|
||||
_, err := os.Stat("cmd-helper.bat")
|
||||
if err != nil {
|
||||
if err := os.WriteFile("./cmd-helper.bat", []byte("start %*"), 0644); err != nil {
|
||||
switch platform := runtime.GOOS; platform {
|
||||
case "windows":
|
||||
if err := os.WriteFile("./cmd-helper.bat", []byte("start /wait %*"), 0644); err != nil {
|
||||
return "", err
|
||||
}
|
||||
cmdHelper, err := filepath.Abs("./cmd-helper")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, arg := range args {
|
||||
if strings.Contains(arg, " ") && strings.Contains(cmdHelper, " ") {
|
||||
return "", errors.New("path contains space") // golang bug https://github.com/golang/go/issues/17149#issuecomment-473976818
|
||||
}
|
||||
}
|
||||
|
||||
cmd := exec.Command(cmdHelper, args...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(out), nil
|
||||
case "darwin":
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
exDir := filepath.Dir(ex) + "/../../../"
|
||||
cmd := exec.Command("osascript", "-e", `tell application "Terminal" to do script "`+"cd "+exDir+" && "+strings.Join(args, " ")+`"`)
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
cmd.Wait()
|
||||
return "", nil
|
||||
case "linux":
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
cmd.Wait()
|
||||
return "", nil
|
||||
}
|
||||
cmdHelper, err := filepath.Abs("./cmd-helper")
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", errors.New("unsupported OS")
|
||||
}
|
||||
|
||||
func CopyEmbed(efs embed.FS) error {
|
||||
prefix := ""
|
||||
if runtime.GOOS == "darwin" {
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
prefix = filepath.Dir(ex) + "/../../../"
|
||||
}
|
||||
cmd := exec.Command(cmdHelper, args...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(out), nil
|
||||
|
||||
err := fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
|
||||
if d.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
content, err := efs.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
path = prefix + path
|
||||
err = os.MkdirAll(path[:strings.LastIndex(path, "/")], 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = os.WriteFile(path, content, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func GetPython() (string, error) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import GPUtil
|
||||
import torch
|
||||
import rwkv
|
||||
import langchain
|
||||
import fastapi
|
||||
import uvicorn
|
||||
import sse_starlette
|
||||
|
||||
32321
backend-python/get-pip.py
vendored
Normal file
@@ -4,18 +4,18 @@ import sys
|
||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
import psutil
|
||||
from fastapi import FastAPI
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import uvicorn
|
||||
|
||||
from utils.rwkv import *
|
||||
from utils.torch import *
|
||||
from utils.ngrok import *
|
||||
from routes import completion, config
|
||||
from utils.log import log_middleware
|
||||
from routes import completion, config, state_cache
|
||||
import global_var
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
app = FastAPI(dependencies=[Depends(log_middleware)])
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
@@ -27,11 +27,13 @@ app.add_middleware(
|
||||
|
||||
app.include_router(completion.router)
|
||||
app.include_router(config.router)
|
||||
app.include_router(state_cache.router)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
def init():
|
||||
global_var.init()
|
||||
state_cache.init()
|
||||
|
||||
set_torch()
|
||||
|
||||
@@ -41,7 +43,7 @@ def init():
|
||||
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {"Hello": "World!", "pid": os.getpid()}
|
||||
return {"Hello": "World!"}
|
||||
|
||||
|
||||
@app.post("/exit")
|
||||
@@ -59,7 +61,7 @@ def debug():
|
||||
strategy="cuda fp16",
|
||||
tokens_path="20B_tokenizer.json",
|
||||
)
|
||||
d = model.tokenizer.decode([])
|
||||
d = model.pipeline.decode([])
|
||||
print(d)
|
||||
|
||||
|
||||
|
||||
BIN
backend-python/requirements_without_cyac.txt
Normal file
@@ -7,14 +7,11 @@ from fastapi import APIRouter, Request, status, HTTPException
|
||||
from sse_starlette.sse import EventSourceResponse
|
||||
from pydantic import BaseModel
|
||||
from utils.rwkv import *
|
||||
from utils.log import quick_log
|
||||
import global_var
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
interface = ":"
|
||||
user = "Bob"
|
||||
bot = "Alice"
|
||||
|
||||
|
||||
class Message(BaseModel):
|
||||
role: str
|
||||
@@ -30,6 +27,8 @@ class ChatCompletionBody(ModelConfigBody):
|
||||
|
||||
completion_lock = Lock()
|
||||
|
||||
requests_num = 0
|
||||
|
||||
|
||||
@router.post("/v1/chat/completions")
|
||||
@router.post("/chat/completions")
|
||||
@@ -41,37 +40,55 @@ async def chat_completions(body: ChatCompletionBody, request: Request):
|
||||
question = body.messages[-1]
|
||||
if question.role == "user":
|
||||
question = question.content
|
||||
elif question.role == "system":
|
||||
question = body.messages[-2]
|
||||
if question.role == "user":
|
||||
question = question.content
|
||||
else:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "no question found")
|
||||
else:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "no question found")
|
||||
|
||||
completion_text = f"""
|
||||
interface = model.interface
|
||||
user = model.user
|
||||
bot = model.bot
|
||||
|
||||
completion_text = (
|
||||
f"""
|
||||
The following is a coherent verbose detailed conversation between a girl named {bot} and her friend {user}. \
|
||||
{bot} is very intelligent, creative and friendly. \
|
||||
{bot} is unlikely to disagree with {user}, and {bot} doesn't like to ask {user} questions. \
|
||||
{bot} likes to tell {user} a lot about herself and her opinions. \
|
||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||
"""
|
||||
if user == "Bob"
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.\n\n"
|
||||
)
|
||||
for message in body.messages:
|
||||
if message.role == "system":
|
||||
completion_text = (
|
||||
f"The following is a coherent verbose detailed conversation between a girl named {bot} and her friend {user}. "
|
||||
if user == "Bob"
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. "
|
||||
+ message.content.replace("\\n", "\n")
|
||||
.replace("\r\n", "\n")
|
||||
.replace("\n\n", "\n")
|
||||
.replace("\n", " ")
|
||||
.strip()
|
||||
.replace("You are", f"{bot} is")
|
||||
.replace("you are", f"{bot} is")
|
||||
.replace("You're", f"{bot} is")
|
||||
.replace("you're", f"{bot} is")
|
||||
.replace("You", f"{bot}")
|
||||
.replace("you", f"{bot}")
|
||||
.replace("Your", f"{bot}'s")
|
||||
.replace("your", f"{bot}'s")
|
||||
.replace("你", f"{bot}")
|
||||
.replace("You are", f"{bot} is" if user == "Bob" else "I am")
|
||||
.replace("you are", f"{bot} is" if user == "Bob" else "I am")
|
||||
.replace("You're", f"{bot} is" if user == "Bob" else "I'm")
|
||||
.replace("you're", f"{bot} is" if user == "Bob" else "I'm")
|
||||
.replace("You", f"{bot}" if user == "Bob" else "I")
|
||||
.replace("you", f"{bot}" if user == "Bob" else "I")
|
||||
.replace("Your", f"{bot}'s" if user == "Bob" else "My")
|
||||
.replace("your", f"{bot}'s" if user == "Bob" else "my")
|
||||
.replace("你", f"{bot}" if user == "Bob" else "我")
|
||||
+ "\n\n"
|
||||
)
|
||||
elif message.role == "user":
|
||||
break
|
||||
for message in body.messages:
|
||||
if message.role == "user":
|
||||
completion_text += (
|
||||
f"{user}{interface} "
|
||||
+ message.content.replace("\\n", "\n")
|
||||
@@ -92,15 +109,36 @@ The following is a coherent verbose detailed conversation between a girl named {
|
||||
completion_text += f"{bot}{interface}"
|
||||
|
||||
async def eval_rwkv():
|
||||
global requests_num
|
||||
requests_num = requests_num + 1
|
||||
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
||||
while completion_lock.locked():
|
||||
if await request.is_disconnected():
|
||||
requests_num = requests_num - 1
|
||||
print(f"{request.client} Stop Waiting (Lock)")
|
||||
quick_log(
|
||||
request,
|
||||
None,
|
||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
await asyncio.sleep(0.1)
|
||||
else:
|
||||
completion_lock.acquire()
|
||||
if await request.is_disconnected():
|
||||
completion_lock.release()
|
||||
requests_num = requests_num - 1
|
||||
print(f"{request.client} Stop Waiting (Lock)")
|
||||
quick_log(
|
||||
request,
|
||||
None,
|
||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
set_rwkv_config(model, global_var.get(global_var.Model_Config))
|
||||
set_rwkv_config(model, body)
|
||||
if body.stream:
|
||||
for response, delta in rwkv_generate(
|
||||
model,
|
||||
for response, delta in model.generate(
|
||||
completion_text,
|
||||
stop=f"\n\n{user}" if body.stop is None else body.stop,
|
||||
):
|
||||
@@ -120,9 +158,21 @@ The following is a coherent verbose detailed conversation between a girl named {
|
||||
}
|
||||
)
|
||||
# torch_gc()
|
||||
requests_num = requests_num - 1
|
||||
completion_lock.release()
|
||||
if await request.is_disconnected():
|
||||
print(f"{request.client} Stop Waiting")
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
yield json.dumps(
|
||||
{
|
||||
"response": response,
|
||||
@@ -139,17 +189,28 @@ The following is a coherent verbose detailed conversation between a girl named {
|
||||
yield "[DONE]"
|
||||
else:
|
||||
response = None
|
||||
for response, delta in rwkv_generate(
|
||||
model,
|
||||
for response, delta in model.generate(
|
||||
completion_text,
|
||||
stop=f"\n\n{user}" if body.stop is None else body.stop,
|
||||
):
|
||||
if await request.is_disconnected():
|
||||
break
|
||||
# torch_gc()
|
||||
requests_num = requests_num - 1
|
||||
completion_lock.release()
|
||||
if await request.is_disconnected():
|
||||
print(f"{request.client} Stop Waiting")
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
yield {
|
||||
"response": response,
|
||||
"model": "rwkv",
|
||||
@@ -168,7 +229,10 @@ The following is a coherent verbose detailed conversation between a girl named {
|
||||
if body.stream:
|
||||
return EventSourceResponse(eval_rwkv())
|
||||
else:
|
||||
return await eval_rwkv().__anext__()
|
||||
try:
|
||||
return await eval_rwkv().__anext__()
|
||||
except StopAsyncIteration:
|
||||
return None
|
||||
|
||||
|
||||
class CompletionBody(ModelConfigBody):
|
||||
@@ -185,17 +249,40 @@ async def completions(body: CompletionBody, request: Request):
|
||||
if model is None:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "model not loaded")
|
||||
|
||||
if body.prompt is None or body.prompt == "":
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "prompt not found")
|
||||
|
||||
async def eval_rwkv():
|
||||
global requests_num
|
||||
requests_num = requests_num + 1
|
||||
quick_log(request, None, "Start Waiting. RequestsNum: " + str(requests_num))
|
||||
while completion_lock.locked():
|
||||
if await request.is_disconnected():
|
||||
requests_num = requests_num - 1
|
||||
print(f"{request.client} Stop Waiting (Lock)")
|
||||
quick_log(
|
||||
request,
|
||||
None,
|
||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
await asyncio.sleep(0.1)
|
||||
else:
|
||||
completion_lock.acquire()
|
||||
if await request.is_disconnected():
|
||||
completion_lock.release()
|
||||
requests_num = requests_num - 1
|
||||
print(f"{request.client} Stop Waiting (Lock)")
|
||||
quick_log(
|
||||
request,
|
||||
None,
|
||||
"Stop Waiting (Lock). RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
set_rwkv_config(model, global_var.get(global_var.Model_Config))
|
||||
set_rwkv_config(model, body)
|
||||
if body.stream:
|
||||
for response, delta in rwkv_generate(
|
||||
model, body.prompt, stop=body.stop
|
||||
):
|
||||
for response, delta in model.generate(body.prompt, stop=body.stop):
|
||||
if await request.is_disconnected():
|
||||
break
|
||||
yield json.dumps(
|
||||
@@ -212,9 +299,21 @@ async def completions(body: CompletionBody, request: Request):
|
||||
}
|
||||
)
|
||||
# torch_gc()
|
||||
requests_num = requests_num - 1
|
||||
completion_lock.release()
|
||||
if await request.is_disconnected():
|
||||
print(f"{request.client} Stop Waiting")
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
yield json.dumps(
|
||||
{
|
||||
"response": response,
|
||||
@@ -231,15 +330,25 @@ async def completions(body: CompletionBody, request: Request):
|
||||
yield "[DONE]"
|
||||
else:
|
||||
response = None
|
||||
for response, delta in rwkv_generate(
|
||||
model, body.prompt, stop=body.stop
|
||||
):
|
||||
for response, delta in model.generate(body.prompt, stop=body.stop):
|
||||
if await request.is_disconnected():
|
||||
break
|
||||
# torch_gc()
|
||||
requests_num = requests_num - 1
|
||||
completion_lock.release()
|
||||
if await request.is_disconnected():
|
||||
print(f"{request.client} Stop Waiting")
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nStop Waiting. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
return
|
||||
quick_log(
|
||||
request,
|
||||
body,
|
||||
response + "\nFinished. RequestsNum: " + str(requests_num),
|
||||
)
|
||||
yield {
|
||||
"response": response,
|
||||
"model": "rwkv",
|
||||
@@ -255,4 +364,7 @@ async def completions(body: CompletionBody, request: Request):
|
||||
if body.stream:
|
||||
return EventSourceResponse(eval_rwkv())
|
||||
else:
|
||||
return await eval_rwkv().__anext__()
|
||||
try:
|
||||
return await eval_rwkv().__anext__()
|
||||
except StopAsyncIteration:
|
||||
return None
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import pathlib
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Response, status
|
||||
from fastapi import APIRouter, HTTPException, Response, status as Status
|
||||
from pydantic import BaseModel
|
||||
from langchain.llms import RWKV
|
||||
from utils.rwkv import *
|
||||
from utils.torch import *
|
||||
import global_var
|
||||
@@ -11,6 +10,19 @@ import GPUtil
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
def get_tokens_path(model_path: str):
|
||||
model_path = model_path.lower()
|
||||
default_tokens_path = (
|
||||
f"{pathlib.Path(__file__).parent.parent.resolve()}/rwkv_pip/20B_tokenizer.json"
|
||||
)
|
||||
if "raven" in model_path:
|
||||
return default_tokens_path
|
||||
elif "world" in model_path:
|
||||
return "rwkv_vocab_v20230424"
|
||||
else:
|
||||
return default_tokens_path
|
||||
|
||||
|
||||
class SwitchModelBody(BaseModel):
|
||||
model: str
|
||||
strategy: str
|
||||
@@ -20,7 +32,7 @@ class SwitchModelBody(BaseModel):
|
||||
@router.post("/switch-model")
|
||||
def switch_model(body: SwitchModelBody, response: Response):
|
||||
if global_var.get(global_var.Model_Status) is global_var.ModelStatus.Loading:
|
||||
response.status_code = status.HTTP_304_NOT_MODIFIED
|
||||
response.status_code = Status.HTTP_304_NOT_MODIFIED
|
||||
return
|
||||
|
||||
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
||||
@@ -36,13 +48,13 @@ def switch_model(body: SwitchModelBody, response: Response):
|
||||
RWKV(
|
||||
model=body.model,
|
||||
strategy=body.strategy,
|
||||
tokens_path=f"{pathlib.Path(__file__).parent.parent.resolve()}/20B_tokenizer.json",
|
||||
tokens_path=get_tokens_path(body.model),
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, "failed to load")
|
||||
raise HTTPException(Status.HTTP_500_INTERNAL_SERVER_ERROR, "failed to load")
|
||||
|
||||
if global_var.get(global_var.Model_Config) is None:
|
||||
global_var.set(
|
||||
|
||||
107
backend-python/routes/state_cache.py
Normal file
@@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict
|
||||
from fastapi import APIRouter, HTTPException, Response, status
|
||||
from pydantic import BaseModel
|
||||
import gc
|
||||
import copy
|
||||
import torch
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
trie = None
|
||||
dtrie: Dict = {}
|
||||
|
||||
|
||||
def init():
|
||||
global trie
|
||||
try:
|
||||
import cyac
|
||||
import mmap
|
||||
import os
|
||||
|
||||
if os.path.exists("state_cache.trie"):
|
||||
with open("state_cache.trie", "r") as bf:
|
||||
buff_object = mmap.mmap(bf.fileno(), 0, access=mmap.ACCESS_READ)
|
||||
trie = cyac.Trie.from_buff(buff_object, copy=False)
|
||||
else:
|
||||
trie = cyac.Trie()
|
||||
except ModuleNotFoundError:
|
||||
print("cyac not found")
|
||||
|
||||
|
||||
class AddStateBody(BaseModel):
|
||||
prompt: str
|
||||
tokens: list[str]
|
||||
state: Any
|
||||
logits: Any
|
||||
|
||||
|
||||
@router.post("/add-state")
|
||||
def add_state(body: AddStateBody):
|
||||
global trie, dtrie
|
||||
if trie is None:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
||||
|
||||
id = trie.insert(body.prompt)
|
||||
device = body.state[0].device
|
||||
dtrie[id] = {
|
||||
"tokens": copy.deepcopy(body.tokens),
|
||||
"state": [tensor.cpu() for tensor in body.state]
|
||||
if device != torch.device("cpu")
|
||||
else copy.deepcopy(body.state),
|
||||
"logits": copy.deepcopy(body.logits),
|
||||
"device": device,
|
||||
}
|
||||
|
||||
return "success"
|
||||
|
||||
|
||||
@router.post("/reset-state")
|
||||
def reset_state():
|
||||
global trie
|
||||
if trie is None:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
||||
|
||||
trie = cyac.Trie()
|
||||
gc.collect()
|
||||
|
||||
return "success"
|
||||
|
||||
|
||||
class LongestPrefixStateBody(BaseModel):
|
||||
prompt: str
|
||||
|
||||
|
||||
@router.post("/longest-prefix-state")
|
||||
def longest_prefix_state(body: LongestPrefixStateBody):
|
||||
global trie
|
||||
if trie is None:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
||||
|
||||
id = -1
|
||||
for id, len in trie.prefix(body.prompt):
|
||||
pass
|
||||
if id != -1:
|
||||
v = dtrie[id]
|
||||
device = v["device"]
|
||||
return {
|
||||
"prompt": trie[id],
|
||||
"tokens": v["tokens"],
|
||||
"state": [tensor.to(device) for tensor in v["state"]]
|
||||
if device != torch.device("cpu")
|
||||
else v["state"],
|
||||
"logits": v["logits"],
|
||||
"device": device,
|
||||
}
|
||||
else:
|
||||
return {"prompt": "", "tokens": [], "state": None, "logits": None}
|
||||
|
||||
|
||||
@router.post("/save-state")
|
||||
def save_state():
|
||||
global trie
|
||||
if trie is None:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, "trie not loaded")
|
||||
|
||||
trie.save("state_cache.trie")
|
||||
|
||||
return "success"
|
||||
106
backend-python/rwkv_pip/rwkv_tokenizer.py
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
########################################################################################################
|
||||
# The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM
|
||||
########################################################################################################
|
||||
|
||||
|
||||
class TRIE:
|
||||
__slots__ = tuple("ch,to,values,front".split(","))
|
||||
to: list
|
||||
values: set
|
||||
|
||||
def __init__(self, front=None, ch=None):
|
||||
self.ch = ch
|
||||
self.to = [None for ch in range(256)]
|
||||
self.values = set()
|
||||
self.front = front
|
||||
|
||||
def __repr__(self):
|
||||
fr = self
|
||||
ret = []
|
||||
while fr != None:
|
||||
if fr.ch != None:
|
||||
ret.append(fr.ch)
|
||||
fr = fr.front
|
||||
return "<TRIE %s %s>" % (ret[::-1], self.values)
|
||||
|
||||
def add(self, key: bytes, idx: int = 0, val=None):
|
||||
if idx == len(key):
|
||||
if val is None:
|
||||
val = key
|
||||
self.values.add(val)
|
||||
return self
|
||||
ch = key[idx]
|
||||
if self.to[ch] is None:
|
||||
self.to[ch] = TRIE(front=self, ch=ch)
|
||||
return self.to[ch].add(key, idx=idx + 1, val=val)
|
||||
|
||||
def find_longest(self, key: bytes, idx: int = 0):
|
||||
u: TRIE = self
|
||||
ch: int = key[idx]
|
||||
|
||||
while u.to[ch] is not None:
|
||||
u = u.to[ch]
|
||||
idx += 1
|
||||
if u.values:
|
||||
ret = idx, u, u.values
|
||||
if idx == len(key):
|
||||
break
|
||||
ch = key[idx]
|
||||
return ret
|
||||
|
||||
|
||||
class TRIE_TOKENIZER:
|
||||
def __init__(self, file_name):
|
||||
self.idx2token = {}
|
||||
sorted = [] # must be already sorted
|
||||
with open(file_name, "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
for l in lines:
|
||||
idx = int(l[: l.index(" ")])
|
||||
x = eval(l[l.index(" ") : l.rindex(" ")])
|
||||
x = x.encode("utf-8") if isinstance(x, str) else x
|
||||
assert isinstance(x, bytes)
|
||||
assert len(x) == int(l[l.rindex(" ") :])
|
||||
sorted += [x]
|
||||
self.idx2token[idx] = x
|
||||
|
||||
self.token2idx = {}
|
||||
for k, v in self.idx2token.items():
|
||||
self.token2idx[v] = int(k)
|
||||
|
||||
self.root = TRIE()
|
||||
for t, i in self.token2idx.items():
|
||||
_ = self.root.add(t, val=(t, i))
|
||||
|
||||
def encodeBytes(self, src: bytes) -> list[int]:
|
||||
idx: int = 0
|
||||
tokens: list[int] = []
|
||||
while idx < len(src):
|
||||
_idx: int = idx
|
||||
idx, _, values = self.root.find_longest(src, idx)
|
||||
assert idx != _idx
|
||||
_, token = next(iter(values))
|
||||
tokens.append(token)
|
||||
return tokens
|
||||
|
||||
def decodeBytes(self, tokens):
|
||||
return b"".join(map(lambda i: self.idx2token[i], tokens))
|
||||
|
||||
def encode(self, src):
|
||||
return self.encodeBytes(src.encode("utf-8"))
|
||||
|
||||
def decode(self, tokens):
|
||||
try:
|
||||
return self.decodeBytes(tokens).decode("utf-8")
|
||||
except:
|
||||
return "\ufffd" # bad utf-8
|
||||
|
||||
def printTokens(self, tokens):
|
||||
for i in tokens:
|
||||
s = self.idx2token[i]
|
||||
try:
|
||||
s = s.decode("utf-8")
|
||||
except:
|
||||
pass
|
||||
print(f"{repr(s)}{i}", end=" ")
|
||||
print()
|
||||
65529
backend-python/rwkv_pip/rwkv_vocab_v20230424.txt
vendored
Normal file
142
backend-python/rwkv_pip/utils.py
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
########################################################################################################
|
||||
# The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM
|
||||
########################################################################################################
|
||||
|
||||
import os, sys
|
||||
import numpy as np
|
||||
import torch
|
||||
from torch.nn import functional as F
|
||||
|
||||
|
||||
class PIPELINE_ARGS:
|
||||
def __init__(
|
||||
self,
|
||||
temperature=1.0,
|
||||
top_p=0.85,
|
||||
top_k=0,
|
||||
alpha_frequency=0.2,
|
||||
alpha_presence=0.2,
|
||||
token_ban=[],
|
||||
token_stop=[],
|
||||
chunk_len=256,
|
||||
):
|
||||
self.temperature = temperature
|
||||
self.top_p = top_p
|
||||
self.top_k = top_k
|
||||
self.alpha_frequency = alpha_frequency # Frequency Penalty (as in GPT-3)
|
||||
self.alpha_presence = alpha_presence # Presence Penalty (as in GPT-3)
|
||||
self.token_ban = token_ban # ban the generation of some tokens
|
||||
self.token_stop = token_stop # stop generation whenever you see any token here
|
||||
self.chunk_len = (
|
||||
chunk_len # split input into chunks to save VRAM (shorter -> slower)
|
||||
)
|
||||
|
||||
|
||||
class PIPELINE:
|
||||
def __init__(self, model, WORD_NAME):
|
||||
self.model = model
|
||||
if WORD_NAME == "cl100k_base":
|
||||
import tiktoken
|
||||
|
||||
self.tokenizer = tiktoken.get_encoding(WORD_NAME)
|
||||
elif WORD_NAME == "rwkv_vocab_v20230424":
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from rwkv_tokenizer import TRIE_TOKENIZER
|
||||
|
||||
self.tokenizer = TRIE_TOKENIZER(
|
||||
os.path.dirname(os.path.abspath(__file__)) + "/rwkv_vocab_v20230424.txt"
|
||||
)
|
||||
else:
|
||||
from tokenizers import Tokenizer
|
||||
|
||||
self.tokenizer = Tokenizer.from_file(WORD_NAME)
|
||||
|
||||
def refine_context(self, context):
|
||||
context = context.strip().split("\n")
|
||||
for c in range(len(context)):
|
||||
context[c] = context[c].strip().strip("\u3000").strip("\r")
|
||||
context = list(filter(lambda c: c != "", context))
|
||||
context = "\n" + ("\n".join(context)).strip()
|
||||
if context == "":
|
||||
context = "\n"
|
||||
return context
|
||||
|
||||
def encode(self, x):
|
||||
if "Tokenizer" in str(type(self.tokenizer)):
|
||||
return self.tokenizer.encode(x).ids
|
||||
else:
|
||||
return self.tokenizer.encode(x)
|
||||
|
||||
def decode(self, x):
|
||||
return self.tokenizer.decode(x)
|
||||
|
||||
def sample_logits(self, logits, temperature=1.0, top_p=0.85, top_k=0):
|
||||
probs = F.softmax(logits.float(), dim=-1)
|
||||
top_k = int(top_k)
|
||||
if probs.device == torch.device("cpu"):
|
||||
probs = probs.numpy()
|
||||
sorted_ids = np.argsort(probs)
|
||||
sorted_probs = probs[sorted_ids][::-1]
|
||||
cumulative_probs = np.cumsum(sorted_probs)
|
||||
cutoff = float(sorted_probs[np.argmax(cumulative_probs > top_p)])
|
||||
probs[probs < cutoff] = 0
|
||||
if top_k < len(probs) and top_k > 0:
|
||||
probs[sorted_ids[:-top_k]] = 0
|
||||
if temperature != 1.0:
|
||||
probs = probs ** (1.0 / temperature)
|
||||
probs = probs / np.sum(probs)
|
||||
out = np.random.choice(a=len(probs), p=probs)
|
||||
return int(out)
|
||||
else:
|
||||
sorted_ids = torch.argsort(probs)
|
||||
sorted_probs = probs[sorted_ids]
|
||||
sorted_probs = torch.flip(sorted_probs, dims=(0,))
|
||||
cumulative_probs = torch.cumsum(sorted_probs, dim=-1).cpu().numpy()
|
||||
cutoff = float(sorted_probs[np.argmax(cumulative_probs > top_p)])
|
||||
probs[probs < cutoff] = 0
|
||||
if top_k < len(probs) and top_k > 0:
|
||||
probs[sorted_ids[:-top_k]] = 0
|
||||
if temperature != 1.0:
|
||||
probs = probs ** (1.0 / temperature)
|
||||
out = torch.multinomial(probs, num_samples=1)[0]
|
||||
return int(out)
|
||||
|
||||
def generate(
|
||||
self, ctx, token_count=100, args=PIPELINE_ARGS(), callback=None, state=None
|
||||
):
|
||||
all_tokens = []
|
||||
out_last = 0
|
||||
out_str = ""
|
||||
occurrence = {}
|
||||
for i in range(token_count):
|
||||
# forward & adjust prob.
|
||||
tokens = self.encode(ctx) if i == 0 else [token]
|
||||
while len(tokens) > 0:
|
||||
out, state = self.model.forward(tokens[: args.chunk_len], state)
|
||||
tokens = tokens[args.chunk_len :]
|
||||
|
||||
for n in args.token_ban:
|
||||
out[n] = -float("inf")
|
||||
for n in occurrence:
|
||||
out[n] -= args.alpha_presence + occurrence[n] * args.alpha_frequency
|
||||
|
||||
# sampler
|
||||
token = self.sample_logits(
|
||||
out, temperature=args.temperature, top_p=args.top_p, top_k=args.top_k
|
||||
)
|
||||
if token in args.token_stop:
|
||||
break
|
||||
all_tokens += [token]
|
||||
if token not in occurrence:
|
||||
occurrence[token] = 1
|
||||
else:
|
||||
occurrence[token] += 1
|
||||
|
||||
# output
|
||||
tmp = self.decode(all_tokens[out_last:])
|
||||
if "\ufffd" not in tmp: # is valid utf-8 string?
|
||||
if callback:
|
||||
callback(tmp)
|
||||
out_str += tmp
|
||||
out_last = i + 1
|
||||
return out_str
|
||||
32
backend-python/utils/log.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
from fastapi import Request
|
||||
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
formatter = logging.Formatter("%(asctime)s - %(levelname)s\n%(message)s")
|
||||
fh = logging.handlers.RotatingFileHandler(
|
||||
"api.log", mode="a", maxBytes=3 * 1024 * 1024, backupCount=3
|
||||
)
|
||||
fh.setFormatter(formatter)
|
||||
logger.addHandler(fh)
|
||||
|
||||
|
||||
def quick_log(request: Request, body: Any, response: str):
|
||||
logger.info(
|
||||
f"Client: {request.client}\nUrl: {request.url}\n"
|
||||
+ (
|
||||
f"Body: {json.dumps(body.__dict__, default=vars, ensure_ascii=False)}\n"
|
||||
if body
|
||||
else ""
|
||||
)
|
||||
+ (f"Response:\n{response}\n" if response else "")
|
||||
)
|
||||
|
||||
|
||||
async def log_middleware(request: Request):
|
||||
logger.info(
|
||||
f"Client: {request.client}\nUrl: {request.url}\nBody: {await request.body()}\n"
|
||||
)
|
||||
@@ -1,28 +1,218 @@
|
||||
import os
|
||||
import pathlib
|
||||
from typing import Dict
|
||||
from langchain.llms import RWKV
|
||||
from pydantic import BaseModel
|
||||
import copy
|
||||
from typing import Dict, List
|
||||
from fastapi import HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from rwkv_pip.utils import PIPELINE
|
||||
from routes import state_cache
|
||||
|
||||
|
||||
END_OF_TEXT = 0
|
||||
END_OF_LINE = 187
|
||||
END_OF_LINE_DOUBLE = 535
|
||||
|
||||
|
||||
os.environ["TORCH_EXTENSIONS_DIR"] = f"{pathlib.Path(__file__).parent.parent.resolve()}"
|
||||
|
||||
|
||||
class RWKV:
|
||||
def __init__(self, model: str, strategy: str, tokens_path: str) -> None:
|
||||
from rwkv.model import RWKV as Model # dynamic import to make RWKV_CUDA_ON work
|
||||
|
||||
self.model = Model(model, strategy)
|
||||
self.pipeline = PIPELINE(self.model, tokens_path)
|
||||
self.model_state = None
|
||||
self.model_tokens = []
|
||||
|
||||
self.CHUNK_LEN = 256
|
||||
|
||||
self.max_tokens_per_generation = 500
|
||||
self.temperature = 1
|
||||
self.top_p = 0.5
|
||||
self.penalty_alpha_presence = 0.4
|
||||
self.penalty_alpha_frequency = 0.4
|
||||
|
||||
self.interface = ":"
|
||||
if "rwkv_vocab" in tokens_path:
|
||||
self.user = "Question"
|
||||
self.bot = "Answer"
|
||||
else:
|
||||
self.user = "Bob"
|
||||
self.bot = "Alice"
|
||||
|
||||
self.AVOID_REPEAT_TOKENS = []
|
||||
AVOID_REPEAT = ",:?!"
|
||||
for i in AVOID_REPEAT:
|
||||
dd = self.pipeline.encode(i)
|
||||
assert len(dd) == 1
|
||||
self.AVOID_REPEAT_TOKENS += dd
|
||||
|
||||
self.preload()
|
||||
|
||||
def preload(self):
|
||||
interface = self.interface
|
||||
user = self.user
|
||||
bot = self.bot
|
||||
preset_system = (
|
||||
f"""
|
||||
The following is a coherent verbose detailed conversation between a girl named {bot} and her friend {user}. \
|
||||
{bot} is very intelligent, creative and friendly. \
|
||||
{bot} is unlikely to disagree with {user}, and {bot} doesn't like to ask {user} questions. \
|
||||
{bot} likes to tell {user} a lot about herself and her opinions. \
|
||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||
"""
|
||||
if self.user == "Bob"
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.\n\n"
|
||||
)
|
||||
logits = self.run_rnn(self.fix_tokens(self.pipeline.encode(preset_system)))
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=preset_system,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
|
||||
# Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end
|
||||
def fix_tokens(self, tokens):
|
||||
if len(tokens) > 0 and tokens[-1] == END_OF_LINE_DOUBLE:
|
||||
tokens = tokens[:-1] + [END_OF_LINE, END_OF_LINE]
|
||||
return tokens
|
||||
|
||||
def run_rnn(self, _tokens: List[str], newline_adj: int = 0):
|
||||
tokens = [int(x) for x in _tokens]
|
||||
self.model_tokens += tokens
|
||||
|
||||
while len(tokens) > 0:
|
||||
out, self.model_state = self.model.forward(
|
||||
tokens[: self.CHUNK_LEN], self.model_state
|
||||
)
|
||||
tokens = tokens[self.CHUNK_LEN :]
|
||||
|
||||
out[END_OF_LINE] += newline_adj # adjust \n probability
|
||||
|
||||
if self.model_tokens[-1] in self.AVOID_REPEAT_TOKENS:
|
||||
out[self.model_tokens[-1]] = -999999999
|
||||
return out
|
||||
|
||||
def generate(self, prompt: str, stop: str = None):
|
||||
cache = None
|
||||
delta_prompt = prompt
|
||||
try:
|
||||
cache = state_cache.longest_prefix_state(
|
||||
state_cache.LongestPrefixStateBody(prompt=prompt)
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
if cache is None or cache["prompt"] == "":
|
||||
self.model_state = None
|
||||
self.model_tokens = []
|
||||
else:
|
||||
delta_prompt = prompt[len(cache["prompt"]) :]
|
||||
self.model_state = copy.deepcopy(cache["state"])
|
||||
self.model_tokens = copy.deepcopy(cache["tokens"])
|
||||
logits = copy.deepcopy(cache["logits"])
|
||||
|
||||
if delta_prompt != "":
|
||||
logits = self.run_rnn(self.fix_tokens(self.pipeline.encode(delta_prompt)))
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=prompt,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
|
||||
begin = len(self.model_tokens)
|
||||
out_last = begin
|
||||
|
||||
occurrence: Dict = {}
|
||||
|
||||
response = ""
|
||||
for i in range(self.max_tokens_per_generation):
|
||||
for n in occurrence:
|
||||
logits[n] -= (
|
||||
self.penalty_alpha_presence
|
||||
+ occurrence[n] * self.penalty_alpha_frequency
|
||||
)
|
||||
token = self.pipeline.sample_logits(
|
||||
logits, temperature=self.temperature, top_p=self.top_p
|
||||
)
|
||||
|
||||
if token == END_OF_TEXT:
|
||||
yield response, ""
|
||||
break
|
||||
if token not in occurrence:
|
||||
occurrence[token] = 1
|
||||
else:
|
||||
occurrence[token] += 1
|
||||
|
||||
logits = self.run_rnn([token])
|
||||
delta: str = self.pipeline.decode(self.model_tokens[out_last:])
|
||||
if "\ufffd" not in delta: # avoid utf-8 display issues
|
||||
response += delta
|
||||
if stop is not None:
|
||||
if stop in response:
|
||||
response = response.split(stop)[0]
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=prompt + response,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
yield response, ""
|
||||
break
|
||||
out_last = begin + i + 1
|
||||
if i == self.max_tokens_per_generation - 1:
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=prompt + response,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
yield response, delta
|
||||
|
||||
|
||||
class ModelConfigBody(BaseModel):
|
||||
max_tokens: int = None
|
||||
temperature: float = None
|
||||
top_p: float = None
|
||||
presence_penalty: float = None
|
||||
frequency_penalty: float = None
|
||||
max_tokens: int = Field(default=None, gt=0, le=102400)
|
||||
temperature: float = Field(default=None, ge=0, le=2)
|
||||
top_p: float = Field(default=None, ge=0, le=1)
|
||||
presence_penalty: float = Field(default=None, ge=-2, le=2)
|
||||
frequency_penalty: float = Field(default=None, ge=-2, le=2)
|
||||
|
||||
|
||||
def set_rwkv_config(model: RWKV, body: ModelConfigBody):
|
||||
if body.max_tokens:
|
||||
if body.max_tokens is not None:
|
||||
model.max_tokens_per_generation = body.max_tokens
|
||||
if body.temperature:
|
||||
model.temperature = body.temperature
|
||||
if body.top_p:
|
||||
if body.temperature is not None:
|
||||
if body.temperature < 0.1:
|
||||
model.temperature = 0.1
|
||||
else:
|
||||
model.temperature = body.temperature
|
||||
if body.top_p is not None:
|
||||
model.top_p = body.top_p
|
||||
if body.presence_penalty:
|
||||
if body.presence_penalty is not None:
|
||||
model.penalty_alpha_presence = body.presence_penalty
|
||||
if body.frequency_penalty:
|
||||
if body.frequency_penalty is not None:
|
||||
model.penalty_alpha_frequency = body.frequency_penalty
|
||||
|
||||
|
||||
@@ -34,49 +224,3 @@ def get_rwkv_config(model: RWKV) -> ModelConfigBody:
|
||||
presence_penalty=model.penalty_alpha_presence,
|
||||
frequency_penalty=model.penalty_alpha_frequency,
|
||||
)
|
||||
|
||||
|
||||
os.environ["TORCH_EXTENSIONS_DIR"] = f"{pathlib.Path(__file__).parent.parent.resolve()}"
|
||||
|
||||
|
||||
def rwkv_generate(model: RWKV, prompt: str, stop: str = None):
|
||||
model.model_state = None
|
||||
model.model_tokens = []
|
||||
logits = model.run_rnn(model.tokenizer.encode(prompt).ids)
|
||||
begin = len(model.model_tokens)
|
||||
out_last = begin
|
||||
|
||||
occurrence: Dict = {}
|
||||
|
||||
response = ""
|
||||
for i in range(model.max_tokens_per_generation):
|
||||
for n in occurrence:
|
||||
logits[n] -= (
|
||||
model.penalty_alpha_presence
|
||||
+ occurrence[n] * model.penalty_alpha_frequency
|
||||
)
|
||||
token = model.pipeline.sample_logits(
|
||||
logits, temperature=model.temperature, top_p=model.top_p
|
||||
)
|
||||
|
||||
END_OF_TEXT = 0
|
||||
if token == END_OF_TEXT:
|
||||
break
|
||||
if token not in occurrence:
|
||||
occurrence[token] = 1
|
||||
else:
|
||||
occurrence[token] += 1
|
||||
|
||||
logits = model.run_rnn([token])
|
||||
delta: str = model.tokenizer.decode(model.model_tokens[out_last:])
|
||||
if "\ufffd" not in delta: # avoid utf-8 display issues
|
||||
response += delta
|
||||
if stop is not None:
|
||||
if stop in response:
|
||||
response = response.split(stop)[0]
|
||||
yield response, ""
|
||||
break
|
||||
yield response, delta
|
||||
out_last = begin + i + 1
|
||||
if i >= model.max_tokens_per_generation - 100:
|
||||
break
|
||||
|
||||
BIN
backend-python/wkv_cuda_utils/wkv_cuda40.pyd
vendored
BIN
build/appicon.png
vendored
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 120 KiB |
2
build/darwin/Info.dev.plist
vendored
@@ -8,7 +8,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<string>dev.josStorer.RWKV-Runner</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
|
||||
2
build/darwin/Info.plist
vendored
@@ -8,7 +8,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<string>dev.josStorer.RWKV-Runner</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
|
||||
9
build/darwin/Readme_Install.txt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
Please execute this program in an empty directory. All related dependencies will be placed in this directory.
|
||||
请将本程序放在一个空目录内执行, 所有相关依赖均会放置于此目录.
|
||||
このプログラムを空のディレクトリで実行してください。関連するすべての依存関係は、このディレクトリに配置されます。
|
||||
|
||||
Please execute the following command in the terminal to remove the permission restrictions of this app, and then this program can work properly:
|
||||
请在终端执行以下命令解除本app的权限限制, 然后本程序才可以正常工作:
|
||||
このアプリの権限制限を解除するために、ターミナルで以下のコマンドを実行してください。その後、このプログラムは正常に動作するようになります:
|
||||
|
||||
sudo xattr -r -d com.apple.quarantine ./RWKV-Runner.app
|
||||
16
build/darwin/entitlements.plist
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<false/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.downloads.read-write</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
17
build/darwin/gon-sign.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"source": [
|
||||
"./build/bin/RWKV-Runner_darwin.app"
|
||||
],
|
||||
"bundle_id": "dev.josStorer.RWKV-Runner",
|
||||
"apple_id": {
|
||||
"username": "joshua1466587594@outlook.com",
|
||||
"password": ""
|
||||
},
|
||||
"sign": {
|
||||
"application_identity": "D00A983569B4EAA2A008B963254F385F42A493FD",
|
||||
"entitlements_file": "./build/darwin/entitlements.plist"
|
||||
},
|
||||
"zip": {
|
||||
"output_path": "./build/bin/RWKV-Runner_darwin.archive.zip"
|
||||
}
|
||||
}
|
||||
13
build/linux/Readme_Install.txt
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Please execute this program in an empty directory. All related dependencies will be placed in this directory.
|
||||
请将本程序放在一个空目录内执行, 所有相关依赖均会放置于此目录.
|
||||
このプログラムを空のディレクトリで実行してください。関連するすべての依存関係は、このディレクトリに配置されます。
|
||||
|
||||
On Linux system, this program cannot invoke the terminal for automatic dependency installation. You must manually execute the following commands for installation so that it can be used normally:
|
||||
在Linux系统下, 本程序无法调用终端自动安装依赖, 你必须手动执行以下命令进行安装, 之后方可正常使用:
|
||||
Linuxシステムでは、このプログラムはターミナルを自動的に呼び出して依存関係をインストールすることができません。以下のコマンドを手動で実行する必要があります。それが完了した後に、正常に使用することができます:
|
||||
|
||||
chmod +x ./RWKV-Runner
|
||||
./RWKV-Runner
|
||||
git clone https://github.com/josStorer/RWKV-Runner --depth=1
|
||||
cd RWKV-Runner/backend-python
|
||||
pip3 install -r requirements.txt # or pip3 install -r requirements_without_cyac.txt
|
||||
3
build/windows/Readme_Install.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Please execute this program in an empty directory. All related dependencies will be placed in this directory.
|
||||
请将本程序放在一个空目录内执行, 所有相关依赖均会放置于此目录.
|
||||
このプログラムを空のディレクトリで実行してください。関連するすべての依存関係は、このディレクトリに配置されます。
|
||||
BIN
build/windows/icon.ico
vendored
|
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 167 KiB |
@@ -88,6 +88,7 @@
|
||||
"Downloads": "下载",
|
||||
"Pause": "暂停",
|
||||
"Continue": "继续",
|
||||
"Resume": "继续",
|
||||
"Check": "查看",
|
||||
"Model file not found": "模型文件不存在",
|
||||
"Can not find download url": "找不到下载地址",
|
||||
@@ -114,7 +115,31 @@
|
||||
"Catgirl": "猫娘",
|
||||
"Explain Code": "代码解释",
|
||||
"Werewolf": "狼人杀",
|
||||
"Instruction": "指令",
|
||||
"Blank": "空白",
|
||||
"The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n": "以下是不朽的科幻史诗巨著,描写细腻,刻画了宏大的星际文明战争。\n第一章\n",
|
||||
"API Host": "API主机"
|
||||
"The following is a conversation between a cat girl and her owner. The cat girl is a humanized creature that behaves like a cat but is humanoid. At the end of each sentence in the dialogue, she will add \"Meow~\". In the following content, Bob represents the owner and Alice represents the cat girl.\n\nBob: Hello.\n\nAlice: I'm here, meow~.\n\nBob: Can you tell jokes?": "以下是一位猫娘的主人和猫娘的对话内容,猫娘是一种拟人化的生物,其行为似猫但类人,在每一句对话末尾都会加上\"喵~\"。以下内容中,Bob代表主人,Alice代表猫娘。\n\nBob: 你好\n\nAlice: 主人我在哦,喵~\n\nBob: 你会讲笑话吗?",
|
||||
"When response finished, inject this content.": "响应结束时,插入此内容到末尾",
|
||||
"Inject start text": "起始注入文本",
|
||||
"Inject end text": "结尾注入文本",
|
||||
"Before the response starts, inject this content.": "响应开始前,在开头插入此内容",
|
||||
"There is currently a game of Werewolf with six players, including a Seer (who can check identities at night), two Werewolves (who can choose someone to kill at night), a Bodyguard (who can choose someone to protect at night), two Villagers (with no special abilities), and a game host. Bob will play as Player 1, Alice will play as Players 2-6 and the game host, and they will begin playing together. Every night, the host will ask Bob for his action and simulate the actions of the other players. During the day, the host will oversee the voting process and ask Bob for his vote. \n\nAlice: Next, I will act as the game host and assign everyone their roles, including randomly assigning yours. Then, I will simulate the actions of Players 2-6 and let you know what happens each day. Based on your assigned role, you can tell me your actions and I will let you know the corresponding results each day.\n\nBob: Okay, I understand. Let's begin. Please assign me a role. Am I the Seer, Werewolf, Villager, or Bodyguard?\n\nAlice: You are the Seer. Now that night has fallen, please choose a player to check his identity.\n\nBob: Tonight, I want to check Player 2 and find out his role.": "现在有一场六人狼人杀游戏,包括一名预言家(可以在夜晚查验身份),两名狼人(可以在夜晚选择杀人),一名守卫(可以在夜晚选择要守护的人),两名平民(无技能),一名主持人,以下内容中Bob将扮演其中的1号玩家,Alice来扮演2-6号玩家,以及主持人,并开始与Bob进行游戏,主持人每晚都会询问Bob的行动,并模拟其他人的行动,在白天则要主持投票,并同样询问Bob投票对象,公布投票结果。\n\nAlice: 接下来,我将首先作为主持人进行角色分配,并给你赋予随机的角色,之后我将模拟2-6号玩家进行行动,告知你每天的动态,根据你被分配的角色,你可以回复我你做的行动,我会告诉你每天对应的结果\n\nBob: 好的,我明白了,那么开始吧。请先给我一个角色身份。我是预言家,狼人,平民,守卫中的哪一个呢?\n\nAlice: 你的身份是预言家。现在夜晚降临,请选择你要查验的玩家。\n\nBob: 今晚我要验2号玩家,他是什么身份?",
|
||||
"Writer, Translator, Role-playing": "写作,翻译,角色扮演",
|
||||
"Chinese Kongfu": "情境冒险",
|
||||
"Allow external access to the API (service must be restarted)": "允许外部访问API (必须重启服务)",
|
||||
"Custom": "自定义",
|
||||
"Reset All Configs": "重置所有配置",
|
||||
"Cancel": "取消",
|
||||
"Confirm": "确认",
|
||||
"Are you sure you want to reset all configs? This will obtain the latest preset configs, but will override your custom configs and cannot be undone.": "你确定要重置所有配置吗?这会获取最新的预设配置,但会覆盖你的自定义配置,并且无法撤销",
|
||||
"Advanced": "高级",
|
||||
"Custom Python Path": "自定义Python路径",
|
||||
"Custom Models Path": "自定义模型路径",
|
||||
"Microsoft Visual C++ Redistributable is not installed, would you like to download it?": "微软VC++组件未安装, 是否下载?",
|
||||
"Path Cannot Contain Space": "路径不能包含空格",
|
||||
"Failed to switch model, please try starting the program with administrator privileges.": "切换模型失败, 请尝试以管理员权限启动程序",
|
||||
"Current Strategy": "当前Strategy",
|
||||
"MacOS is not yet supported for performing this operation, please do it manually.": "MacOS尚未支持此操作, 请手动执行",
|
||||
"Linux is not yet supported for performing this operation, please do it manually.": "Linux尚未支持此操作, 请手动执行",
|
||||
"On Linux system, you must manually install python dependencies.": "在Linux系统下, 你必须手动安装python依赖"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 238 KiB |
BIN
frontend/src/assets/images/logo.jpg
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
frontend/src/assets/images/strategy.jpg
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
frontend/src/assets/images/strategy_zh.jpg
Normal file
|
After Width: | Height: | Size: 115 KiB |
46
frontend/src/components/DialogButton.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { FC, ReactElement } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogBody,
|
||||
DialogContent,
|
||||
DialogSurface,
|
||||
DialogTitle,
|
||||
DialogTrigger
|
||||
} from '@fluentui/react-components';
|
||||
import { ToolTipButton } from './ToolTipButton';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const DialogButton: FC<{
|
||||
icon: ReactElement,
|
||||
tooltip: string,
|
||||
title: string,
|
||||
contentText: string,
|
||||
onConfirm: () => void
|
||||
}> = ({ tooltip, icon, title, contentText, onConfirm }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return <Dialog>
|
||||
<DialogTrigger disableButtonEnhancement>
|
||||
<ToolTipButton desc={tooltip} icon={icon} />
|
||||
</DialogTrigger>
|
||||
<DialogSurface>
|
||||
<DialogBody>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
<DialogContent>
|
||||
{contentText}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<DialogTrigger disableButtonEnhancement>
|
||||
<Button appearance="secondary">{t('Cancel')}</Button>
|
||||
</DialogTrigger>
|
||||
<DialogTrigger disableButtonEnhancement>
|
||||
<Button appearance="primary" onClick={onConfirm}>{t('Confirm')}
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
</DialogActions>
|
||||
</DialogBody>
|
||||
</DialogSurface>
|
||||
</Dialog>;
|
||||
};
|
||||
@@ -5,17 +5,23 @@ import classnames from 'classnames';
|
||||
export const Labeled: FC<{
|
||||
label: string;
|
||||
desc?: string | null,
|
||||
descComponent?: ReactElement,
|
||||
content: ReactElement,
|
||||
flex?: boolean,
|
||||
spaceBetween?: boolean,
|
||||
breakline?: boolean
|
||||
breakline?: boolean,
|
||||
onMouseEnter?: () => void
|
||||
onMouseLeave?: () => void
|
||||
}> = ({
|
||||
label,
|
||||
desc,
|
||||
descComponent,
|
||||
content,
|
||||
flex,
|
||||
spaceBetween,
|
||||
breakline
|
||||
breakline,
|
||||
onMouseEnter,
|
||||
onMouseLeave
|
||||
}) => {
|
||||
return (
|
||||
<div className={classnames(
|
||||
@@ -24,11 +30,11 @@ export const Labeled: FC<{
|
||||
breakline ? 'flex-col' : '',
|
||||
spaceBetween && 'justify-between')
|
||||
}>
|
||||
{desc ?
|
||||
<Tooltip content={desc} showDelay={0} hideDelay={0} relationship="description">
|
||||
<Label>{label}</Label>
|
||||
{(desc || descComponent) ?
|
||||
<Tooltip content={descComponent ? descComponent : desc!} showDelay={0} hideDelay={0} relationship="description">
|
||||
<Label onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>{label}</Label>
|
||||
</Tooltip> :
|
||||
<Label>{label}</Label>
|
||||
<Label onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>{label}</Label>
|
||||
}
|
||||
{content}
|
||||
</div>
|
||||
|
||||
18
frontend/src/components/ResetConfigsButton.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import React, { FC } from 'react';
|
||||
import { DialogButton } from './DialogButton';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ArrowReset20Regular } from '@fluentui/react-icons';
|
||||
import commonStore from '../stores/commonStore';
|
||||
|
||||
import { defaultModelConfigs, defaultModelConfigsMac } from '../pages/defaultModelConfigs';
|
||||
|
||||
export const ResetConfigsButton: FC<{ afterConfirm?: () => void }> = ({ afterConfirm }) => {
|
||||
const { t } = useTranslation();
|
||||
return <DialogButton icon={<ArrowReset20Regular />} tooltip={t('Reset All Configs')} title={t('Reset All Configs')}
|
||||
contentText={t('Are you sure you want to reset all configs? This will obtain the latest preset configs, but will override your custom configs and cannot be undone.')}
|
||||
onConfirm={() => {
|
||||
commonStore.setModelConfigs(commonStore.platform != 'darwin' ? defaultModelConfigs : defaultModelConfigsMac, false);
|
||||
commonStore.setCurrentConfigIndex(0, true);
|
||||
afterConfirm?.();
|
||||
}} />;
|
||||
};
|
||||
@@ -12,13 +12,12 @@ import { Button } from '@fluentui/react-components';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { exit, getStatus, readRoot, switchModel, updateConfig } from '../apis';
|
||||
import { toast } from 'react-toastify';
|
||||
import manifest from '../../../manifest.json';
|
||||
import { getStrategy, getSupportedCustomCudaFile, saveCache, toastWithButton } from '../utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ToolTipButton } from './ToolTipButton';
|
||||
import { Play16Regular, Stop16Regular } from '@fluentui/react-icons';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { WindowShow } from '../../wailsjs/runtime/runtime';
|
||||
import { BrowserOpenURL, WindowShow } from '../../wailsjs/runtime/runtime';
|
||||
|
||||
const mainButtonText = {
|
||||
[ModelStatus.Offline]: 'Run',
|
||||
@@ -43,24 +42,24 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onClickMainButton = async () => {
|
||||
if (commonStore.status.modelStatus === ModelStatus.Offline) {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Starting });
|
||||
if (commonStore.status.status === ModelStatus.Offline) {
|
||||
commonStore.setStatus({ status: ModelStatus.Starting });
|
||||
|
||||
const modelConfig = commonStore.getCurrentModelConfig();
|
||||
let modelName = '';
|
||||
let modelPath = '';
|
||||
if (modelConfig && modelConfig.modelParameters) {
|
||||
modelName = modelConfig.modelParameters.modelName;
|
||||
modelPath = `./${manifest.localModelDir}/${modelName}`;
|
||||
modelPath = `${commonStore.settings.customModelsPath}/${modelName}`;
|
||||
} else {
|
||||
toast(t('Model Config Exception'), { type: 'error' });
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!commonStore.depComplete) {
|
||||
let depErrorMsg = '';
|
||||
await DepCheck().catch((e) => {
|
||||
await DepCheck(commonStore.settings.customPythonPath).catch((e) => {
|
||||
depErrorMsg = e.message || e;
|
||||
WindowShow();
|
||||
if (depErrorMsg === 'python zip not found') {
|
||||
@@ -71,20 +70,33 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
AddToDownloadList('python-3.10.11-embed-amd64.zip', 'https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip');
|
||||
});
|
||||
} else if (depErrorMsg.includes('DepCheck Error')) {
|
||||
toastWithButton(t('Python dependencies are incomplete, would you like to install them?'), t('Install'), () => {
|
||||
InstallPyDep(commonStore.settings.cnMirror);
|
||||
setTimeout(WindowShow, 1000);
|
||||
});
|
||||
if (depErrorMsg.includes('vc_redist')) {
|
||||
toastWithButton(t('Microsoft Visual C++ Redistributable is not installed, would you like to download it?'), t('Download'), () => {
|
||||
BrowserOpenURL('https://aka.ms/vs/16/release/vc_redist.x64.exe');
|
||||
});
|
||||
} else {
|
||||
toast(depErrorMsg, { type: 'info', position: 'bottom-left' });
|
||||
if (commonStore.platform != 'linux')
|
||||
toastWithButton(t('Python dependencies are incomplete, would you like to install them?'), t('Install'), () => {
|
||||
InstallPyDep(commonStore.settings.customPythonPath, commonStore.settings.cnMirror);
|
||||
setTimeout(WindowShow, 1000);
|
||||
});
|
||||
else
|
||||
toastWithButton(t('On Linux system, you must manually install python dependencies.'), t('Check'), () => {
|
||||
BrowserOpenURL('https://github.com/josStorer/RWKV-Runner/blob/master/build/linux/Readme_Install.txt');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toast(depErrorMsg, { type: 'error' });
|
||||
}
|
||||
});
|
||||
if (depErrorMsg) {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
return;
|
||||
}
|
||||
commonStore.setDepComplete(true);
|
||||
CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
||||
if (commonStore.platform === 'windows')
|
||||
CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
||||
saveCache();
|
||||
}
|
||||
|
||||
@@ -102,7 +114,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
}
|
||||
});
|
||||
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +122,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
|
||||
await exit(1000).catch(() => {
|
||||
});
|
||||
StartServer(port, commonStore.settings.host);
|
||||
StartServer(commonStore.settings.customPythonPath, port, commonStore.settings.host !== '127.0.0.1' ? '0.0.0.0' : '127.0.0.1');
|
||||
setTimeout(WindowShow, 1000);
|
||||
|
||||
let timeoutCount = 6;
|
||||
@@ -125,7 +137,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
if (status)
|
||||
commonStore.setStatus(status);
|
||||
});
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Loading });
|
||||
commonStore.setStatus({ status: ModelStatus.Loading });
|
||||
toast(t('Loading Model'), { type: 'info' });
|
||||
updateConfig({
|
||||
max_tokens: modelConfig.apiParameters.maxResponseToken,
|
||||
@@ -136,72 +148,84 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
||||
});
|
||||
|
||||
let customCudaFile = '';
|
||||
if (modelConfig.modelParameters.useCustomCuda) {
|
||||
customCudaFile = getSupportedCustomCudaFile();
|
||||
if (customCudaFile) {
|
||||
FileExists('./py310/Lib/site-packages/rwkv/model.py').then((exist) => {
|
||||
// defensive measure. As Python has already been launched, will only take effect the next time it runs.
|
||||
if (!exist) CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
||||
});
|
||||
await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
|
||||
customCudaFile = '';
|
||||
toast(t('Failed to copy custom cuda file'), { type: 'error' });
|
||||
});
|
||||
} else
|
||||
toast(t('Supported custom cuda file not found'), { type: 'warning' });
|
||||
if ((modelConfig.modelParameters.device === 'CUDA' || modelConfig.modelParameters.device === 'Custom')
|
||||
&& modelConfig.modelParameters.useCustomCuda) {
|
||||
if (commonStore.platform === 'windows') {
|
||||
customCudaFile = getSupportedCustomCudaFile();
|
||||
if (customCudaFile) {
|
||||
FileExists('./py310/Lib/site-packages/rwkv/model.py').then((exist) => {
|
||||
// defensive measure. As Python has already been launched, will only take effect the next time it runs.
|
||||
if (!exist) CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
||||
});
|
||||
await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
|
||||
FileExists('./py310/Lib/site-packages/rwkv/wkv_cuda.pyd').then((exist) => {
|
||||
if (!exist) {
|
||||
customCudaFile = '';
|
||||
toast(t('Failed to copy custom cuda file'), { type: 'error' });
|
||||
}
|
||||
});
|
||||
});
|
||||
} else
|
||||
toast(t('Supported custom cuda file not found'), { type: 'warning' });
|
||||
} else {
|
||||
customCudaFile = 'any';
|
||||
}
|
||||
}
|
||||
|
||||
switchModel({
|
||||
model: `${manifest.localModelDir}/${modelConfig.modelParameters.modelName}`,
|
||||
model: modelPath,
|
||||
strategy: getStrategy(modelConfig),
|
||||
customCuda: customCudaFile !== ''
|
||||
}).then((r) => {
|
||||
if (r.ok) {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Working });
|
||||
commonStore.setStatus({ status: ModelStatus.Working });
|
||||
toastWithButton(t('Startup Completed'), t('Chat'), () => {
|
||||
navigate({ pathname: '/chat' });
|
||||
}, { type: 'success', autoClose: 3000 });
|
||||
} else if (r.status === 304) {
|
||||
toast(t('Loading Model'), { type: 'info' });
|
||||
} else {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
toast(t('Failed to switch model'), { type: 'error' });
|
||||
}
|
||||
}).catch(() => {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
toast(t('Failed to switch model'), { type: 'error' });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
if (commonStore.platform === 'windows')
|
||||
toast(t('Failed to switch model, please try starting the program with administrator privileges.'), { type: 'error' });
|
||||
else
|
||||
toast(t('Failed to switch model'), { type: 'error' });
|
||||
});
|
||||
}
|
||||
}).catch(() => {
|
||||
if (timeoutCount <= 0) {
|
||||
clearInterval(intervalId);
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
}
|
||||
});
|
||||
|
||||
timeoutCount--;
|
||||
}, 1000);
|
||||
} else {
|
||||
commonStore.setStatus({ modelStatus: ModelStatus.Offline });
|
||||
commonStore.setStatus({ status: ModelStatus.Offline });
|
||||
exit();
|
||||
}
|
||||
};
|
||||
|
||||
const onClick = async (e: any) => {
|
||||
if (commonStore.status.modelStatus === ModelStatus.Offline)
|
||||
if (commonStore.status.status === ModelStatus.Offline)
|
||||
await onClickRun?.(e);
|
||||
await onClickMainButton();
|
||||
};
|
||||
|
||||
return (iconMode ?
|
||||
<ToolTipButton disabled={commonStore.status.modelStatus === ModelStatus.Starting}
|
||||
icon={iconModeButtonIcon[commonStore.status.modelStatus]}
|
||||
desc={t(mainButtonText[commonStore.status.modelStatus])}
|
||||
<ToolTipButton disabled={commonStore.status.status === ModelStatus.Starting}
|
||||
icon={iconModeButtonIcon[commonStore.status.status]}
|
||||
desc={t(mainButtonText[commonStore.status.status])}
|
||||
size="small" onClick={onClick} />
|
||||
:
|
||||
<Button disabled={commonStore.status.modelStatus === ModelStatus.Starting} appearance="primary" size="large"
|
||||
<Button disabled={commonStore.status.status === ModelStatus.Starting} appearance="primary" size="large"
|
||||
onClick={onClick}>
|
||||
{t(mainButtonText[commonStore.status.modelStatus])}
|
||||
{t(mainButtonText[commonStore.status.status])}
|
||||
</Button>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -29,8 +29,8 @@ export const WorkHeader: FC = observer(() => {
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex items-center gap-2">
|
||||
<PresenceBadge status={badgeStatus[commonStore.status.modelStatus]} />
|
||||
<Text size={100}>{t('Model Status') + ': ' + t(statusText[commonStore.status.modelStatus])}</Text>
|
||||
<PresenceBadge status={badgeStatus[commonStore.status.status]} />
|
||||
<Text size={100}>{t('Model Status') + ': ' + t(statusText[commonStore.status.status])}</Text>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<ConfigSelector size="small" />
|
||||
|
||||
@@ -6,6 +6,7 @@ import App from './App';
|
||||
import { HashRouter } from 'react-router-dom';
|
||||
import { startup } from './startup';
|
||||
import './_locales/i18n-react';
|
||||
import { WindowShow } from '../wailsjs/runtime';
|
||||
|
||||
startup().then(() => {
|
||||
const container = document.getElementById('root');
|
||||
@@ -17,4 +18,7 @@ startup().then(() => {
|
||||
<App />
|
||||
</HashRouter>
|
||||
);
|
||||
|
||||
// force display the window
|
||||
WindowShow();
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { v4 as uuid } from 'uuid';
|
||||
import classnames from 'classnames';
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
||||
import { ConversationPair, getConversationPairs, Record } from '../utils/get-conversation-pairs';
|
||||
import logo from '../../../build/appicon.png';
|
||||
import logo from '../assets/images/logo.jpg';
|
||||
import MarkdownRender from '../components/MarkdownRender';
|
||||
import { ToolTipButton } from '../components/ToolTipButton';
|
||||
import { ArrowCircleUp28Regular, Delete28Regular, RecordStop28Regular } from '@fluentui/react-icons';
|
||||
@@ -93,7 +93,7 @@ const ChatPanel: FC = observer(() => {
|
||||
e.stopPropagation();
|
||||
if (e.type === 'click' || (e.keyCode === 13 && !e.shiftKey)) {
|
||||
e.preventDefault();
|
||||
if (commonStore.status.modelStatus === ModelStatus.Offline) {
|
||||
if (commonStore.status.status === ModelStatus.Offline) {
|
||||
toast(t('Please click the button in the top right corner to start the model'), { type: 'warning' });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,11 @@ import commonStore, { ModelStatus } from '../stores/commonStore';
|
||||
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
export type CompletionParams = Omit<ApiParameters, 'apiPort'> & { stop: string }
|
||||
export type CompletionParams = Omit<ApiParameters, 'apiPort'> & {
|
||||
stop: string,
|
||||
injectStart: string,
|
||||
injectEnd: string
|
||||
};
|
||||
|
||||
export type CompletionPreset = {
|
||||
name: string,
|
||||
@@ -22,67 +26,106 @@ export const defaultPresets: CompletionPreset[] = [{
|
||||
name: 'Writer',
|
||||
prompt: 'The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\nChapter 1.\n',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1,
|
||||
maxResponseToken: 500,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
stop: '\\n\\nBob',
|
||||
injectStart: '',
|
||||
injectEnd: ''
|
||||
}
|
||||
}, {
|
||||
name: 'Translator',
|
||||
prompt: '',
|
||||
prompt: 'Translate this into Chinese.\n\nEnglish: What rooms do you have available?',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
maxResponseToken: 500,
|
||||
temperature: 1,
|
||||
topP: 0.5,
|
||||
topP: 0.3,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
stop: '\\nEnglish',
|
||||
injectStart: '\\nChinese: ',
|
||||
injectEnd: '\\nEnglish: '
|
||||
}
|
||||
}, {
|
||||
name: 'Catgirl',
|
||||
prompt: '',
|
||||
prompt: 'The following is a conversation between a cat girl and her owner. The cat girl is a humanized creature that behaves like a cat but is humanoid. At the end of each sentence in the dialogue, she will add \"Meow~\". In the following content, Bob represents the owner and Alice represents the cat girl.\n\nBob: Hello.\n\nAlice: I\'m here, meow~.\n\nBob: Can you tell jokes?',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1,
|
||||
maxResponseToken: 500,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
stop: '\\n\\nBob',
|
||||
injectStart: '\\n\\nAlice: ',
|
||||
injectEnd: '\\n\\nBob: '
|
||||
}
|
||||
}, {
|
||||
name: 'Explain Code',
|
||||
prompt: '',
|
||||
name: 'Chinese Kongfu',
|
||||
prompt: 'Bob: 请你扮演一个文本冒险游戏,我是游戏主角。这是一个玄幻修真世界,有四大门派。我输入我的行动,请你显示行动结果,并具体描述环境。我的第一个行动是“醒来”,请开始故事。',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
maxResponseToken: 500,
|
||||
temperature: 1.1,
|
||||
topP: 0.7,
|
||||
presencePenalty: 0.3,
|
||||
frequencyPenalty: 0.3,
|
||||
stop: '\\n\\nBob',
|
||||
injectStart: '\\n\\nAlice: ',
|
||||
injectEnd: '\\n\\nBob: '
|
||||
}
|
||||
}, {
|
||||
// }, {
|
||||
// name: 'Explain Code',
|
||||
// prompt: 'export async function startup() {\n FileExists(\'cache.json\').then((exists) => {\n if (exists)\n downloadProgramFiles();\n else {\n deleteDynamicProgramFiles().then(downloadProgramFiles);\n }\n });\n EventsOn(\'downloadList\', (data) => {\n if (data)\n commonStore.setDownloadList(data);\n });\n\n initCache().then(initRemoteText);\n\n await initConfig();\n\n if (commonStore.settings.autoUpdatesCheck) // depends on config settings\n checkUpdate();\n\n getStatus(1000).then(status => { // depends on config api port\n if (status)\n commonStore.setStatus(status);\n });\n}\n\n\"\"\"\nHere\'s what the above code is doing, explained in a concise way:\n',
|
||||
// params: {
|
||||
// maxResponseToken: 500,
|
||||
// temperature: 0.8,
|
||||
// topP: 0.7,
|
||||
// presencePenalty: 0.4,
|
||||
// frequencyPenalty: 0.4,
|
||||
// stop: '\\n\\n',
|
||||
// injectStart: '',
|
||||
// injectEnd: ''
|
||||
// }
|
||||
// }, {
|
||||
name: 'Werewolf',
|
||||
prompt: '',
|
||||
prompt: 'There is currently a game of Werewolf with six players, including a Seer (who can check identities at night), two Werewolves (who can choose someone to kill at night), a Bodyguard (who can choose someone to protect at night), two Villagers (with no special abilities), and a game host. Bob will play as Player 1, Alice will play as Players 2-6 and the game host, and they will begin playing together. Every night, the host will ask Bob for his action and simulate the actions of the other players. During the day, the host will oversee the voting process and ask Bob for his vote. \n\nAlice: Next, I will act as the game host and assign everyone their roles, including randomly assigning yours. Then, I will simulate the actions of Players 2-6 and let you know what happens each day. Based on your assigned role, you can tell me your actions and I will let you know the corresponding results each day.\n\nBob: Okay, I understand. Let\'s begin. Please assign me a role. Am I the Seer, Werewolf, Villager, or Bodyguard?\n\nAlice: You are the Seer. Now that night has fallen, please choose a player to check his identity.\n\nBob: Tonight, I want to check Player 2 and find out his role.',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1,
|
||||
maxResponseToken: 500,
|
||||
temperature: 1.2,
|
||||
topP: 0.4,
|
||||
presencePenalty: 0.5,
|
||||
frequencyPenalty: 0.5,
|
||||
stop: '\\n\\nBob',
|
||||
injectStart: '\\n\\nAlice: ',
|
||||
injectEnd: '\\n\\nBob: '
|
||||
}
|
||||
}, {
|
||||
name: 'Instruction',
|
||||
prompt: 'Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n# Instruction:\nExplain the following metaphor: Life is like cats.\n\n# Response:\n',
|
||||
params: {
|
||||
maxResponseToken: 500,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
stop: '',
|
||||
injectStart: '',
|
||||
injectEnd: ''
|
||||
}
|
||||
}, {
|
||||
name: 'Blank',
|
||||
prompt: '',
|
||||
params: {
|
||||
maxResponseToken: 4100,
|
||||
maxResponseToken: 500,
|
||||
temperature: 1,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4,
|
||||
stop: ''
|
||||
stop: '',
|
||||
injectStart: '',
|
||||
injectEnd: ''
|
||||
}
|
||||
}];
|
||||
|
||||
@@ -135,11 +178,14 @@ const CompletionPanel: FC = observer(() => {
|
||||
};
|
||||
|
||||
const onSubmit = (prompt: string) => {
|
||||
if (commonStore.status.modelStatus === ModelStatus.Offline) {
|
||||
if (commonStore.status.status === ModelStatus.Offline) {
|
||||
toast(t('Please click the button in the top right corner to start the model'), { type: 'warning' });
|
||||
commonStore.setCompletionGenerating(false);
|
||||
return;
|
||||
}
|
||||
|
||||
prompt += params.injectStart.replaceAll('\\n', '\n');
|
||||
|
||||
let answer = '';
|
||||
sseControllerRef.current = new AbortController();
|
||||
fetchEventSource(`http://127.0.0.1:${port}/completions`, // https://api.openai.com/v1/completions || http://127.0.0.1:${port}/completions
|
||||
@@ -158,7 +204,7 @@ const CompletionPanel: FC = observer(() => {
|
||||
top_p: params.topP,
|
||||
presence_penalty: params.presencePenalty,
|
||||
frequency_penalty: params.frequencyPenalty,
|
||||
stop: params.stop || undefined
|
||||
stop: params.stop.replaceAll('\\n', '\n') || undefined
|
||||
}),
|
||||
signal: sseControllerRef.current?.signal,
|
||||
onmessage(e) {
|
||||
@@ -177,7 +223,7 @@ const CompletionPanel: FC = observer(() => {
|
||||
}
|
||||
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
|
||||
answer += data.choices[0].text;
|
||||
setPrompt(prompt + answer);
|
||||
setPrompt(prompt + answer.trim() + params.injectEnd.replaceAll('\\n', '\n'));
|
||||
}
|
||||
},
|
||||
onclose() {
|
||||
@@ -278,6 +324,26 @@ const CompletionPanel: FC = observer(() => {
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
<Labeled flex breakline label={t('Inject start text')}
|
||||
desc={t('Before the response starts, inject this content.')}
|
||||
content={
|
||||
<Input value={params.injectStart}
|
||||
onChange={(e, data) => {
|
||||
setParams({
|
||||
injectStart: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
<Labeled flex breakline label={t('Inject end text')}
|
||||
desc={t('When response finished, inject this content.')}
|
||||
content={
|
||||
<Input value={params.injectEnd}
|
||||
onChange={(e, data) => {
|
||||
setParams({
|
||||
injectEnd: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
</div>
|
||||
<div className="grow" />
|
||||
<div className="flex justify-between gap-2">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Dropdown, Input, Label, Option, Select, Switch } from '@fluentui/react-components';
|
||||
import { Dropdown, Input, Label, Option, Select, Switch, Text } from '@fluentui/react-components';
|
||||
import { AddCircle20Regular, DataUsageSettings20Regular, Delete20Regular, Save20Regular } from '@fluentui/react-icons';
|
||||
import React, { FC } from 'react';
|
||||
import { Section } from '../components/Section';
|
||||
@@ -14,10 +14,12 @@ import { useNavigate } from 'react-router';
|
||||
import { RunButton } from '../components/RunButton';
|
||||
import { updateConfig } from '../apis';
|
||||
import { ConvertModel, FileExists } from '../../wailsjs/go/backend_golang/App';
|
||||
import manifest from '../../../manifest.json';
|
||||
import { getStrategy, refreshLocalModels } from '../utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { WindowShow } from '../../wailsjs/runtime/runtime';
|
||||
import strategyImg from '../assets/images/strategy.jpg';
|
||||
import strategyZhImg from '../assets/images/strategy_zh.jpg';
|
||||
import { ResetConfigsButton } from '../components/ResetConfigsButton';
|
||||
|
||||
export type ApiParameters = {
|
||||
apiPort: number
|
||||
@@ -28,7 +30,7 @@ export type ApiParameters = {
|
||||
frequencyPenalty: number;
|
||||
}
|
||||
|
||||
export type Device = 'CPU' | 'CUDA';
|
||||
export type Device = 'CPU' | 'CUDA' | 'MPS' | 'Custom';
|
||||
export type Precision = 'fp16' | 'int8' | 'fp32';
|
||||
|
||||
export type ModelParameters = {
|
||||
@@ -40,6 +42,7 @@ export type ModelParameters = {
|
||||
maxStoredLayers: number;
|
||||
enableHighPrecisionForLastLayer: boolean;
|
||||
useCustomCuda?: boolean;
|
||||
customStrategy?: string;
|
||||
}
|
||||
|
||||
export type ModelConfig = {
|
||||
@@ -49,507 +52,11 @@ export type ModelConfig = {
|
||||
modelParameters: ModelParameters
|
||||
}
|
||||
|
||||
export const defaultModelConfigs: ModelConfig[] = [
|
||||
{
|
||||
name: 'GPU-2G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 4,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 24,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230429-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 24,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 8,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 8,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230429-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 18,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 18,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230429-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-10G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-10G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-12G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 22,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-12G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 22,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-16G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-16G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-18G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-32G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-6G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230429-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export const Configs: FC = observer(() => {
|
||||
const { t } = useTranslation();
|
||||
const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex);
|
||||
const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]);
|
||||
const [displayStrategyImg, setDisplayStrategyImg] = React.useState(false);
|
||||
const navigate = useNavigate();
|
||||
const port = selectedConfig.apiParameters.apiPort;
|
||||
|
||||
@@ -618,6 +125,10 @@ export const Configs: FC = observer(() => {
|
||||
commonStore.deleteModelConfig(selectedIndex);
|
||||
updateSelectedIndex(Math.min(selectedIndex, commonStore.modelConfigs.length - 1));
|
||||
}} />
|
||||
<ResetConfigsButton afterConfirm={() => {
|
||||
setSelectedIndex(0);
|
||||
setSelectedConfig(commonStore.modelConfigs[0]);
|
||||
}} />
|
||||
<ToolTipButton desc={t('Save Config')} icon={<Save20Regular />} onClick={onClickSave} />
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
@@ -714,6 +225,10 @@ export const Configs: FC = observer(() => {
|
||||
modelName: data.value
|
||||
});
|
||||
}}>
|
||||
{!commonStore.modelSourceList.find(item => item.name === selectedConfig.modelParameters.modelName)?.isLocal
|
||||
&& <option key={-1}
|
||||
value={selectedConfig.modelParameters.modelName}>{selectedConfig.modelParameters.modelName}
|
||||
</option>}
|
||||
{commonStore.modelSourceList.map((modelItem, index) =>
|
||||
modelItem.isLocal && <option key={index} value={modelItem.name}>{modelItem.name}</option>
|
||||
)}
|
||||
@@ -724,16 +239,28 @@ export const Configs: FC = observer(() => {
|
||||
</div>
|
||||
} />
|
||||
<ToolTipButton text={t('Convert')} desc={t('Convert model with these configs')} onClick={async () => {
|
||||
const modelPath = `${manifest.localModelDir}/${selectedConfig.modelParameters.modelName}`;
|
||||
if (commonStore.platform == 'darwin') {
|
||||
toast(t('MacOS is not yet supported for performing this operation, please do it manually.'), { type: 'info' });
|
||||
return;
|
||||
} else if (commonStore.platform == 'linux') {
|
||||
toast(t('Linux is not yet supported for performing this operation, please do it manually.'), { type: 'info' });
|
||||
return;
|
||||
}
|
||||
|
||||
const modelPath = `${commonStore.settings.customModelsPath}/${selectedConfig.modelParameters.modelName}`;
|
||||
if (await FileExists(modelPath)) {
|
||||
const strategy = getStrategy(selectedConfig);
|
||||
const newModelPath = modelPath + '-' + strategy.replace(/[> *+]/g, '-');
|
||||
const newModelPath = modelPath + '-' + strategy.replace(/[:> *+]/g, '-');
|
||||
toast(t('Start Converting'), { autoClose: 1000, type: 'info' });
|
||||
ConvertModel(modelPath, strategy, newModelPath).then(() => {
|
||||
ConvertModel(commonStore.settings.customPythonPath, modelPath, strategy, newModelPath).then(() => {
|
||||
toast(`${t('Convert Success')} - ${newModelPath}`, { type: 'success' });
|
||||
refreshLocalModels({ models: commonStore.modelSourceList }, false);
|
||||
}).catch(e => {
|
||||
toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
|
||||
const errMsg = e.message || e;
|
||||
if (errMsg.includes('path contains space'))
|
||||
toast(`${t('Convert Failed')} - ${t('Path Cannot Contain Space')}`, { type: 'error' });
|
||||
else
|
||||
toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
|
||||
});
|
||||
setTimeout(WindowShow, 1000);
|
||||
} else {
|
||||
@@ -741,69 +268,108 @@ export const Configs: FC = observer(() => {
|
||||
}
|
||||
}} />
|
||||
<Labeled label={t('Device')} content={
|
||||
<Dropdown style={{ minWidth: 0 }} className="grow" value={selectedConfig.modelParameters.device}
|
||||
<Dropdown style={{ minWidth: 0 }} className="grow" value={t(selectedConfig.modelParameters.device)!}
|
||||
selectedOptions={[selectedConfig.modelParameters.device]}
|
||||
onOptionSelect={(_, data) => {
|
||||
if (data.optionText) {
|
||||
if (data.optionValue) {
|
||||
setSelectedConfigModelParams({
|
||||
device: data.optionText as Device
|
||||
device: data.optionValue as Device
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<Option>CPU</Option>
|
||||
<Option>CUDA</Option>
|
||||
<Option value="CPU">CPU</Option>
|
||||
{commonStore.platform === 'darwin' && <Option value="MPS">MPS</Option>}
|
||||
<Option value="CUDA">CUDA</Option>
|
||||
<Option value="Custom">{t('Custom')!}</Option>
|
||||
</Dropdown>
|
||||
} />
|
||||
<Labeled label={t('Precision')}
|
||||
desc={t('int8 uses less VRAM, but has slightly lower quality. fp16 has higher quality, and fp32 has the best quality.')}
|
||||
content={
|
||||
<Dropdown style={{ minWidth: 0 }} className="grow"
|
||||
value={selectedConfig.modelParameters.precision}
|
||||
selectedOptions={[selectedConfig.modelParameters.precision]}
|
||||
onOptionSelect={(_, data) => {
|
||||
if (data.optionText) {
|
||||
{
|
||||
selectedConfig.modelParameters.device != 'Custom' && <Labeled label={t('Precision')}
|
||||
desc={t('int8 uses less VRAM, but has slightly lower quality. fp16 has higher quality, and fp32 has the best quality.')}
|
||||
content={
|
||||
<Dropdown style={{ minWidth: 0 }} className="grow"
|
||||
value={selectedConfig.modelParameters.precision}
|
||||
selectedOptions={[selectedConfig.modelParameters.precision]}
|
||||
onOptionSelect={(_, data) => {
|
||||
if (data.optionText) {
|
||||
setSelectedConfigModelParams({
|
||||
precision: data.optionText as Precision
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<Option>fp16</Option>
|
||||
<Option>int8</Option>
|
||||
<Option>fp32</Option>
|
||||
</Dropdown>
|
||||
} />
|
||||
}
|
||||
{
|
||||
selectedConfig.modelParameters.device == 'CUDA' &&
|
||||
<Labeled label={t('Current Strategy')}
|
||||
content={<Text> {getStrategy(selectedConfig)} </Text>} />
|
||||
}
|
||||
{
|
||||
selectedConfig.modelParameters.device == 'CUDA' &&
|
||||
<Labeled label={t('Stored Layers')}
|
||||
desc={t('Number of the neural network layers loaded into VRAM, the more you load, the faster the speed, but it consumes more VRAM.')}
|
||||
content={
|
||||
<ValuedSlider value={selectedConfig.modelParameters.storedLayers} min={0}
|
||||
max={selectedConfig.modelParameters.maxStoredLayers} step={1} input
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
precision: data.optionText as Precision
|
||||
storedLayers: data.value
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<Option>fp16</Option>
|
||||
<Option>int8</Option>
|
||||
<Option>fp32</Option>
|
||||
</Dropdown>
|
||||
} />
|
||||
<div />
|
||||
<Labeled label={t('Stored Layers')}
|
||||
desc={t('Number of the neural network layers loaded into VRAM, the more you load, the faster the speed, but it consumes more VRAM.')}
|
||||
content={
|
||||
<ValuedSlider value={selectedConfig.modelParameters.storedLayers} min={0}
|
||||
max={selectedConfig.modelParameters.maxStoredLayers} step={1} input
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
storedLayers: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
<Labeled label={t('Enable High Precision For Last Layer')}
|
||||
desc={t('Whether to use CPU to calculate the last output layer of the neural network with FP32 precision to obtain better quality.')}
|
||||
content={
|
||||
<Switch checked={selectedConfig.modelParameters.enableHighPrecisionForLastLayer}
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
enableHighPrecisionForLastLayer: data.checked
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
<Labeled label={t('Use Custom CUDA kernel to Accelerate')}
|
||||
desc={t('Enabling this option can greatly improve inference speed, but there may be compatibility issues. If it fails to start, please turn off this option.')}
|
||||
content={
|
||||
<Switch checked={selectedConfig.modelParameters.useCustomCuda}
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
useCustomCuda: data.checked
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
{
|
||||
selectedConfig.modelParameters.device == 'CUDA' &&
|
||||
<Labeled label={t('Enable High Precision For Last Layer')}
|
||||
desc={t('Whether to use CPU to calculate the last output layer of the neural network with FP32 precision to obtain better quality.')}
|
||||
content={
|
||||
<Switch checked={selectedConfig.modelParameters.enableHighPrecisionForLastLayer}
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
enableHighPrecisionForLastLayer: data.checked
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
{
|
||||
displayStrategyImg &&
|
||||
<img style={{ width: '80vh', height: 'auto', zIndex: 100 }} className="fixed left-0 top-0"
|
||||
src={commonStore.settings.language === 'zh' ? strategyZhImg : strategyImg} />
|
||||
}
|
||||
{
|
||||
selectedConfig.modelParameters.device == 'Custom' &&
|
||||
<Labeled label="Strategy"
|
||||
onMouseEnter={() => setDisplayStrategyImg(true)}
|
||||
onMouseLeave={() => setDisplayStrategyImg(false)}
|
||||
content={
|
||||
<Input className="grow"
|
||||
placeholder={commonStore.platform != 'darwin' ? 'cuda:0 fp16 *20 -> cuda:1 fp16' : 'mps fp32'}
|
||||
value={selectedConfig.modelParameters.customStrategy}
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
customStrategy: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
{selectedConfig.modelParameters.device == 'Custom' && <div />}
|
||||
{
|
||||
selectedConfig.modelParameters.device != 'CPU' && selectedConfig.modelParameters.device != 'MPS' &&
|
||||
<Labeled label={t('Use Custom CUDA kernel to Accelerate')}
|
||||
desc={t('Enabling this option can greatly improve inference speed, but there may be compatibility issues. If it fails to start, please turn off this option.')}
|
||||
content={
|
||||
<Switch checked={selectedConfig.modelParameters.useCustomCuda}
|
||||
onChange={(e, data) => {
|
||||
setSelectedConfigModelParams({
|
||||
useCustomCuda: data.checked
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -53,7 +53,7 @@ export const Downloads: FC = observer(() => {
|
||||
<div className="flex items-center gap-2">
|
||||
<ProgressBar className="grow" value={status.progress} max={100} />
|
||||
{!status.done &&
|
||||
<ToolTipButton desc={status.downloading ? t('Pause') : t('Continue')}
|
||||
<ToolTipButton desc={status.downloading ? t('Pause') : t('Resume')}
|
||||
icon={status.downloading ? <Pause20Regular /> : <Play20Regular />}
|
||||
onClick={() => {
|
||||
if (status.downloading)
|
||||
@@ -62,7 +62,7 @@ export const Downloads: FC = observer(() => {
|
||||
ContinueDownload(status.url);
|
||||
}} />}
|
||||
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
|
||||
OpenFileFolder(status.path);
|
||||
OpenFileFolder(`${commonStore.settings.customModelsPath}/${status.name}`);
|
||||
}} />
|
||||
</div>
|
||||
</Field>
|
||||
|
||||
@@ -3,9 +3,9 @@ import React, { FC, ReactElement } from 'react';
|
||||
import banner from '../assets/images/banner.jpg';
|
||||
import {
|
||||
Chat20Regular,
|
||||
ClipboardEdit20Regular,
|
||||
DataUsageSettings20Regular,
|
||||
DocumentSettings20Regular,
|
||||
Storage20Regular
|
||||
DocumentSettings20Regular
|
||||
} from '@fluentui/react-icons';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
@@ -16,6 +16,8 @@ import { useTranslation } from 'react-i18next';
|
||||
import { ConfigSelector } from '../components/ConfigSelector';
|
||||
import MarkdownRender from '../components/MarkdownRender';
|
||||
import commonStore from '../stores/commonStore';
|
||||
import { Completion } from './Completion';
|
||||
import { ResetConfigsButton } from '../components/ResetConfigsButton';
|
||||
|
||||
export type IntroductionContent = { [lang: string]: string }
|
||||
|
||||
@@ -33,6 +35,12 @@ const navCards: NavCard[] = [
|
||||
path: '/chat',
|
||||
icon: <Chat20Regular />
|
||||
},
|
||||
{
|
||||
label: 'Completion',
|
||||
desc: 'Writer, Translator, Role-playing',
|
||||
path: '/completion',
|
||||
icon: <ClipboardEdit20Regular />
|
||||
},
|
||||
{
|
||||
label: 'Configs',
|
||||
desc: 'Manage your configs',
|
||||
@@ -44,12 +52,6 @@ const navCards: NavCard[] = [
|
||||
desc: 'Manage models',
|
||||
path: '/models',
|
||||
icon: <DataUsageSettings20Regular />
|
||||
},
|
||||
{
|
||||
label: 'Train',
|
||||
desc: '',
|
||||
path: '/train',
|
||||
icon: <Storage20Regular />
|
||||
}
|
||||
];
|
||||
|
||||
@@ -64,7 +66,8 @@ export const Home: FC = observer(() => {
|
||||
|
||||
return (
|
||||
<div className="flex flex-col justify-between h-full">
|
||||
<img className="rounded-xl select-none hidden sm:block" src={banner} />
|
||||
<img className="rounded-xl select-none hidden sm:block"
|
||||
style={{ maxHeight: '40%', margin: '0 auto' }} src={banner} />
|
||||
<div className="flex flex-col gap-2">
|
||||
<Text size={600} weight="medium">{t('Introduction')}</Text>
|
||||
<div className="h-40 overflow-y-auto overflow-x-hidden p-1">
|
||||
@@ -84,6 +87,7 @@ export const Home: FC = observer(() => {
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex flex-row-reverse sm:fixed bottom-2 right-2">
|
||||
<div className="flex gap-3">
|
||||
<ResetConfigsButton />
|
||||
<ConfigSelector />
|
||||
<RunButton />
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,6 @@ import { observer } from 'mobx-react-lite';
|
||||
import commonStore from '../stores/commonStore';
|
||||
import { BrowserOpenURL } from '../../wailsjs/runtime';
|
||||
import { AddToDownloadList, OpenFileFolder } from '../../wailsjs/go/backend_golang/App';
|
||||
import manifest from '../../../manifest.json';
|
||||
import { Page } from '../components/Page';
|
||||
import { bytesToGb, refreshModels, saveConfigs, toastWithButton } from '../utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -34,6 +33,7 @@ export type ModelSourceItem = {
|
||||
downloadUrl?: string;
|
||||
isLocal?: boolean;
|
||||
lastUpdatedMs?: number;
|
||||
hide?: boolean;
|
||||
};
|
||||
|
||||
const columns: TableColumnDefinition<ModelSourceItem>[] = [
|
||||
@@ -142,7 +142,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
|
||||
{
|
||||
item.isLocal &&
|
||||
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
|
||||
OpenFileFolder(`./${manifest.localModelDir}/${item.name}`);
|
||||
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`);
|
||||
}} />
|
||||
}
|
||||
{item.downloadUrl && !item.isLocal &&
|
||||
@@ -151,7 +151,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
|
||||
navigate({ pathname: '/downloads' });
|
||||
},
|
||||
{ autoClose: 3000 });
|
||||
AddToDownloadList(`./${manifest.localModelDir}/${item.name}`, item.downloadUrl!);
|
||||
AddToDownloadList(`${commonStore.settings.customModelsPath}/${item.name}`, item.downloadUrl!);
|
||||
}} />}
|
||||
{item.url && <ToolTipButton desc={t('Open Url')} icon={<Open20Regular />} onClick={() => {
|
||||
BrowserOpenURL(item.url!);
|
||||
@@ -203,6 +203,7 @@ export const Models: FC = observer(() => {
|
||||
<div className="overflow-y-auto overflow-x-hidden">
|
||||
<DataGridBody<ModelSourceItem>>
|
||||
{({ item, rowId }) => (
|
||||
(!item.hide || item.isLocal) &&
|
||||
<DataGridRow<ModelSourceItem> key={rowId}>
|
||||
{({ renderCell }) => (
|
||||
<DataGridCell>{renderCell(item)}</DataGridCell>
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import React, { FC } from 'react';
|
||||
import React, { FC, useEffect, useRef } from 'react';
|
||||
import { Page } from '../components/Page';
|
||||
import { Dropdown, Input, Option, Switch } from '@fluentui/react-components';
|
||||
import {
|
||||
Accordion,
|
||||
AccordionHeader,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
Dropdown,
|
||||
Input,
|
||||
Option,
|
||||
Switch
|
||||
} from '@fluentui/react-components';
|
||||
import { Labeled } from '../components/Labeled';
|
||||
import commonStore from '../stores/commonStore';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
@@ -15,16 +24,24 @@ export const Languages = {
|
||||
export type Language = keyof typeof Languages;
|
||||
|
||||
export type SettingsType = {
|
||||
language: Language,
|
||||
language: Language
|
||||
darkMode: boolean
|
||||
autoUpdatesCheck: boolean
|
||||
giteeUpdatesSource: boolean
|
||||
cnMirror: boolean
|
||||
host: string
|
||||
customModelsPath: string
|
||||
customPythonPath: string
|
||||
}
|
||||
|
||||
export const Settings: FC = observer(() => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const advancedHeaderRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (advancedHeaderRef.current)
|
||||
(advancedHeaderRef.current.firstElementChild as HTMLElement).style.padding = '0';
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Page title={t('Settings')} content={
|
||||
@@ -78,7 +95,7 @@ export const Settings: FC = observer(() => {
|
||||
} />
|
||||
}
|
||||
{
|
||||
commonStore.settings.language === 'zh' &&
|
||||
commonStore.settings.language === 'zh' && commonStore.platform != 'linux' &&
|
||||
<Labeled label={t('Use Tsinghua Pip Mirrors')} flex spaceBetween content={
|
||||
<Switch checked={commonStore.settings.cnMirror}
|
||||
onChange={(e, data) => {
|
||||
@@ -88,14 +105,43 @@ export const Settings: FC = observer(() => {
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
<Labeled label={t('API Host')} flex spaceBetween content={
|
||||
<Input value={commonStore.settings.host}
|
||||
<Labeled label={t('Allow external access to the API (service must be restarted)')} flex spaceBetween content={
|
||||
<Switch checked={commonStore.settings.host !== '127.0.0.1'}
|
||||
onChange={(e, data) => {
|
||||
commonStore.setSettings({
|
||||
host: data.value
|
||||
host: data.checked ? '0.0.0.0' : '127.0.0.1'
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
<Accordion collapsible>
|
||||
<AccordionItem value="1">
|
||||
<AccordionHeader ref={advancedHeaderRef} size="large">{t('Advanced')}</AccordionHeader>
|
||||
<AccordionPanel>
|
||||
<div className="flex flex-col gap-2 overflow-hidden">
|
||||
{commonStore.platform !== 'darwin' &&
|
||||
<Labeled label={t('Custom Models Path')}
|
||||
content={
|
||||
<Input className="grow" placeholder="./models" value={commonStore.settings.customModelsPath}
|
||||
onChange={(e, data) => {
|
||||
commonStore.setSettings({
|
||||
customModelsPath: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
}
|
||||
<Labeled label={t('Custom Python Path')} // if set, will not use precompiled cuda kernel
|
||||
content={
|
||||
<Input className="grow" placeholder="./py310/python" value={commonStore.settings.customPythonPath}
|
||||
onChange={(e, data) => {
|
||||
commonStore.setSettings({
|
||||
customPythonPath: data.value
|
||||
});
|
||||
}} />
|
||||
} />
|
||||
</div>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
} />
|
||||
);
|
||||
|
||||
720
frontend/src/pages/defaultModelConfigs.ts
Normal file
@@ -0,0 +1,720 @@
|
||||
import { ModelConfig } from './Configs';
|
||||
|
||||
export const defaultModelConfigsMac: ModelConfig[] = [
|
||||
{
|
||||
name: 'MAC-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'MPS',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: false,
|
||||
customStrategy: 'mps fp32'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'MAC-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'MPS',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: false,
|
||||
customStrategy: 'mps fp32'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'MAC-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'MPS',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: false,
|
||||
customStrategy: 'mps fp32'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-6G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export const defaultModelConfigs: ModelConfig[] = [
|
||||
{
|
||||
name: 'GPU-2G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 4,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 24,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 24,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 8,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-4G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 8,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 18,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-6G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 18,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: true,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 27,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-8G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 27,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-10G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-10G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-12G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 24,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-16G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-16G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-16G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 37,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-18G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'int8',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'GPU-32G-14B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth',
|
||||
device: 'CUDA',
|
||||
precision: 'fp16',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false,
|
||||
useCustomCuda: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-6G-1B5-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-12G-3B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-EN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'CPU-28G-7B-CN',
|
||||
apiParameters: {
|
||||
apiPort: 8000,
|
||||
maxResponseToken: 4100,
|
||||
temperature: 1.2,
|
||||
topP: 0.5,
|
||||
presencePenalty: 0.4,
|
||||
frequencyPenalty: 0.4
|
||||
},
|
||||
modelParameters: {
|
||||
modelName: 'RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth',
|
||||
device: 'CPU',
|
||||
precision: 'fp32',
|
||||
storedLayers: 41,
|
||||
maxStoredLayers: 41,
|
||||
enableHighPrecisionForLastLayer: false
|
||||
}
|
||||
}
|
||||
];
|
||||
@@ -1,38 +1,27 @@
|
||||
import commonStore from './stores/commonStore';
|
||||
import { FileExists, ReadJson } from '../wailsjs/go/backend_golang/App';
|
||||
import {
|
||||
Cache,
|
||||
checkUpdate,
|
||||
downloadProgramFiles,
|
||||
forceDownloadProgramFiles,
|
||||
LocalConfig,
|
||||
refreshModels,
|
||||
saveCache
|
||||
} from './utils';
|
||||
import commonStore, { Platform } from './stores/commonStore';
|
||||
import { GetPlatform, ReadJson } from '../wailsjs/go/backend_golang/App';
|
||||
import { Cache, checkUpdate, downloadProgramFiles, LocalConfig, refreshModels } from './utils';
|
||||
import { getStatus } from './apis';
|
||||
import { EventsOn } from '../wailsjs/runtime';
|
||||
import { defaultModelConfigs } from './pages/Configs';
|
||||
import manifest from '../../manifest.json';
|
||||
import { defaultModelConfigs, defaultModelConfigsMac } from './pages/defaultModelConfigs';
|
||||
|
||||
export async function startup() {
|
||||
FileExists('cache.json').then((exists) => {
|
||||
if (exists)
|
||||
downloadProgramFiles();
|
||||
else
|
||||
forceDownloadProgramFiles();
|
||||
});
|
||||
downloadProgramFiles();
|
||||
EventsOn('downloadList', (data) => {
|
||||
if (data)
|
||||
commonStore.setDownloadList(data);
|
||||
});
|
||||
|
||||
initCache().then(initRemoteText);
|
||||
|
||||
await GetPlatform().then(p => commonStore.setPlatform(p as Platform));
|
||||
await initConfig();
|
||||
|
||||
initCache().then(initRemoteText); // depends on config customModelsPath
|
||||
|
||||
if (commonStore.settings.autoUpdatesCheck) // depends on config settings
|
||||
checkUpdate();
|
||||
|
||||
getStatus(500).then(status => { // depends on config api port
|
||||
getStatus(1000).then(status => { // depends on config api port
|
||||
if (status)
|
||||
commonStore.setStatus(status);
|
||||
});
|
||||
@@ -41,11 +30,13 @@ export async function startup() {
|
||||
async function initRemoteText() {
|
||||
await fetch('https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/manifest.json', { cache: 'no-cache' })
|
||||
.then(r => r.json()).then((data) => {
|
||||
if (data.introduction)
|
||||
commonStore.setIntroduction(data.introduction);
|
||||
if (data.about)
|
||||
commonStore.setAbout(data.about);
|
||||
}).then(saveCache);
|
||||
if (data.version > manifest.version) {
|
||||
if (data.introduction)
|
||||
commonStore.setIntroduction(data.introduction);
|
||||
if (data.about)
|
||||
commonStore.setAbout(data.about);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function initConfig() {
|
||||
@@ -63,16 +54,12 @@ async function initConfig() {
|
||||
configData.currentModelConfigIndex >= 0 && configData.currentModelConfigIndex < configData.modelConfigs.length)
|
||||
commonStore.setCurrentConfigIndex(configData.currentModelConfigIndex, false);
|
||||
}).catch(() => {
|
||||
commonStore.setModelConfigs(defaultModelConfigs, true);
|
||||
commonStore.setModelConfigs(commonStore.platform != 'darwin' ? defaultModelConfigs : defaultModelConfigsMac, true);
|
||||
});
|
||||
}
|
||||
|
||||
async function initCache() {
|
||||
await ReadJson('cache.json').then((cacheData: Cache) => {
|
||||
if (cacheData.introduction)
|
||||
commonStore.setIntroduction(cacheData.introduction);
|
||||
if (cacheData.about)
|
||||
commonStore.setAbout(cacheData.about);
|
||||
if (cacheData.depComplete)
|
||||
commonStore.setDepComplete(cacheData.depComplete);
|
||||
}).catch(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { makeAutoObservable } from 'mobx';
|
||||
import { getUserLanguage, isSystemLightMode, saveConfigs } from '../utils';
|
||||
import { WindowSetDarkTheme, WindowSetLightTheme } from '../../wailsjs/runtime';
|
||||
import manifest from '../../../manifest.json';
|
||||
import { defaultModelConfigs, ModelConfig } from '../pages/Configs';
|
||||
import { ModelConfig } from '../pages/Configs';
|
||||
import { Conversations } from '../pages/Chat';
|
||||
import { ModelSourceItem } from '../pages/Models';
|
||||
import { DownloadStatus } from '../pages/Downloads';
|
||||
@@ -11,6 +11,8 @@ import { IntroductionContent } from '../pages/Home';
|
||||
import { AboutContent } from '../pages/About';
|
||||
import i18n from 'i18next';
|
||||
import { CompletionPreset } from '../pages/Completion';
|
||||
import { defaultModelConfigs, defaultModelConfigsMac } from '../pages/defaultModelConfigs';
|
||||
import commonStore from './commonStore';
|
||||
|
||||
export enum ModelStatus {
|
||||
Offline,
|
||||
@@ -20,19 +22,22 @@ export enum ModelStatus {
|
||||
}
|
||||
|
||||
export type Status = {
|
||||
modelStatus: ModelStatus;
|
||||
status: ModelStatus;
|
||||
pid: number;
|
||||
device_name: string;
|
||||
}
|
||||
|
||||
export type Platform = 'windows' | 'darwin' | 'linux';
|
||||
|
||||
class CommonStore {
|
||||
// global
|
||||
status: Status = {
|
||||
modelStatus: ModelStatus.Offline,
|
||||
status: ModelStatus.Offline,
|
||||
pid: 0,
|
||||
device_name: 'CPU'
|
||||
};
|
||||
depComplete: boolean = false;
|
||||
platform: Platform = 'windows';
|
||||
// home
|
||||
introduction: IntroductionContent = manifest.introduction;
|
||||
// chat
|
||||
@@ -56,7 +61,9 @@ class CommonStore {
|
||||
autoUpdatesCheck: true,
|
||||
giteeUpdatesSource: getUserLanguage() === 'zh',
|
||||
cnMirror: getUserLanguage() === 'zh',
|
||||
host: '127.0.0.1'
|
||||
host: '127.0.0.1',
|
||||
customModelsPath: './models',
|
||||
customPythonPath: ''
|
||||
};
|
||||
// about
|
||||
about: AboutContent = manifest.about;
|
||||
@@ -86,14 +93,17 @@ class CommonStore {
|
||||
};
|
||||
|
||||
setModelConfigs = (configs: ModelConfig[], saveConfig: boolean = true) => {
|
||||
this.modelConfigs = configs;
|
||||
this.modelConfigs = JSON.parse(JSON.stringify(configs)); // deep copy
|
||||
if (saveConfig)
|
||||
saveConfigs();
|
||||
};
|
||||
|
||||
createModelConfig = (config: ModelConfig = defaultModelConfigs[0], saveConfig: boolean = true) => {
|
||||
if (config.name === defaultModelConfigs[0].name)
|
||||
if (config.name === defaultModelConfigs[0].name) {
|
||||
// deep copy
|
||||
config = JSON.parse(JSON.stringify(commonStore.platform != 'darwin' ? defaultModelConfigs[0] : defaultModelConfigsMac[0]));
|
||||
config.name = new Date().toLocaleString();
|
||||
}
|
||||
this.modelConfigs.push(config);
|
||||
if (saveConfig)
|
||||
saveConfigs();
|
||||
@@ -168,6 +178,10 @@ class CommonStore {
|
||||
setCompletionGenerating(value: boolean) {
|
||||
this.completionGenerating = value;
|
||||
}
|
||||
|
||||
setPlatform(value: Platform) {
|
||||
this.platform = value;
|
||||
}
|
||||
}
|
||||
|
||||
export default new CommonStore();
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
AddToDownloadList,
|
||||
DeleteFile,
|
||||
FileExists,
|
||||
ListDirFiles,
|
||||
ReadFileInfo,
|
||||
ReadJson,
|
||||
SaveJson,
|
||||
UpdateApp
|
||||
@@ -16,13 +16,10 @@ import { Button } from '@fluentui/react-components';
|
||||
import { Language, Languages, SettingsType } from '../pages/Settings';
|
||||
import { ModelSourceItem } from '../pages/Models';
|
||||
import { ModelConfig, ModelParameters } from '../pages/Configs';
|
||||
import { IntroductionContent } from '../pages/Home';
|
||||
import { AboutContent } from '../pages/About';
|
||||
import { BrowserOpenURL } from '../../wailsjs/runtime';
|
||||
|
||||
export type Cache = {
|
||||
models: ModelSourceItem[]
|
||||
introduction: IntroductionContent,
|
||||
about: AboutContent
|
||||
depComplete: boolean
|
||||
}
|
||||
|
||||
@@ -55,7 +52,7 @@ export async function refreshLocalModels(cache: { models: ModelSourceItem[] }, f
|
||||
if (filter)
|
||||
cache.models = cache.models.filter(m => !m.isLocal); //TODO BUG cause local but in manifest files to be removed, so currently cache is disabled
|
||||
|
||||
await ListDirFiles(manifest.localModelDir).then((data) => {
|
||||
await ListDirFiles(commonStore.settings.customModelsPath).then((data) => {
|
||||
cache.models.push(...data.flatMap(d => {
|
||||
if (!d.isDir && d.name.endsWith('.pth'))
|
||||
return [{
|
||||
@@ -113,7 +110,7 @@ export async function refreshRemoteModels(cache: { models: ModelSourceItem[] })
|
||||
cache.models = cache.models.filter((model, index, self) => {
|
||||
return model.name.endsWith('.pth')
|
||||
&& index === self.findIndex(
|
||||
m => m.name === model.name || (m.SHA256 === model.SHA256 && m.size === model.size));
|
||||
m => m.name === model.name || (m.SHA256 && m.SHA256 === model.SHA256 && m.size === model.size));
|
||||
});
|
||||
commonStore.setModelSourceList(cache.models);
|
||||
await saveCache().catch(() => {
|
||||
@@ -131,12 +128,27 @@ export const getStrategy = (modelConfig: ModelConfig | undefined = undefined) =>
|
||||
if (modelConfig) params = modelConfig.modelParameters;
|
||||
else params = commonStore.getCurrentModelConfig().modelParameters;
|
||||
let strategy = '';
|
||||
strategy += (params.device === 'CPU' ? 'cpu' : 'cuda') + ' ';
|
||||
strategy += params.device === 'CPU' ? 'fp32' : (params.precision === 'fp16' ? 'fp16' : params.precision === 'int8' ? 'fp16i8' : 'fp32');
|
||||
if (params.storedLayers < params.maxStoredLayers)
|
||||
strategy += ` *${params.storedLayers}+`;
|
||||
if (params.enableHighPrecisionForLastLayer)
|
||||
strategy += ' -> cpu fp32 *1';
|
||||
switch (params.device) {
|
||||
case 'CPU':
|
||||
strategy += 'cpu ';
|
||||
strategy += params.precision === 'int8' ? 'fp32i8' : 'fp32';
|
||||
break;
|
||||
case 'CUDA':
|
||||
strategy += 'cuda ';
|
||||
strategy += params.precision === 'fp16' ? 'fp16' : params.precision === 'int8' ? 'fp16i8' : 'fp32';
|
||||
if (params.storedLayers < params.maxStoredLayers)
|
||||
strategy += ` *${params.storedLayers}+`;
|
||||
if (params.enableHighPrecisionForLastLayer)
|
||||
strategy += ' -> cpu fp32 *1';
|
||||
break;
|
||||
case 'MPS':
|
||||
strategy += 'mps ';
|
||||
strategy += params.precision === 'fp16' ? 'fp16' : params.precision === 'int8' ? 'fp16i8' : 'fp32';
|
||||
break;
|
||||
case 'Custom':
|
||||
strategy = params.customStrategy || '';
|
||||
break;
|
||||
}
|
||||
return strategy;
|
||||
};
|
||||
|
||||
@@ -153,8 +165,6 @@ export const saveConfigs = async () => {
|
||||
export const saveCache = async () => {
|
||||
const data: Cache = {
|
||||
models: commonStore.modelSourceList,
|
||||
introduction: commonStore.introduction,
|
||||
about: commonStore.about,
|
||||
depComplete: commonStore.depComplete
|
||||
};
|
||||
return SaveJson('cache.json', data);
|
||||
@@ -175,16 +185,31 @@ export function isSystemLightMode() {
|
||||
|
||||
export function downloadProgramFiles() {
|
||||
manifest.programFiles.forEach(({ url, path }) => {
|
||||
FileExists(path).then(exists => {
|
||||
if (!exists)
|
||||
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||
});
|
||||
if (path)
|
||||
ReadFileInfo(path).then(info => {
|
||||
if (info.size == 0 && url)
|
||||
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||
}).catch(() => {
|
||||
if (url)
|
||||
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function forceDownloadProgramFiles() {
|
||||
manifest.programFiles.forEach(({ url, path }) => {
|
||||
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||
if (path && url)
|
||||
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteDynamicProgramFiles() {
|
||||
let promises: Promise<void>[] = [];
|
||||
manifest.programFiles.forEach(({ path }) => {
|
||||
if ((path.endsWith('.py') && !path.includes('get-pip.py')) || path.includes('requirements') || path.endsWith('.pyd'))
|
||||
promises.push(DeleteFile(path));
|
||||
});
|
||||
return await Promise.allSettled(promises).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
@@ -201,8 +226,7 @@ export function bytesToKb(size: number) {
|
||||
}
|
||||
|
||||
export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
||||
let updateUrl = '';
|
||||
await fetch(!commonStore.settings.giteeUpdatesSource ?
|
||||
fetch(!commonStore.settings.giteeUpdatesSource ?
|
||||
'https://api.github.com/repos/josstorer/RWKV-Runner/releases/latest' :
|
||||
'https://gitee.com/api/v5/repos/josc146/RWKV-Runner/releases/latest'
|
||||
).then((r) => {
|
||||
@@ -211,28 +235,49 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
||||
if (data.tag_name) {
|
||||
const versionTag = data.tag_name;
|
||||
if (versionTag.replace('v', '') > manifest.version) {
|
||||
updateUrl = !commonStore.settings.giteeUpdatesSource ?
|
||||
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe` :
|
||||
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||
DeleteFile('cache.json');
|
||||
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
||||
type: 'info',
|
||||
position: 'bottom-left',
|
||||
autoClose: 10000
|
||||
});
|
||||
setTimeout(() => {
|
||||
UpdateApp(updateUrl).catch((e) => {
|
||||
toast(t('Update Error') + ' - ' + e.message || e, {
|
||||
type: 'error',
|
||||
position: 'bottom-left',
|
||||
autoClose: false
|
||||
});
|
||||
const verifyUrl = !commonStore.settings.giteeUpdatesSource ?
|
||||
`https://api.github.com/repos/josstorer/RWKV-Runner/releases/tags/${versionTag}` :
|
||||
`https://gitee.com/api/v5/repos/josc146/RWKV-Runner/releases/tags/${versionTag}`;
|
||||
|
||||
fetch(verifyUrl).then((r) => {
|
||||
if (r.ok) {
|
||||
r.json().then((data) => {
|
||||
if (data.assets && data.assets.length > 0) {
|
||||
const asset = data.assets.find((a: any) => a.name.toLowerCase().includes(commonStore.platform.toLowerCase()));
|
||||
if (asset) {
|
||||
const updateUrl = !commonStore.settings.giteeUpdatesSource ?
|
||||
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/${asset.name}` :
|
||||
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/${asset.name}`;
|
||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||
DeleteFile('cache.json');
|
||||
if (commonStore.platform != 'darwin') {
|
||||
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
||||
type: 'info',
|
||||
position: 'bottom-left',
|
||||
autoClose: 20000
|
||||
});
|
||||
setTimeout(() => {
|
||||
UpdateApp(updateUrl).catch((e) => {
|
||||
toast(t('Update Error') + ' - ' + e.message || e, {
|
||||
type: 'error',
|
||||
position: 'bottom-left',
|
||||
autoClose: false
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
} else {
|
||||
BrowserOpenURL(updateUrl);
|
||||
}
|
||||
}, {
|
||||
autoClose: false,
|
||||
position: 'bottom-left'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}, {
|
||||
autoClose: false,
|
||||
position: 'bottom-left'
|
||||
} else {
|
||||
throw new Error('Verify response was not ok.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (notifyEvenLatest) {
|
||||
@@ -250,7 +295,6 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
||||
).catch((e) => {
|
||||
toast(t('Updates Check Error') + ' - ' + e.message || e, { type: 'error', position: 'bottom-left' });
|
||||
});
|
||||
return updateUrl;
|
||||
}
|
||||
|
||||
export function toastWithButton(text: string, buttonText: string, onClickButton: () => void, options?: ToastOptions) {
|
||||
@@ -274,9 +318,9 @@ export function toastWithButton(text: string, buttonText: string, onClickButton:
|
||||
}
|
||||
|
||||
export function getSupportedCustomCudaFile() {
|
||||
if ([' 10', ' 16', ' 20', ' 30'].some(v => commonStore.status.device_name.includes(v)))
|
||||
if ([' 10', ' 16', ' 20', ' 30', 'MX', 'Tesla P', 'Quadro P', 'NVIDIA P', 'TITAN X', 'TITAN RTX', 'RTX A'].some(v => commonStore.status.device_name.includes(v)))
|
||||
return './backend-python/wkv_cuda_utils/wkv_cuda10_30.pyd';
|
||||
else if ([' 40'].some(v => commonStore.status.device_name.includes(v)))
|
||||
else if ([' 40', 'RTX TITAN Ada'].some(v => commonStore.status.device_name.includes(v)))
|
||||
return './backend-python/wkv_cuda_utils/wkv_cuda40.pyd';
|
||||
else
|
||||
return '';
|
||||
|
||||
8
frontend/wailsjs/go/backend_golang/App.d.ts
generated
vendored
Normal file → Executable file
@@ -6,13 +6,13 @@ export function AddToDownloadList(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function ContinueDownload(arg1:string):Promise<void>;
|
||||
|
||||
export function ConvertModel(arg1:string,arg2:string,arg3:string):Promise<string>;
|
||||
export function ConvertModel(arg1:string,arg2:string,arg3:string,arg4:string):Promise<string>;
|
||||
|
||||
export function CopyFile(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function DeleteFile(arg1:string):Promise<void>;
|
||||
|
||||
export function DepCheck():Promise<void>;
|
||||
export function DepCheck(arg1:string):Promise<void>;
|
||||
|
||||
export function DownloadFile(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
@@ -20,7 +20,7 @@ export function FileExists(arg1:string):Promise<boolean>;
|
||||
|
||||
export function GetPlatform():Promise<string>;
|
||||
|
||||
export function InstallPyDep(arg1:boolean):Promise<string>;
|
||||
export function InstallPyDep(arg1:string,arg2:boolean):Promise<string>;
|
||||
|
||||
export function ListDirFiles(arg1:string):Promise<Array<backend_golang.FileInfo>>;
|
||||
|
||||
@@ -34,6 +34,6 @@ export function ReadJson(arg1:string):Promise<any>;
|
||||
|
||||
export function SaveJson(arg1:string,arg2:any):Promise<void>;
|
||||
|
||||
export function StartServer(arg1:number,arg2:string):Promise<string>;
|
||||
export function StartServer(arg1:string,arg2:number,arg3:string):Promise<string>;
|
||||
|
||||
export function UpdateApp(arg1:string):Promise<boolean>;
|
||||
|
||||
16
frontend/wailsjs/go/backend_golang/App.js
generated
Normal file → Executable file
@@ -10,8 +10,8 @@ export function ContinueDownload(arg1) {
|
||||
return window['go']['backend_golang']['App']['ContinueDownload'](arg1);
|
||||
}
|
||||
|
||||
export function ConvertModel(arg1, arg2, arg3) {
|
||||
return window['go']['backend_golang']['App']['ConvertModel'](arg1, arg2, arg3);
|
||||
export function ConvertModel(arg1, arg2, arg3, arg4) {
|
||||
return window['go']['backend_golang']['App']['ConvertModel'](arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
export function CopyFile(arg1, arg2) {
|
||||
@@ -22,8 +22,8 @@ export function DeleteFile(arg1) {
|
||||
return window['go']['backend_golang']['App']['DeleteFile'](arg1);
|
||||
}
|
||||
|
||||
export function DepCheck() {
|
||||
return window['go']['backend_golang']['App']['DepCheck']();
|
||||
export function DepCheck(arg1) {
|
||||
return window['go']['backend_golang']['App']['DepCheck'](arg1);
|
||||
}
|
||||
|
||||
export function DownloadFile(arg1, arg2) {
|
||||
@@ -38,8 +38,8 @@ export function GetPlatform() {
|
||||
return window['go']['backend_golang']['App']['GetPlatform']();
|
||||
}
|
||||
|
||||
export function InstallPyDep(arg1) {
|
||||
return window['go']['backend_golang']['App']['InstallPyDep'](arg1);
|
||||
export function InstallPyDep(arg1, arg2) {
|
||||
return window['go']['backend_golang']['App']['InstallPyDep'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ListDirFiles(arg1) {
|
||||
@@ -66,8 +66,8 @@ export function SaveJson(arg1, arg2) {
|
||||
return window['go']['backend_golang']['App']['SaveJson'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function StartServer(arg1, arg2) {
|
||||
return window['go']['backend_golang']['App']['StartServer'](arg1, arg2);
|
||||
export function StartServer(arg1, arg2, arg3) {
|
||||
return window['go']['backend_golang']['App']['StartServer'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function UpdateApp(arg1) {
|
||||
|
||||
0
frontend/wailsjs/go/models.ts
generated
Normal file → Executable file
19
main.go
@@ -2,6 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
backend "rwkv-runner/backend-golang"
|
||||
|
||||
@@ -13,7 +15,22 @@ import (
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
//go:embed all:py310/Lib/site-packages/cyac
|
||||
var cyac embed.FS
|
||||
|
||||
//go:embed all:py310/Lib/site-packages/cyac-1.7.dist-info
|
||||
var cyacInfo embed.FS
|
||||
|
||||
//go:embed backend-python
|
||||
var py embed.FS
|
||||
|
||||
func main() {
|
||||
if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") {
|
||||
backend.CopyEmbed(cyac)
|
||||
backend.CopyEmbed(cyacInfo)
|
||||
backend.CopyEmbed(py)
|
||||
}
|
||||
|
||||
// Create an instance of the app structure
|
||||
app := backend.NewApp()
|
||||
|
||||
@@ -21,7 +38,7 @@ func main() {
|
||||
err := wails.Run(&options.App{
|
||||
Title: "RWKV-Runner",
|
||||
Width: 1024,
|
||||
Height: 640,
|
||||
Height: 680,
|
||||
MinWidth: 375,
|
||||
MinHeight: 640,
|
||||
AssetServer: &assetserver.Options{
|
||||
|
||||
277
manifest.json
@@ -1,81 +1,32 @@
|
||||
{
|
||||
"version": "1.0.5",
|
||||
"version": "1.1.9",
|
||||
"introduction": {
|
||||
"en": "RWKV is an open-source, commercially usable large language model with high flexibility and great potential for development.\n### About This Tool\nThis tool aims to lower the barrier of entry for using large language models, making it accessible to everyone. It provides fully automated dependency and model management. You simply need to click and run, following the instructions, to deploy a local large language model. The tool itself is very compact and only requires a single executable file for one-click deployment.\nAdditionally, this tool offers an interface that is fully compatible with the OpenAI API. This means you can use any ChatGPT client as a client for RWKV, enabling capability expansion beyond just chat functionality.\n### Preset Configuration Rules at the Bottom\nThis tool comes with a series of preset configurations to reduce complexity. The naming rules for each configuration represent the following in order: device - required VRAM/memory - model size - model language.\nFor example, \"GPU-8G-3B-EN\" indicates that this configuration is for a graphics card with 8GB of VRAM, a model size of 3 billion parameters, and it uses an English language model.\nLarger model sizes have higher performance and VRAM requirements. Among configurations with the same model size, those with higher VRAM usage will have faster runtime.\nFor example, if you have 12GB of VRAM but running the \"GPU-12G-7B-EN\" configuration is slow, you can downgrade to \"GPU-8G-3B-EN\" for a significant speed improvement.\n### About RWKV\nRWKV is an RNN with Transformer-level LLM performance, which can also be directly trained like a GPT transformer (parallelizable). And it's 100% attention-free. You only need the hidden state at position t to compute the state at position t+1. You can use the \"GPT\" mode to quickly compute the hidden state for the \"RNN\" mode.<br/>So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, \"infinite\" ctx_len, and free sentence embedding (using the final hidden state).",
|
||||
"zh": "RWKV是一个开源且允许商用的大语言模型,灵活性很高且极具发展潜力。\n### 关于本工具\n本工具旨在降低大语言模型的使用门槛,做到人人可用,本工具提供了全自动化的依赖和模型管理,你只需要直接点击运行,跟随引导,即可完成本地大语言模型的部署,工具本身体积极小,只需要一个exe即可完成一键部署。\n此外,本工具提供了与OpenAI API完全兼容的接口,这意味着你可以把任意ChatGPT客户端用作RWKV的客户端,实现能力拓展,而不局限于聊天。\n### 底部的预设配置规则\n本工具内置了一系列预设配置,以降低使用难度,每个配置名的规则,依次代表着:设备-所需显存/内存-模型规模-模型语言。\n例如,GPU-8G-3B-CN,表示该配置用于显卡,需要8G显存,模型规模为30亿参数,使用的是中文模型。\n模型规模越大,性能要求越高,显存要求也越高,而同样模型规模的配置中,显存占用越高的,运行速度越快。\n例如当你有12G显存,但运行GPU-12G-7B-CN配置速度比较慢,可降级成GPU-8G-3B-CN,将会大幅提速。\n### 关于RWKV\nRWKV是具有Transformer级别LLM性能的RNN,也可以像GPT Transformer一样直接进行训练(可并行化)。而且它是100% attention-free的。你只需在位置t处获得隐藏状态即可计算位置t + 1处的状态。你可以使用“GPT”模式快速计算用于“RNN”模式的隐藏状态。\n因此,它将RNN和Transformer的优点结合起来 - 高性能、快速推理、节省显存、快速训练、“无限”上下文长度以及免费的语句嵌入(使用最终隐藏状态)。"
|
||||
},
|
||||
"about": {
|
||||
"en": "<div align=\"center\">\n\nProject Source Code:\nhttps://github.com/josStorer/RWKV-Runner\nAuthor: [@josStorer](https://github.com/josStorer)\n\nRelated Repositories:\nRWKV-4-Raven: https://huggingface.co/BlinkDL/rwkv-4-raven/tree/main\nChatRWKV: https://github.com/BlinkDL/ChatRWKV\nRWKV-LM: https://github.com/BlinkDL/RWKV-LM\n\n</div>",
|
||||
"zh": "<div align=\"center\">\n\n本项目源码:\nhttps://github.com/josStorer/RWKV-Runner\n作者: [@josStorer](https://github.com/josStorer)\n演示与常见问题说明视频: https://www.bilibili.com/video/BV1hM4y1v76R\n\n相关仓库:\nRWKV-4-Raven: https://huggingface.co/BlinkDL/rwkv-4-raven/tree/main\nChatRWKV: https://github.com/BlinkDL/ChatRWKV\nRWKV-LM: https://github.com/BlinkDL/RWKV-LM\n\n</div>"
|
||||
"en": "<div align=\"center\">\n\nProject Source Code:\nhttps://github.com/josStorer/RWKV-Runner\nAuthor: [@josStorer](https://github.com/josStorer)\nFAQs: https://github.com/josStorer/RWKV-Runner/wiki/FAQs\n\nRelated Repositories:\nRWKV-4-Raven: https://huggingface.co/BlinkDL/rwkv-4-raven/tree/main\nChatRWKV: https://github.com/BlinkDL/ChatRWKV\nRWKV-LM: https://github.com/BlinkDL/RWKV-LM\n\n</div>",
|
||||
"zh": "<div align=\"center\">\n\n本项目源码:\nhttps://github.com/josStorer/RWKV-Runner\n作者: [@josStorer](https://github.com/josStorer)\n演示与常见问题说明视频: https://www.bilibili.com/video/BV1hM4y1v76R\n疑难解答: https://www.bilibili.com/read/cv23921171\n\n相关仓库:\nRWKV-4-Raven: https://huggingface.co/BlinkDL/rwkv-4-raven/tree/main\nChatRWKV: https://github.com/BlinkDL/ChatRWKV\nRWKV-LM: https://github.com/BlinkDL/RWKV-LM\n\n</div>"
|
||||
},
|
||||
"localModelDir": "models",
|
||||
"programFiles": [
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/requirements.txt",
|
||||
"path": "backend-python/requirements.txt"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/requirements_versions.txt",
|
||||
"path": "backend-python/requirements_versions.txt"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/main.py",
|
||||
"path": "backend-python/main.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/global_var.py",
|
||||
"path": "backend-python/global_var.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/convert_model.py",
|
||||
"path": "backend-python/convert_model.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/dep_check.py",
|
||||
"path": "backend-python/dep_check.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/routes/completion.py",
|
||||
"path": "backend-python/routes/completion.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/routes/config.py",
|
||||
"path": "backend-python/routes/config.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/utils/ngrok.py",
|
||||
"path": "backend-python/utils/ngrok.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/utils/rwkv.py",
|
||||
"path": "backend-python/utils/rwkv.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/utils/torch.py",
|
||||
"path": "backend-python/utils/torch.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/wkv_cuda_utils/wkv_cuda10_30.pyd",
|
||||
"path": "backend-python/wkv_cuda_utils/wkv_cuda10_30.pyd"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/wkv_cuda_utils/wkv_cuda40.pyd",
|
||||
"path": "backend-python/wkv_cuda_utils/wkv_cuda40.pyd"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/wkv_cuda_utils/wkv_cuda_model.py",
|
||||
"path": "backend-python/wkv_cuda_utils/wkv_cuda_model.py"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner@master/backend-python/20B_tokenizer.json",
|
||||
"path": "backend-python/20B_tokenizer.json"
|
||||
},
|
||||
{
|
||||
"url": "https://cdn.jsdelivr.net/gh/pypa/get-pip/public/get-pip.py",
|
||||
"path": "backend-python/get-pip.py"
|
||||
"url": "",
|
||||
"path": ""
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"name": "RWKV-4-Raven-3B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230527-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "Chinese 3B v12",
|
||||
"zh": "中文 3B v12"
|
||||
},
|
||||
"size": 5969345330,
|
||||
"SHA256": "c0abb4b745ba3523b9d8b3e1293110867ee55b1ef3dc8c122212f78396755721",
|
||||
"lastUpdated": "2023-05-28T11:51:12",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-3B-v12-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230527-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v12-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230527-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-3B-v11-Eng99%-Other1%-20230425-ctx4096.pth",
|
||||
"desc": {
|
||||
@@ -86,7 +37,8 @@
|
||||
"SHA256": "982ad3d794efe58992db23c6d694c57a9e62d54718264ec6d6acfae5eb0eea12",
|
||||
"lastUpdated": "2023-04-26T14:27:55",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-3B-v11-Eng99%25-Other1%25-20230425-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v11-Eng99%25-Other1%25-20230425-ctx4096.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v11-Eng99%25-Other1%25-20230425-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-3B-v12-Eng98%-Other2%-20230520-ctx4096.pth",
|
||||
@@ -110,7 +62,8 @@
|
||||
"SHA256": "7aaf40bb3d440a949db3a146b0a5bbb3e925942b496775b51f5630a582fc236d",
|
||||
"lastUpdated": "2023-04-24T07:48:55",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-7B-v10x-Eng49%25-Chn50%25-Other1%25-20230423-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v10x-Eng49%25-Chn50%25-Other1%25-20230423-ctx4096.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v10x-Eng49%25-Chn50%25-Other1%25-20230423-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth",
|
||||
@@ -122,7 +75,20 @@
|
||||
"SHA256": "9e67a74964abcb4463711e447ddf47735561d7b40592d2d02b29d2e796a4fd14",
|
||||
"lastUpdated": "2023-04-30T14:35:59",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-7B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230430-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230430-ctx8192.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230430-ctx8192.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-7B-v12-Eng49%-Chn49%-Jpn1%-Other1%-20230530-ctx8192.pth",
|
||||
"desc": {
|
||||
"en": "Chinese 7B v12",
|
||||
"zh": "中文 7B v12"
|
||||
},
|
||||
"size": 14785389874,
|
||||
"SHA256": "6d4a089ff36d5d9d96b669d425fc5e4e3959cab426535b52e2364df08f58b407",
|
||||
"lastUpdated": "2023-05-30T23:16:12",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-7B-v12-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230530-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v12-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230530-ctx8192.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-7B-v12-Eng98%-Other2%-20230521-ctx8192.pth",
|
||||
@@ -146,7 +112,8 @@
|
||||
"SHA256": "f00d5c75b453f2b20ad875fb5a324564c34024eea25a015f5eb441e4f364c3fe",
|
||||
"lastUpdated": "2023-04-29T11:44:32",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-7B-v11x-Eng99%25-Other1%25-20230429-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v11x-Eng99%25-Other1%25-20230429-ctx8192.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v11x-Eng99%25-Other1%25-20230429-ctx8192.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-1B5-v11-Eng99%-Other1%-20230425-ctx4096.pth",
|
||||
@@ -158,7 +125,8 @@
|
||||
"SHA256": "4ac715aecc5b1c90e8e37eebb8163392699066ec23b18144416e91cb4e78675a",
|
||||
"lastUpdated": "2023-04-26T14:27:55",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-1B5-v11-Eng99%25-Other1%25-20230425-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-1B5-v11-Eng99%25-Other1%25-20230425-ctx4096.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-1B5-v11-Eng99%25-Other1%25-20230425-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-1B5-v12-Eng98%-Other2%-20230520-ctx4096.pth",
|
||||
@@ -182,7 +150,8 @@
|
||||
"SHA256": "af12300d9875e0e166c23d6e9b20928db435073060bf1d36f874060de92ada98",
|
||||
"lastUpdated": "2023-04-29T11:51:51",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-3B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230429-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230429-ctx4096.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v11-Eng49%25-Chn49%25-Jpn1%25-Other1%25-20230429-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Raven-14B-v12-Eng98%-Other2%-20230523-ctx8192.pth",
|
||||
@@ -206,7 +175,167 @@
|
||||
"SHA256": "c4bc72406c3c62613e8e2592e8d07ac045f8a88381c728f8eb60af890e299f4d",
|
||||
"lastUpdated": "2023-05-02T09:43:33",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-14B-v11x-Eng99%25-Other1%25-20230501-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-14B-v11x-Eng99%25-Other1%25-20230501-ctx8192.pth"
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-14B-v11x-Eng99%25-Other1%25-20230501-ctx8192.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "Professional Writer 7B v1",
|
||||
"zh": "专业写作 7B v1"
|
||||
},
|
||||
"size": 14785389618,
|
||||
"SHA256": "cd40b661930dea46c0f930c51d99cef6b484fe3d641388981dee5a0c68e2b1c7",
|
||||
"lastUpdated": "2023-04-10T13:55:52",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-novel/blob/main/RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-novel/resolve/main/RWKV-4-Novel-7B-v1-ChnEng-ChnPro-20230410-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Novel-7B-v1-Chn-20230426-ctx8192.pth",
|
||||
"desc": {
|
||||
"en": "Popular Writer 7B v1",
|
||||
"zh": "通俗写作 7B v1"
|
||||
},
|
||||
"size": 14785389864,
|
||||
"SHA256": "5fced44febdf80d303250eef9c020f087abded43aaecc8caaea8a9e7f1fb771e",
|
||||
"lastUpdated": "2023-04-26T18:57:01",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-novel/blob/main/RWKV-4-Novel-7B-v1-Chn-20230426-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-novel/resolve/main/RWKV-4-Novel-7B-v1-Chn-20230426-ctx8192.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Novel-3B-v1-Chn-20230412-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "Popular Writer 3B v1",
|
||||
"zh": "通俗写作 3B v1"
|
||||
},
|
||||
"size": 5969345064,
|
||||
"SHA256": "c41e0af2cbc66e94121377680e8224a1504fac6c9ea620c395f0a79281db26e7",
|
||||
"lastUpdated": "2023-04-12T13:18:29",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-novel/blob/main/RWKV-4-Novel-3B-v1-Chn-20230412-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-novel/resolve/main/RWKV-4-Novel-3B-v1-Chn-20230412-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Novel-3B-v1-ChnEng-20230412-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "Balanced Writer 3B v1",
|
||||
"zh": "均衡写作 3B v1"
|
||||
},
|
||||
"size": 5969345064,
|
||||
"SHA256": "283c6e6fa10c52a93e9a01d9630f288473267ea152a49c6579b5c0427bdc9c61",
|
||||
"lastUpdated": "2023-04-12T13:18:29",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-novel/blob/main/RWKV-4-Novel-3B-v1-ChnEng-20230412-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-novel/resolve/main/RWKV-4-Novel-3B-v1-ChnEng-20230412-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-Novel-7B-v1-ChnEng-20230426-ctx8192.pth",
|
||||
"desc": {
|
||||
"en": "Balanced Writer 7B v1",
|
||||
"zh": "均衡写作 7B v1"
|
||||
},
|
||||
"size": 14785389864,
|
||||
"SHA256": "bd08c75a296bd193dcfadb993fe06d7f9dd91ca3385231f24c592c89d25cd596",
|
||||
"lastUpdated": "2023-04-26T18:57:01",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-novel/blob/main/RWKV-4-Novel-7B-v1-ChnEng-20230426-ctx8192.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-novel/resolve/main/RWKV-4-Novel-7B-v1-ChnEng-20230426-ctx8192.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-7B-v1-OnlyForTest_40%_trained-20230601-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 7B v1 Test",
|
||||
"zh": "100+ 语言 7B v1 测试"
|
||||
},
|
||||
"size": 15035393581,
|
||||
"SHA256": "63c060c472e45b6c3af2baaaee448ffd95f9b46e3cc6e1ef70ce7ecb1d01bcfa",
|
||||
"lastUpdated": "2023-06-02T00:09:39",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-OnlyForTest_40%25_trained-20230601-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_40%25_trained-20230601-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-7B-v1-OnlyForTest_30%_trained-20230529-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 7B v1 Test",
|
||||
"zh": "100+ 语言 7B v1 测试"
|
||||
},
|
||||
"size": 15035393581,
|
||||
"SHA256": "05f91562b2ae8b025226e40b3fb536d6f8eb3c142ac899c0808ee1c9dc189ec4",
|
||||
"lastUpdated": "2023-05-29T13:25:53",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-OnlyForTest_30%25_trained-20230529-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-OnlyForTest_30%25_trained-20230529-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 0.1B v1",
|
||||
"zh": "100+ 语言 0.1B v1"
|
||||
},
|
||||
"size": 385594610,
|
||||
"SHA256": "a10ef99df2a8f8a6801edf4fc92a9c49bedd63dcb900d3e5667a2136b3d671e7",
|
||||
"lastUpdated": "2023-05-25T09:21:27",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.1B-v1-20230520-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-1.5B-v1-OnlyForTest_57%_trained-20230529-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 1.5B v1 Test",
|
||||
"zh": "100+ 语言 1.5B v1 测试"
|
||||
},
|
||||
"size": 3155281581,
|
||||
"SHA256": "ac36770931776c5aa179690918c9a3b0b5f4ebe3301ea3574a7e182209778788",
|
||||
"lastUpdated": "2023-05-29T13:25:53",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-1.5B-v1-OnlyForTest_57%25_trained-20230529-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-1.5B-v1-OnlyForTest_57%25_trained-20230529-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-3B-v1-OnlyForTest_35%_trained-20230529-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 3B v1 Test",
|
||||
"zh": "100+ 语言 3B v1 测试"
|
||||
},
|
||||
"size": 6125597613,
|
||||
"SHA256": "e4ee6e91a80d56de43bc79841f3a8be3b7b215d7d9788f79c467b9b1f7f03cb8",
|
||||
"lastUpdated": "2023-05-29T13:25:53",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-OnlyForTest_35%25_trained-20230529-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-OnlyForTest_35%25_trained-20230529-ctx4096.pth",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-1.5B-v1-OnlyForTest_81%_trained-20230603-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 1.5B v1 Test",
|
||||
"zh": "100+ 语言 1.5B v1 测试"
|
||||
},
|
||||
"size": 3155281581,
|
||||
"SHA256": "044fb10daa71f4c012493ac8ef455c8c3301095b5f009dae58f0f6382a53e23c",
|
||||
"lastUpdated": "2023-06-03T13:57:20",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-1.5B-v1-OnlyForTest_81%25_trained-20230603-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-1.5B-v1-OnlyForTest_81%25_trained-20230603-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-3B-v1-OnlyForTest_52%_trained-20230603-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 3B v1 Test",
|
||||
"zh": "100+ 语言 3B v1 测试"
|
||||
},
|
||||
"size": 6125597613,
|
||||
"SHA256": "aad3671078a0c686368add4f4b695a76c2ba1ddd505a64c0949bb003beeee9a3",
|
||||
"lastUpdated": "2023-06-03T13:57:20",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-OnlyForTest_52%25_trained-20230603-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-OnlyForTest_52%25_trained-20230603-ctx4096.pth"
|
||||
},
|
||||
{
|
||||
"name": "RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
||||
"desc": {
|
||||
"en": "100+ Languages 0.4B v1",
|
||||
"zh": "100+ 语言 0.4B v1"
|
||||
},
|
||||
"size": 923362866,
|
||||
"SHA256": "4b4a2733cf5e5dc97dd62106f391d99895d16b11c5ccd10c89f28c52067a4919",
|
||||
"lastUpdated": "2023-05-29T13:25:53",
|
||||
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth",
|
||||
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-0.4B-v1-20230529-ctx4096.pth"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
6
vendor.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
- ^backend-python/rwkv_pip/
|
||||
- ^backend-python/wkv_cuda_utils/
|
||||
- ^backend-python/get-pip\.py
|
||||
- ^backend-python/convert_model\.py
|
||||
- ^build/
|
||||
- ^frontend/wailsjs/
|
||||