Compare commits

...

16 Commits

Author SHA1 Message Date
josc146
408f3c1a4d release v1.1.6 2023-06-03 17:15:11 +08:00
josc146
38b775c937 add logs 2023-06-03 17:12:59 +08:00
josc146
f2ec1067bf MX, Tesla P, Quadro P, NVIDIA P, TITAN X, RTX A series, TITAN RTX and RTX TITAN Ada 2023-06-03 12:46:56 +08:00
josc146
b01584c49e chore 2023-06-03 00:10:31 +08:00
josc146
01e56382a3 release v1.1.5 2023-06-02 23:53:37 +08:00
josc146
391c067250 add Instruction to Completion Presets 2023-06-02 23:53:25 +08:00
josc146
5b98b5c0a7 update manifest.json 2023-06-02 23:45:37 +08:00
josc146
5bde0abb8d reminder to use administrator privileges 2023-06-02 23:42:13 +08:00
josc146
1036852924 add path contains space prompt and chore 2023-06-02 23:35:33 +08:00
josc146
2b10ccd507 add vc++ installation guide 2023-06-02 23:32:47 +08:00
josc146
e1df1bfc3f chore 2023-06-02 22:20:57 +08:00
josc146
b41a2e7039 move state cache to memory (todo: state cache db) 2023-06-02 21:33:57 +08:00
josc146
b63370928d macOS 2023-06-01 16:54:21 +08:00
josc146
06a125b8d7 release v1.1.4 2023-05-31 16:27:52 +08:00
josc146
b03b00419b fix Cmd and CopyFile 2023-05-31 16:27:43 +08:00
josc146
2f5a7d2d51 fix_tokens 2023-05-31 16:07:09 +08:00
27 changed files with 272 additions and 55 deletions

3
.gitignore vendored
View File

@@ -16,3 +16,6 @@ __pycache__
/backend-python/wkv_cuda
*.exe
*.old
.DS_Store
*.log.*
*.log

View File

@@ -10,6 +10,7 @@ build-windows:
build-macos:
@echo ---- build for macos
wails build -ldflags "-s -w"
dev:
wails dev

View File

@@ -73,6 +73,7 @@ body.json:
- [x] CUDA operator int8 acceleration
- [ ] macOS support
- [ ] Linux support
- [ ] Local State Cache DB
## Related Repositories:

View File

@@ -73,6 +73,7 @@ body.json:
- [x] CUDA算子int8提速
- [ ] macOS支持
- [ ] linux支持
- [ ] 本地状态缓存数据库
## 相关仓库:

View File

@@ -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()
}

View File

@@ -9,7 +9,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
}
@@ -81,7 +81,7 @@ func (a *App) AddToDownloadList(path string, url string) {
downloadList = append(downloadList, DownloadStatus{
resp: nil,
Name: filepath.Base(path),
Path: path,
Path: a.exDir + path,
Url: url,
Downloading: true,
})

View File

@@ -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,16 @@ 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")
println("unsupported OS")
}
return nil
return errors.New("unsupported OS")
}

View File

@@ -37,7 +37,7 @@ func (a *App) DepCheck(python string) error {
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))
}
@@ -63,7 +63,11 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if err != nil {
return "", err
}
_, 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
}

View File

@@ -15,7 +15,8 @@ import (
)
func Cmd(args ...string) (string, error) {
if runtime.GOOS == "windows" {
switch platform := runtime.GOOS; platform {
case "windows":
_, err := os.Stat("cmd-helper.bat")
if err != nil {
if err := os.WriteFile("./cmd-helper.bat", []byte("start %*"), 0644); err != nil {
@@ -26,13 +27,33 @@ func Cmd(args ...string) (string, error) {
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
} else {
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 {
@@ -41,9 +62,19 @@ func Cmd(args ...string) (string, error) {
cmd.Wait()
return "", nil
}
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) + "/../../../"
}
err := fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
return nil
@@ -56,6 +87,7 @@ func CopyEmbed(efs embed.FS) error {
return err
}
path = prefix + path
err = os.MkdirAll(path[:strings.LastIndex(path, "/")], 0755)
if err != nil {
return err

View File

@@ -1,4 +1,3 @@
import cyac
import GPUtil
import torch
import rwkv

View File

@@ -4,17 +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 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,
@@ -42,7 +43,7 @@ def init():
@app.get("/")
def read_root():
return {"Hello": "World!", "pid": os.getpid()}
return {"Hello": "World!"}
@app.post("/exit")
@@ -60,7 +61,7 @@ def debug():
strategy="cuda fp16",
tokens_path="20B_tokenizer.json",
)
d = model.tokenizer.decode([])
d = model.pipeline.decode([])
print(d)

View File

@@ -7,6 +7,7 @@ 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()
@@ -26,6 +27,8 @@ class ChatCompletionBody(ModelConfigBody):
completion_lock = Lock()
requests_num = 0
@router.post("/v1/chat/completions")
@router.post("/chat/completions")
@@ -106,8 +109,15 @@ 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
quick_log(
request, None, "Stop Waiting. RequestsNum: " + str(requests_num)
)
return
await asyncio.sleep(0.1)
else:
@@ -135,9 +145,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,
@@ -161,6 +183,12 @@ The following is a coherent verbose detailed conversation between a girl named {
if await request.is_disconnected():
break
# torch_gc()
requests_num = requests_num - 1
quick_log(
request,
body,
response + "\nFinished. RequestsNum: " + str(requests_num),
)
completion_lock.release()
if await request.is_disconnected():
return
@@ -182,7 +210,11 @@ 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:
print(f"{request.client} Stop Waiting")
return None
class CompletionBody(ModelConfigBody):
@@ -203,8 +235,15 @@ async def completions(body: CompletionBody, request: Request):
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
quick_log(
request, None, "Stop Waiting. RequestsNum: " + str(requests_num)
)
return
await asyncio.sleep(0.1)
else:
@@ -229,9 +268,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,
@@ -252,6 +303,12 @@ async def completions(body: CompletionBody, request: Request):
if await request.is_disconnected():
break
# torch_gc()
requests_num = requests_num - 1
quick_log(
request,
body,
response + "\nFinished. RequestsNum: " + str(requests_num),
)
completion_lock.release()
if await request.is_disconnected():
return
@@ -270,4 +327,8 @@ 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:
print(f"{request.client} Stop Waiting")
return None

View File

@@ -2,7 +2,6 @@ import pathlib
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

View File

@@ -3,6 +3,7 @@ from fastapi import APIRouter, HTTPException, Response, status
from pydantic import BaseModel
import gc
import copy
import torch
router = APIRouter()
@@ -41,10 +42,14 @@ def add_state(body: AddStateBody):
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": copy.deepcopy(body.state),
"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"
@@ -77,11 +82,15 @@ def longest_prefix_state(body: LongestPrefixStateBody):
pass
if id != -1:
v = dtrie[id]
device = v["device"]
return {
"prompt": trie[id],
"tokens": v["tokens"],
"state": v["state"],
"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}

View 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"
)

View File

@@ -65,7 +65,7 @@ The following is a coherent verbose detailed conversation between a girl named {
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.pipeline.encode(preset_system))
logits = self.run_rnn(self.fix_tokens(self.pipeline.encode(preset_system)))
try:
state_cache.add_state(
state_cache.AddStateBody(
@@ -79,7 +79,7 @@ The following is a coherent verbose detailed conversation between a girl named {
pass
# Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end
def fix_tokens(tokens):
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

View File

@@ -114,6 +114,7 @@
"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",
"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: 你会讲笑话吗?",
@@ -132,5 +133,9 @@
"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": "自定义模型路径"
"Custom Models Path": "自定义模型路径",
"MacOS is not supported yet, please convert manually.": "暂不支持MacOS, 请手动转换",
"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.": "切换模型失败, 请尝试以管理员权限启动程序"
}

View File

@@ -17,7 +17,7 @@ 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',
@@ -70,10 +70,16 @@ 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.customPythonPath, 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 {
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 {
toast(depErrorMsg, { type: 'error' });
}
@@ -173,7 +179,10 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
}
}).catch(() => {
commonStore.setStatus({ status: ModelStatus.Offline });
toast(t('Failed to switch model'), { type: 'error' });
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(() => {

View File

@@ -101,6 +101,19 @@ export const defaultPresets: CompletionPreset[] = [{
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: '',
injectStart: '',
injectEnd: ''
}
}, {
name: 'Blank',
prompt: '',

View File

@@ -835,6 +835,11 @@ export const Configs: FC = observer(() => {
</div>
} />
<ToolTipButton text={t('Convert')} desc={t('Convert model with these configs')} onClick={async () => {
if (commonStore.platform == 'darwin') {
toast(t('MacOS is not supported yet, please convert manually.'), { type: 'info' });
return;
}
const modelPath = `${commonStore.settings.customModelsPath}/${selectedConfig.modelParameters.modelName}`;
if (await FileExists(modelPath)) {
const strategy = getStrategy(selectedConfig);
@@ -844,7 +849,11 @@ export const Configs: FC = observer(() => {
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 {

View File

@@ -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>

View File

@@ -118,16 +118,18 @@ export const Settings: FC = observer(() => {
<AccordionHeader ref={advancedHeaderRef} size="large">{t('Advanced')}</AccordionHeader>
<AccordionPanel>
<div className="flex flex-col gap-2 overflow-hidden">
<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')}
{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) => {

View File

@@ -309,9 +309,9 @@ export function toastWithButton(text: string, buttonText: string, onClickButton:
}
export function getSupportedCustomCudaFile() {
if ([' 10', ' 16', ' 20', ' 30', 'P40', 'P104', 'P106'].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 '';

0
frontend/wailsjs/go/backend_golang/App.d.ts generated vendored Normal file → Executable file
View File

0
frontend/wailsjs/go/backend_golang/App.js generated Normal file → Executable file
View File

0
frontend/wailsjs/go/models.ts generated Normal file → Executable file
View File

View File

@@ -1,5 +1,5 @@
{
"version": "1.1.3",
"version": "1.1.6",
"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的优点结合起来 - 高性能、快速推理、节省显存、快速训练、“无限”上下文长度以及免费的语句嵌入(使用最终隐藏状态)。"
@@ -238,6 +238,18 @@
"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": {
@@ -248,7 +260,8 @@
"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"
"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",