Compare commits

...

11 Commits

Author SHA1 Message Date
josc146
eb25dc6bcb release v1.4.2 2023-07-29 19:33:52 +08:00
josc146
aecacde819 remove response field of completions api 2023-07-29 19:20:43 +08:00
josc146
3ef22239eb improve default ChatCompletion stop 2023-07-29 19:19:38 +08:00
josc146
719090cc8c improve python backend startup speed 2023-07-29 19:18:01 +08:00
josc146
dbb8374d89 update defaultConfigs 2023-07-29 19:16:44 +08:00
github-actions[bot]
4d875a8c00 release v1.4.1 2023-07-28 14:16:37 +00:00
josc146
30b6d66a2d release v1.4.1 2023-07-28 22:14:53 +08:00
josc146
9d89b6f4db fix params 2023-07-28 22:13:19 +08:00
josc146
d2928e54f7 fix failed to build cyac 2023-07-28 21:40:17 +08:00
josc146
49ba5c97f7 update readme 2023-07-28 13:13:14 +08:00
github-actions[bot]
4054fac359 release v1.4.0 2023-07-28 05:06:42 +00:00
11 changed files with 71 additions and 33 deletions

View File

@@ -11,7 +11,7 @@ env:
jobs:
create-draft:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- uses: actions/checkout@v3
@@ -35,7 +35,7 @@ jobs:
gh release create ${{github.ref_name}} -d -F CURRENT_CHANGE.md -t ${{github.ref_name}}
windows:
runs-on: windows-latest
runs-on: windows-2022
needs: create-draft
steps:
- uses: actions/checkout@v3
@@ -56,10 +56,10 @@ jobs:
Expand-Archive ./python-3.10.11-embed-amd64.zip -DestinationPath ./py310
$content=Get-Content "./py310/python310._pth"; $content | ForEach-Object {if ($_.ReadCount -eq 3) {"Lib\\site-packages"} else {$_}} | Set-Content ./py310/python310._pth
./py310/python ./backend-python/get-pip.py
./py310/python -m pip install Cython
./py310/python -m pip install Cython==0.29.36
Copy-Item -Path "${{ steps.cp310.outputs.python-path }}/../include" -Destination "py310/include" -Recurse
Copy-Item -Path "${{ steps.cp310.outputs.python-path }}/../libs" -Destination "py310/libs" -Recurse
./py310/python -m pip install cyac
./py310/python -m pip install cyac==1.7
go install github.com/wailsapp/wails/v2/cmd/wails@latest
make
Rename-Item -Path "build/bin/RWKV-Runner.exe" -NewName "RWKV-Runner_windows_x64.exe"
@@ -116,7 +116,7 @@ jobs:
- run: gh release upload ${{github.ref_name}} build/bin/RWKV-Runner_macos_universal.zip build/bin/RWKV-Runner_darwin_universal
publish-release:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [ windows, linux, macos ]
steps:
- uses: actions/checkout@v3

View File

@@ -1,17 +1,17 @@
## Breaking Changes
Due to performance and bandwidth considerations, the `/chat/completions` and `/completions` API no longer return
the `response` field. If necessary, you can
still [uncomment it](https://github.com/josStorer/RWKV-Runner/commit/aecacde81927e26816558f1a629cdcf507b7cb5b) yourself.
Please note that this is never part of the OpenAI API, it existed previously only for API development
convenience. If you follow the OpenAI API specification, you will not be affected in any way.
## Changes
- add Composition Page (RWKV-Music)
- improve RunButton prompt
- support for `stop` array api params
- improve embeddings API results
- improve `/chat/completions` and `/completions` API performance (remove `response` field)
- improve default ChatCompletion `stop`
- improve python backend startup speed
- add support for MIDI RWKV
- add midi api
- add CPU-120M-Music config
- improve sse fetch
- update manifest (a lot of new models)
- update presets
- remove LoraFinetunePrecision fp32
- update defaultConfigs
## Install

View File

@@ -154,6 +154,10 @@ for i in np.argsort(embeddings_cos_sim)[::-1]:
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/bf49de8e-3b89-4543-b1ef-7cd4b19a1836)
### Composition
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/e8ad908d-3fd2-4e92-bcdb-96815cb836ee)
### Configuration
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/48befdc6-e03c-4851-9bee-22f77ee2640e)

View File

@@ -155,6 +155,10 @@ for i in np.argsort(embeddings_cos_sim)[::-1]:
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/bf49de8e-3b89-4543-b1ef-7cd4b19a1836)
### 作曲
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/e8ad908d-3fd2-4e92-bcdb-96815cb836ee)
### コンフィグ
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/48befdc6-e03c-4851-9bee-22f77ee2640e)

View File

@@ -151,6 +151,10 @@ for i in np.argsort(embeddings_cos_sim)[::-1]:
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/69f9ba7a-2fe8-4a5e-94cb-aa655aa409e2)
### 作曲
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/95b34893-80c2-4706-87f9-bc141032ed4b)
### 配置
![image](https://github.com/josStorer/RWKV-Runner/assets/13366013/59460f69-b172-4c7a-86cb-573262543076)

View File

@@ -25,7 +25,13 @@ class ChatCompletionBody(ModelConfigBody):
messages: List[Message]
model: str = "rwkv"
stream: bool = False
stop: str | List[str] = None
stop: Union[str, List[str]] = [
"\n\nUser",
"\n\nQuestion",
"\n\nQ",
"\n\nHuman",
"\n\nBob",
]
class Config:
schema_extra = {
@@ -47,7 +53,7 @@ class CompletionBody(ModelConfigBody):
prompt: Union[str, List[str]]
model: str = "rwkv"
stream: bool = False
stop: str | List[str] = None
stop: Union[str, List[str]] = None
class Config:
schema_extra = {
@@ -77,7 +83,7 @@ async def eval_rwkv(
body: ModelConfigBody,
prompt: str,
stream: bool,
stop: str,
stop: Union[str, List[str]],
chat_mode: bool,
):
global requests_num
@@ -121,7 +127,7 @@ async def eval_rwkv(
"object": "chat.completion.chunk"
if chat_mode
else "text_completion",
"response": response,
# "response": response,
"model": model.name,
"choices": [
{
@@ -159,7 +165,7 @@ async def eval_rwkv(
"object": "chat.completion.chunk"
if chat_mode
else "text_completion",
"response": response,
# "response": response,
"model": model.name,
"choices": [
{
@@ -180,7 +186,7 @@ async def eval_rwkv(
else:
yield {
"object": "chat.completion" if chat_mode else "text_completion",
"response": response,
# "response": response,
"model": model.name,
"usage": {
"prompt_tokens": prompt_tokens,
@@ -285,15 +291,16 @@ The following is a coherent verbose detailed conversation between a girl named {
)
completion_text += f"{bot}{interface}"
stop = f"\n\n{user}" if body.stop is None else body.stop
if body.stream:
return EventSourceResponse(
eval_rwkv(model, request, body, completion_text, body.stream, stop, True)
eval_rwkv(
model, request, body, completion_text, body.stream, body.stop, True
)
)
else:
try:
return await eval_rwkv(
model, request, body, completion_text, body.stream, stop, True
model, request, body, completion_text, body.stream, body.stop, True
).__anext__()
except StopAsyncIteration:
return None

View File

@@ -6,7 +6,6 @@ from pydantic import BaseModel
from utils.rwkv import *
from utils.torch import *
import global_var
import GPUtil
router = APIRouter()
@@ -112,6 +111,8 @@ def update_config(body: ModelConfigBody):
@router.get("/status", tags=["Configs"])
def status():
import GPUtil
gpus = GPUtil.getGPUs()
if len(gpus) == 0:
device_name = "CPU"

View File

@@ -3,7 +3,7 @@ import os
import pathlib
import copy
import re
from typing import Dict, Iterable, List, Tuple
from typing import Dict, Iterable, List, Tuple, Union
from utils.log import quick_log
from fastapi import HTTPException
from pydantic import BaseModel, Field
@@ -213,7 +213,7 @@ class AbstractRWKV(ABC):
return state[0].tolist(), token_len
def generate(
self, prompt: str, stop: str | List[str] = None
self, prompt: str, stop: Union[str, List[str]] = None
) -> Iterable[Tuple[str, str, int, int]]:
quick_log(None, None, "Generation Prompt:\n" + prompt)
cache = None

View File

@@ -72,7 +72,7 @@ const CompositionPanel: FC = observer(() => {
const setSoundFont = async () => {
let soundUrl: string;
if (params.useLocalSoundFont)
if (commonStore.compositionParams.useLocalSoundFont)
soundUrl = 'assets/sound-font';
else
soundUrl = !commonStore.settings.giteeUpdatesSource ?
@@ -117,7 +117,7 @@ const CompositionPanel: FC = observer(() => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'text': params.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', '').trim()
'text': commonStore.compositionParams.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', ' ').trim()
})
}).then(r => {
r.arrayBuffer().then(midi => {
@@ -168,7 +168,7 @@ const CompositionPanel: FC = observer(() => {
scrollToBottom();
if (e.data.trim() === '[DONE]') {
commonStore.setCompositionGenerating(false);
generateNs(params.autoPlay);
generateNs(commonStore.compositionParams.autoPlay);
return;
}
let data;

View File

@@ -268,7 +268,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
apiPort: 8000,
maxResponseToken: 4100,
temperature: 1.0,
topP: 0.3,
topP: 0.8,
presencePenalty: 0,
frequencyPenalty: 1
},
@@ -280,6 +280,24 @@ export const defaultModelConfigsMac: ModelConfig[] = [
maxStoredLayers: 41
}
},
{
name: 'CPU-560M-Music',
apiParameters: {
apiPort: 8000,
maxResponseToken: 4100,
temperature: 1.0,
topP: 0.8,
presencePenalty: 0,
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-MIDI-560M-v1-20230717-ctx4096.pth',
device: 'CPU',
precision: 'fp32',
storedLayers: 41,
maxStoredLayers: 41
}
},
{
name: 'CPU-6G-1B5-World',
apiParameters: {

View File

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