Compare commits

...

76 Commits

Author SHA1 Message Date
dependabot[bot]
be80a47679 chore(deps): bump docker/build-push-action from 3 to 5
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 19:19:36 +00:00
github-actions[bot]
7fbcb5e810 release v1.7.3 2024-03-11 11:08:54 +00:00
josc146
2604d3c47b release v1.7.3 2024-03-11 19:07:08 +08:00
josc146
bb1a6191b0 prevent 'torch' has no attribute 'cuda' error in torch_gc, so user can use CPU or WebGPU (#302) 2024-03-11 19:04:19 +08:00
josc146
dd89041f72 dep_check.py now ignores GPUtil 2024-03-11 18:55:37 +08:00
josc146
91eb72e515 fix the issue where penalty_decay and global_penalty are not being passed to the backend default config when running the model through client 2024-03-11 18:52:35 +08:00
josc146
1c7436c34b fix max_tokens parameter of Chat page not being passed to backend 2024-03-11 18:52:33 +08:00
Steven Hangger
8678f376e9 fix(rwkv.cpp): add build step for librwkv.so 2024-03-07 23:51:32 +09:00
Steven Hangger
050154f406 feat(docker): add Docker support 2024-03-07 23:51:32 +09:00
dependabot[bot]
b3eae8bcfa chore(deps): bump crazy-max/ghaction-chocolatey from 2 to 3
Bumps [crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey) from 2 to 3.
- [Release notes](https://github.com/crazy-max/ghaction-chocolatey/releases)
- [Commits](https://github.com/crazy-max/ghaction-chocolatey/compare/v2...v3)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-chocolatey
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:54:36 +09:00
dependabot[bot]
c720362886 chore(deps): bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:53:10 +09:00
dependabot[bot]
93029d3f5c chore(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:53:05 +09:00
dependabot[bot]
28244a57b4 chore(deps): bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:52:59 +09:00
dependabot[bot]
f6ba9d7451 Bump fastapi from 0.104.0 to 0.109.1 in /backend-python
Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.104.0 to 0.109.1.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](https://github.com/tiangolo/fastapi/compare/0.104.0...0.109.1)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:51:37 +09:00
dependabot[bot]
96e431e06b Bump python-multipart from 0.0.6 to 0.0.7 in /backend-python
Bumps [python-multipart](https://github.com/andrew-d/python-multipart) from 0.0.6 to 0.0.7.
- [Release notes](https://github.com/andrew-d/python-multipart/releases)
- [Changelog](https://github.com/Kludex/python-multipart/blob/master/CHANGELOG.md)
- [Commits](https://github.com/andrew-d/python-multipart/compare/0.0.6...0.0.7)

---
updated-dependencies:
- dependency-name: python-multipart
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 13:50:47 +09:00
josc146
cb6ddb3674 add pre-release workflow 2024-03-05 12:49:17 +08:00
josc146
07d4ba0d6b fix a generation exception caused by potentially dangerous regex being passed into the stop array 2024-03-04 21:20:53 +08:00
github-actions[bot]
ac139d5bda release v1.7.2 2024-03-02 11:48:20 +00:00
josc146
14acfc1d81 release v1.7.2 2024-03-02 19:47:53 +08:00
josc146
2947162cc4 update defaultModelConfigs 2024-03-02 19:45:14 +08:00
josc146
4f14074a75 expose global_penalty 2024-03-02 17:50:41 +08:00
josc146
53a5574080 improve parameters controllable range 2024-03-02 16:52:53 +08:00
josc146
d91c3c004d allow setting tokenChunkSize of WebGPU mode 2024-03-02 16:41:29 +08:00
github-actions[bot]
c90cefc453 release v1.7.1 2024-03-01 08:03:52 +00:00
josc146
b8abd2fef3 release v1.7.1 2024-03-01 16:03:22 +08:00
josc146
887ba06bd6 allow setting quantizedLayers of WebGPU mode; chore 2024-03-01 14:23:05 +08:00
josc146
c9513822c9 fix the issue where state cache could be modified leading to inconsistent hit results 2024-03-01 13:35:16 +08:00
josc146
e3baa0da86 improve occurrence[token] condition 2024-03-01 13:18:03 +08:00
josc146
ba9aab920e hide MPS and CUDA-Beta Options 2024-03-01 13:09:09 +08:00
josc146
b0f2ef65d9 improve occurrence[token] condition 2024-02-29 17:54:33 +08:00
josc146
c13b28561d update manifest 2024-02-29 17:21:07 +08:00
josc146
5c88ccd9e6 update manifest 2024-02-28 23:48:17 +08:00
josc146
e0a6a279b3 add python3-dev to lora fine-tune dependencies 2024-02-28 23:34:49 +08:00
josc146
9bb3a90977 enable useHfMirror by default for chinese users 2024-02-28 23:28:31 +08:00
josc146
02bbd18acf fix convert_safetensors.py for rwkv6 2024-02-28 23:25:46 +08:00
josc146
18ab8b141f disable AVOID_PENALTY_TOKENS 2024-02-28 23:12:58 +08:00
github-actions[bot]
225abc5202 release v1.7.0 2024-02-21 16:10:31 +00:00
josc146
d33dff7723 release v1.7.0 2024-02-22 01:10:01 +09:00
josc146
771027211a chore 2024-02-22 01:05:52 +09:00
josc146
94fe71b49c change AVOID_PENALTY to \n only 2024-02-22 01:04:05 +09:00
josc146
fafd9f7f6e upgrade to rwkv 0.8.25 2024-02-21 23:50:05 +08:00
josc146
85b10993ec update manifest.json 2024-02-12 14:30:36 +08:00
Guillermo Marcus
11f1d66383 fix typo in requirements.txt 2024-02-06 19:59:50 +08:00
josc146
38e89aec18 update README 2024-02-06 12:21:05 +08:00
josc146
3e336830a3 chore 2024-02-06 12:19:12 +08:00
josc146
a1ae71d221 fix /update-config can make the default value of unclearly specified fields invalid by passing in None fields 2024-02-05 22:27:02 +08:00
github-actions[bot]
0703993bfd release v1.6.9 2024-02-05 04:44:24 +00:00
josc146
50a666a350 release v1.6.9 2024-02-05 12:40:23 +08:00
josc146
9ea86ee4b1 update Related Repositories 2024-02-05 12:32:07 +08:00
josc146
94580f825e chore 2024-02-05 12:31:26 +08:00
josc146
d5cca4e542 improve macos experience 2024-02-05 00:25:04 +08:00
josc146
f1986fa9d0 feat: History Message Number 2024-02-04 23:11:23 +08:00
josc146
1c025c3d29 feat: load conversation 2024-02-04 22:03:59 +08:00
josc146
4added7390 add markdown renderer switch 2024-02-04 20:21:42 +08:00
josc146
ee5cca3ff3 chore 2024-02-04 19:34:36 +08:00
josc146
0da92ec7bf improve fine-tune performance 2024-02-04 19:33:32 +08:00
josc146
e3e075e432 add parse_api_log.py, this script can extract formatted data from api.log 2024-02-04 19:30:47 +08:00
josc146
19eeeab1e1 add AVOID_PENALTY_TOKENS 2024-02-04 16:49:46 +08:00
josc146
78238c24cf update defaultPresets 2024-02-04 16:47:34 +08:00
josc146
932281db0a add Penalty Decay slider to Chat page 2024-02-03 22:40:30 +08:00
josc146
843840baa0 expose penalty_decay, top_k 2024-02-03 22:03:10 +08:00
josc146
7cba526913 update manifest.json 2024-02-03 21:35:28 +08:00
josc146
7fe70c949e update defaultPresets 2024-02-03 21:23:04 +08:00
josc146
1c1c9e2c5f update defaultModelConfigs 2024-02-03 20:39:18 +08:00
josc146
26c2954c8e web-rwkv-py 0.1.2 (Support V4, V5 and V6) https://github.com/cryscan/web-rwkv-py 2024-02-03 20:32:23 +08:00
josc146
5329537a2f improve path processing 2024-02-03 20:29:56 +08:00
josc146
e07f0fa6e3 improve path processing 2024-02-03 15:13:24 +08:00
josc146
b077f1fe42 reduce package size 2024-02-03 13:05:02 +08:00
josc146
5f94d86558 add better custom tokenizer support and tokenizer-midipiano.json 2024-02-03 13:04:13 +08:00
josc146
947e127e34 improve path processing 2024-02-02 22:00:01 +08:00
josc146
95502b900d fix WSL2 WindowsOptionalFeature: Microsoft-Windows-Subsystem-Linux -> VirtualMachinePlatform 2024-01-31 21:35:36 +08:00
josc146
16b636ef83 add EOS state cache point 2024-01-31 21:33:27 +08:00
josc146
4339ce20d5 rename manifest tag "Main" -> "Official" 2024-01-31 21:31:54 +08:00
josc146
c31fc22b6b fix finetune errorsMap ($modelInfo) 2024-01-31 21:31:03 +08:00
josc146
7f49c6025b update manifest.json 2024-01-29 19:41:45 +08:00
github-actions[bot]
2d4f436ebf release v1.6.8 2024-01-05 05:54:16 +00:00
65 changed files with 4342 additions and 485 deletions

171
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,171 @@
name: Publish Docker Image
on: [push]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
docker_build:
name: Build ${{ matrix.arch }} Image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
name: amd64
# - arch: arm64
# name: arm64
steps:
- name: Free up disk spaces
run: |
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf "/usr/local/share/boost" || true
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true
- name: Get lowercase string for the repository name
id: lowercase-repo-name
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.event.repository.name }}
- name: Checkout base
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ github.ref }}-${{ matrix.arch }}
restore-keys: |
${{ github.ref }}-${{ matrix.arch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/${{ matrix.arch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get commit SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build and export
id: build
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ secrets.DOCKER_USERNAME }}/${{ steps.lowercase-repo-name.outputs.lowercase }}:${{ matrix.name }}-latest
build-args: |
SHA=${{ steps.vars.outputs.sha_short }}
outputs: type=image,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Replace tag without `v`
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v1
id: version
with:
script: |
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
result-encoding: string
- name: Build release and export
id: build_rel
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ secrets.DOCKER_USERNAME }}/${{ steps.lowercase-repo-name.outputs.lowercase }}:${{ matrix.name }}-${{steps.version.outputs.result}}
build-args: |
SHA=${{ steps.version.outputs.result }}
outputs: type=image,push=true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Save digest
if: github.ref == 'refs/heads/master'
run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
- name: Save release digest
if: startsWith(github.ref, 'refs/tags/')
run: echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: digest_${{ matrix.name }}
path: /tmp/digest.txt
manifests:
name: Build manifests
needs: [docker_build]
runs-on: ubuntu-latest
steps:
- name: Get lowercase string for the repository name
id: lowercase-repo-name
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.event.repository.name }}
- name: Checkout base
uses: actions/checkout@v2
with:
fetch-depth: 0
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Download artifact
uses: actions/download-artifact@v3
with:
path: /tmp/images/
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Replace tag without `v`
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v1
id: version
with:
script: |
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
result-encoding: string
- name: Merge and push manifest on master branch
if: github.ref == 'refs/heads/master'
run: python scripts/merge_manifest.py "${{ secrets.DOCKER_USERNAME }}/${{ steps.lowercase-repo-name.outputs.lowercase }}"
- name: Merge and push manifest on release
if: startsWith(github.ref, 'refs/tags/')
run: python scripts/merge_manifest.py "${{ secrets.DOCKER_USERNAME }}/${{ steps.lowercase-repo-name.outputs.lowercase }}" ${{steps.version.outputs.result}}

117
.github/workflows/pre-release.yml vendored Normal file
View File

@@ -0,0 +1,117 @@
name: pre-release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "backend-python/**"
tags-ignore:
- "v*"
jobs:
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- uses: actions/setup-python@v5
id: cp310
with:
python-version: '3.10'
- uses: crazy-max/ghaction-chocolatey@v3
with:
args: install upx
- run: |
Start-BitsTransfer https://github.com/josStorer/ai00_rwkv_server/releases/latest/download/webgpu_server_windows_x86_64.exe ./backend-rust/webgpu_server.exe
Start-BitsTransfer https://github.com/josStorer/web-rwkv-converter/releases/latest/download/web-rwkv-converter_windows_x86_64.exe ./backend-rust/web-rwkv-converter.exe
Start-BitsTransfer https://github.com/josStorer/LibreHardwareMonitor.Console/releases/latest/download/LibreHardwareMonitor.Console.zip ./LibreHardwareMonitor.Console.zip
Expand-Archive ./LibreHardwareMonitor.Console.zip -DestinationPath ./components/LibreHardwareMonitor.Console
Start-BitsTransfer https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip ./python-3.10.11-embed-amd64.zip
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==3.0.4
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==1.9
go install github.com/wailsapp/wails/v2/cmd/wails@latest
del ./backend-python/rwkv_pip/cpp/librwkv.dylib
del ./backend-python/rwkv_pip/cpp/librwkv.so
(Get-Content -Path ./backend-golang/app.go) -replace "//go:custom_build windows ", "" | Set-Content -Path ./backend-golang/app.go
(Get-Content -Path ./backend-golang/utils.go) -replace "//go:custom_build windows ", "" | Set-Content -Path ./backend-golang/utils.go
make
Rename-Item -Path "build/bin/RWKV-Runner.exe" -NewName "RWKV-Runner_windows_x64.exe"
- uses: actions/upload-artifact@v4
with:
name: RWKV-Runner_windows_x64.exe
path: build/bin/RWKV-Runner_windows_x64.exe
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- run: |
wget https://github.com/josStorer/ai00_rwkv_server/releases/latest/download/webgpu_server_linux_x86_64 -O ./backend-rust/webgpu_server
wget https://github.com/josStorer/web-rwkv-converter/releases/latest/download/web-rwkv-converter_linux_x86_64 -O ./backend-rust/web-rwkv-converter
sudo apt-get update
sudo apt-get install upx
sudo apt-get install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libasound2-dev
go install github.com/wailsapp/wails/v2/cmd/wails@latest
rm ./backend-python/rwkv_pip/wkv_cuda.pyd
rm ./backend-python/rwkv_pip/rwkv5.pyd
rm ./backend-python/rwkv_pip/rwkv6.pyd
rm ./backend-python/rwkv_pip/beta/wkv_cuda.pyd
rm ./backend-python/get-pip.py
rm ./backend-python/rwkv_pip/cpp/librwkv.dylib
rm ./backend-python/rwkv_pip/cpp/rwkv.dll
rm ./backend-python/rwkv_pip/webgpu/web_rwkv_py.cp310-win_amd64.pyd
make
mv build/bin/RWKV-Runner build/bin/RWKV-Runner_linux_x64
- uses: actions/upload-artifact@v4
with:
name: RWKV-Runner_linux_x64
path: build/bin/RWKV-Runner_linux_x64
macos:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- run: |
wget https://github.com/josStorer/ai00_rwkv_server/releases/latest/download/webgpu_server_darwin_aarch64 -O ./backend-rust/webgpu_server
wget https://github.com/josStorer/web-rwkv-converter/releases/latest/download/web-rwkv-converter_darwin_aarch64 -O ./backend-rust/web-rwkv-converter
go install github.com/wailsapp/wails/v2/cmd/wails@latest
rm ./backend-python/rwkv_pip/wkv_cuda.pyd
rm ./backend-python/rwkv_pip/rwkv5.pyd
rm ./backend-python/rwkv_pip/rwkv6.pyd
rm ./backend-python/rwkv_pip/beta/wkv_cuda.pyd
rm ./backend-python/get-pip.py
rm ./backend-python/rwkv_pip/cpp/rwkv.dll
rm ./backend-python/rwkv_pip/cpp/librwkv.so
rm ./backend-python/rwkv_pip/webgpu/web_rwkv_py.cp310-win_amd64.pyd
make
cp build/darwin/Readme_Install.txt build/bin/Readme_Install.txt
cp build/bin/RWKV-Runner.app/Contents/MacOS/RWKV-Runner build/bin/RWKV-Runner_darwin_universal
cd build/bin && zip -r RWKV-Runner_macos_universal.zip RWKV-Runner.app Readme_Install.txt
- uses: actions/upload-artifact@v4
with:
name: RWKV-Runner_macos_universal.zip
path: build/bin/RWKV-Runner_macos_universal.zip

View File

@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: master
@@ -38,17 +38,17 @@ jobs:
runs-on: windows-2022
needs: create-draft
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
id: cp310
with:
python-version: '3.10'
- uses: crazy-max/ghaction-chocolatey@v2
- uses: crazy-max/ghaction-chocolatey@v3
with:
args: install upx
- run: |
@@ -78,10 +78,10 @@ jobs:
runs-on: ubuntu-20.04
needs: create-draft
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- run: |
@@ -108,10 +108,10 @@ jobs:
runs-on: macos-13
needs: create-draft
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: master
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20.5'
- run: |
@@ -137,5 +137,5 @@ jobs:
runs-on: ubuntu-22.04
needs: [ windows, linux, macos ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: gh release edit ${{github.ref_name}} --draft=false

1
.gitignore vendored
View File

@@ -19,7 +19,6 @@ __pycache__
/cmd-helper.bat
/install-py-dep.bat
/backend-python/wkv_cuda
/backend-python/rwkv*
*.exe
*.old
.DS_Store

View File

@@ -1,8 +1,25 @@
## Changes
- abc music inference support
- basic abc frontend support
- fix finetune errorsMap ($modelInfo)
### Features
- add Docker support (#291) @LonghronShen
### Fixes
- fix a generation exception caused by potentially dangerous regex being passed into the stop array
- fix max_tokens parameter of Chat page not being passed to backend
- fix the issue where penalty_decay and global_penalty are not being passed to the backend default config when running
the model through client
### Improvements
- prevent 'torch' has no attribute 'cuda' error in torch_gc, so user can use CPU or WebGPU (#302)
### Chores
- bump dependencies
- add pre-release workflow
- dep_check.py now ignores GPUtil
## Install

55
Dockerfile Normal file
View File

@@ -0,0 +1,55 @@
FROM node:21-slim AS frontend
RUN echo "registry=https://registry.npmmirror.com/" > ~/.npmrc
WORKDIR /app
COPY manifest.json manifest.json
COPY frontend frontend
WORKDIR /app/frontend
RUN npm ci
RUN npm run build
FROM nvidia/cuda:11.6.1-devel-ubuntu20.04 AS runtime
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -yq git curl wget build-essential ninja-build aria2 jq software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt install -y g++-11 python3.10 python3.10-distutils python3.10-dev && \
curl -sS http://mirrors.aliyun.com/pypi/get-pip.py | python3.10
RUN python3.10 -m pip install cmake
FROM runtime AS librwkv
WORKDIR /app
RUN git clone https://github.com/RWKV/rwkv.cpp.git && \
cd rwkv.cpp && \
git submodule update --init --recursive && \
mkdir -p build && \
cd build && \
cmake -G Ninja .. && \
cmake --build .
FROM runtime AS final
WORKDIR /app
COPY ./backend-python/requirements.txt ./backend-python/requirements.txt
RUN python3.10 -m pip install --quiet -r ./backend-python/requirements.txt
COPY . .
COPY --from=frontend /app/frontend/dist /app/frontend/dist
COPY --from=librwkv /app/rwkv.cpp/build/librwkv.so /app/backend-python/rwkv_pip/cpp/librwkv.so
EXPOSE 27777
CMD ["python3.10", "./backend-python/main.py", "--port", "27777", "--host", "0.0.0.0", "--webui"]

View File

@@ -8,7 +8,8 @@ endif
build-windows:
@echo ---- build for windows
wails build -upx -ldflags '-s -w -extldflags "-static"' -platform windows/amd64
wails build -ldflags '-s -w -extldflags "-static"' -platform windows/amd64
upx -9 --lzma ./build/bin/RWKV-Runner.exe
build-macos:
@echo ---- build for macos
@@ -16,7 +17,8 @@ build-macos:
build-linux:
@echo ---- build for linux
wails build -upx -ldflags '-s -w' -platform linux/amd64
wails build -ldflags '-s -w' -platform linux/amd64
upx -9 --lzma ./build/bin/RWKV-Runner
build-web:
@echo ---- build for web

View File

@@ -12,6 +12,7 @@ compatible with the OpenAI API, which means that every ChatGPT client is an RWKV
[![license][license-image]][license-url]
[![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
English | [简体中文](README_ZH.md) | [日本語](README_JA.md)
@@ -31,6 +32,10 @@ English | [简体中文](README_ZH.md) | [日本語](README_JA.md)
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows
@@ -231,10 +236,12 @@ computer keyboard as MIDI input.
- ChatRWKV: https://github.com/BlinkDL/ChatRWKV
- RWKV-LM: https://github.com/BlinkDL/RWKV-LM
- RWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA
- RWKV-v5-lora: https://github.com/JL-er/RWKV-v5-lora
- MIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer
- ai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server
- rwkv.cpp: https://github.com/saharNooby/rwkv.cpp
- web-rwkv-py: https://github.com/cryscan/web-rwkv-py
- web-rwkv: https://github.com/cryscan/web-rwkv
## Preview

View File

@@ -12,6 +12,7 @@
[![license][license-image]][license-url]
[![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
[English](README.md) | [简体中文](README_ZH.md) | 日本語
@@ -31,6 +32,10 @@
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows
@@ -228,10 +233,12 @@ MIDIキーボードをお持ちでない場合、`Virtual Midi Controller 3 LE`
- ChatRWKV: https://github.com/BlinkDL/ChatRWKV
- RWKV-LM: https://github.com/BlinkDL/RWKV-LM
- RWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA
- RWKV-v5-lora: https://github.com/JL-er/RWKV-v5-lora
- MIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer
- ai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server
- rwkv.cpp: https://github.com/saharNooby/rwkv.cpp
- web-rwkv-py: https://github.com/cryscan/web-rwkv-py
- web-rwkv: https://github.com/cryscan/web-rwkv
## Preview

View File

@@ -11,6 +11,7 @@ API兼容的接口这意味着一切ChatGPT客户端都是RWKV客户端。
[![license][license-image]][license-url]
[![release][release-image]][release-url]
[![py-version][py-version-image]][py-version-url]
[English](README.md) | 简体中文 | [日本語](README_JA.md)
@@ -30,6 +31,10 @@ API兼容的接口这意味着一切ChatGPT客户端都是RWKV客户端。
[release-url]: https://github.com/josStorer/RWKV-Runner/releases/latest
[py-version-image]: https://img.shields.io/pypi/pyversions/fastapi.svg
[py-version-url]: https://github.com/josStorer/RWKV-Runner/tree/master/backend-python
[download-url]: https://github.com/josStorer/RWKV-Runner/releases
[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows
@@ -210,10 +215,12 @@ for i in np.argsort(embeddings_cos_sim)[::-1]:
- ChatRWKV: https://github.com/BlinkDL/ChatRWKV
- RWKV-LM: https://github.com/BlinkDL/RWKV-LM
- RWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA
- RWKV-v5-lora: https://github.com/JL-er/RWKV-v5-lora
- MIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer
- ai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server
- rwkv.cpp: https://github.com/saharNooby/rwkv.cpp
- web-rwkv-py: https://github.com/cryscan/web-rwkv-py
- web-rwkv: https://github.com/cryscan/web-rwkv
## Preview

View File

@@ -1,7 +1,9 @@
package backend_golang
import (
"archive/zip"
"bufio"
"bytes"
"context"
"errors"
"io"
@@ -10,6 +12,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"
@@ -23,6 +26,7 @@ type App struct {
ctx context.Context
HasConfigData bool
ConfigData map[string]any
Dev bool
exDir string
cmdPrefix string
}
@@ -39,10 +43,20 @@ func (a *App) OnStartup(ctx context.Context) {
a.exDir = ""
a.cmdPrefix = ""
if runtime.GOOS == "darwin" {
ex, _ := os.Executable()
a.exDir = filepath.Dir(ex) + "/../../../"
a.cmdPrefix = "cd " + a.exDir + " && "
ex, err := os.Executable()
if err == nil {
if runtime.GOOS == "darwin" {
a.exDir = filepath.Dir(ex) + "/../../../"
a.cmdPrefix = "cd " + a.exDir + " && "
} else {
a.exDir = filepath.Dir(ex) + "/"
a.cmdPrefix = "cd " + a.exDir + " && "
}
if a.Dev {
a.exDir = ""
} else {
os.Chdir(a.exDir)
}
}
os.Chmod(a.exDir+"backend-rust/webgpu_server", 0777)
@@ -50,9 +64,9 @@ func (a *App) OnStartup(ctx context.Context) {
os.Mkdir(a.exDir+"models", os.ModePerm)
os.Mkdir(a.exDir+"lora-models", os.ModePerm)
os.Mkdir(a.exDir+"finetune/json2binidx_tool/data", os.ModePerm)
trainLogPath := a.exDir + "lora-models/train_log.txt"
trainLogPath := "lora-models/train_log.txt"
if !a.FileExists(trainLogPath) {
f, err := os.Create(trainLogPath)
f, err := os.Create(a.exDir + trainLogPath)
if err == nil {
f.Close()
}
@@ -149,6 +163,7 @@ func (a *App) UpdateApp(url string) (broken bool, err error) {
ticker := time.NewTicker(250 * time.Millisecond)
defer ticker.Stop()
// update progress
go func() {
for {
<-ticker.C
@@ -168,13 +183,35 @@ func (a *App) UpdateApp(url string) (broken bool, err error) {
}
}
}()
err = selfupdate.Apply(pr, selfupdate.Options{})
var updateFile io.Reader = pr
// extract macos binary from zip
if strings.HasSuffix(url, ".zip") && runtime.GOOS == "darwin" {
zipBytes, err := io.ReadAll(pr)
if err != nil {
return false, err
}
archive, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
if err != nil {
return false, err
}
file, err := archive.Open("RWKV-Runner.app/Contents/MacOS/RWKV-Runner")
if err != nil {
return false, err
}
defer file.Close()
updateFile = file
}
// apply update
err = selfupdate.Apply(updateFile, selfupdate.Options{})
if err != nil {
if rerr := selfupdate.RollbackError(err); rerr != nil {
return true, rerr
}
return false, err
}
// restart app
if runtime.GOOS == "windows" {
name, err := os.Executable()
if err != nil {

View File

@@ -10,7 +10,11 @@ import (
)
func (a *App) DownloadFile(path string, url string) error {
_, err := grab.Get(a.exDir+path, url)
absPath, err := a.GetAbsPath(path)
if err != nil {
return err
}
_, err = grab.Get(absPath, url)
if err != nil {
return err
}
@@ -88,11 +92,15 @@ func (a *App) ContinueDownload(url string) {
}
func (a *App) AddToDownloadList(path string, url string) {
if !existsInDownloadList(a.exDir+path, url) {
absPath, err := a.GetAbsPath(path)
if err != nil {
return
}
if !existsInDownloadList(absPath, url) {
downloadList = append(downloadList, &DownloadStatus{
resp: nil,
Name: filepath.Base(path),
Path: a.exDir + path,
Path: absPath,
Url: url,
Downloading: false,
})

View File

@@ -14,27 +14,55 @@ import (
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
)
func (a *App) GetAbsPath(path string) (string, error) {
var absPath string
var err error
if filepath.IsAbs(path) {
absPath = filepath.Clean(path)
} else {
absPath, err = filepath.Abs(filepath.Join(a.exDir, path))
if err != nil {
return "", err
}
}
absPath = strings.ReplaceAll(absPath, "/", string(os.PathSeparator))
println("GetAbsPath:", absPath)
return absPath, nil
}
func (a *App) SaveFile(path string, savedContent []byte) error {
if err := os.WriteFile(a.exDir+path, savedContent, 0644); err != nil {
absPath, err := a.GetAbsPath(path)
if err != nil {
return err
}
if err := os.WriteFile(absPath, savedContent, 0644); err != nil {
return err
}
return nil
}
func (a *App) SaveJson(fileName string, jsonData any) error {
func (a *App) SaveJson(path string, jsonData any) error {
text, err := json.MarshalIndent(jsonData, "", " ")
if err != nil {
return err
}
if err := os.WriteFile(a.exDir+fileName, text, 0644); err != nil {
absPath, err := a.GetAbsPath(path)
if err != nil {
return err
}
if err := os.WriteFile(absPath, text, 0644); err != nil {
return err
}
return nil
}
func (a *App) ReadJson(fileName string) (any, error) {
file, err := os.ReadFile(a.exDir + fileName)
func (a *App) ReadJson(path string) (any, error) {
absPath, err := a.GetAbsPath(path)
if err != nil {
return nil, err
}
file, err := os.ReadFile(absPath)
if err != nil {
return nil, err
}
@@ -48,8 +76,12 @@ func (a *App) ReadJson(fileName string) (any, error) {
return data, nil
}
func (a *App) FileExists(fileName string) bool {
_, err := os.Stat(a.exDir + fileName)
func (a *App) FileExists(path string) bool {
absPath, err := a.GetAbsPath(path)
if err != nil {
return false
}
_, err = os.Stat(absPath)
return err == nil
}
@@ -60,8 +92,12 @@ type FileInfo struct {
ModTime string `json:"modTime"`
}
func (a *App) ReadFileInfo(fileName string) (*FileInfo, error) {
info, err := os.Stat(a.exDir + fileName)
func (a *App) ReadFileInfo(path string) (*FileInfo, error) {
absPath, err := a.GetAbsPath(path)
if err != nil {
return nil, err
}
info, err := os.Stat(absPath)
if err != nil {
return nil, err
}
@@ -74,7 +110,11 @@ func (a *App) ReadFileInfo(fileName string) (*FileInfo, error) {
}
func (a *App) ListDirFiles(dirPath string) ([]FileInfo, error) {
files, err := os.ReadDir(a.exDir + dirPath)
absDirPath, err := a.GetAbsPath(dirPath)
if err != nil {
return nil, err
}
files, err := os.ReadDir(absDirPath)
if err != nil {
return nil, err
}
@@ -96,7 +136,11 @@ func (a *App) ListDirFiles(dirPath string) ([]FileInfo, error) {
}
func (a *App) DeleteFile(path string) error {
err := os.Remove(a.exDir + path)
absPath, err := a.GetAbsPath(path)
if err != nil {
return err
}
err = os.Remove(absPath)
if err != nil {
return err
}
@@ -104,18 +148,27 @@ func (a *App) DeleteFile(path string) error {
}
func (a *App) CopyFile(src string, dst string) error {
sourceFile, err := os.Open(a.exDir + src)
absSrc, err := a.GetAbsPath(src)
if err != nil {
return err
}
absDst, err := a.GetAbsPath(dst)
if err != nil {
return err
}
sourceFile, err := os.Open(absSrc)
if err != nil {
return err
}
defer sourceFile.Close()
err = os.MkdirAll(a.exDir+dst[:strings.LastIndex(dst, "/")], 0755)
err = os.MkdirAll(filepath.Dir(absDst), 0755)
if err != nil {
return err
}
destFile, err := os.Create(a.exDir + dst)
destFile, err := os.Create(absDst)
if err != nil {
return err
}
@@ -166,14 +219,8 @@ func (a *App) OpenOpenFileDialog(filterPattern string) (string, error) {
return path, nil
}
func (a *App) OpenFileFolder(path string, relative bool) error {
var absPath string
var err error
if relative {
absPath, err = filepath.Abs(a.exDir + path)
} else {
absPath, err = filepath.Abs(path)
}
func (a *App) OpenFileFolder(path string) error {
absPath, err := a.GetAbsPath(path)
if err != nil {
return err
}

View File

@@ -1,3 +1,4 @@
// Considering some whitespace and multilingual support, the functions in rwkv.go should always be executed with cwd as RWKV-Runner, and never use a.GetAbsPath() here.
package backend_golang
import (
@@ -11,14 +12,18 @@ import (
)
func (a *App) StartServer(python string, port int, host string, webui bool, rwkvBeta bool, rwkvcpp bool, webgpu bool) (string, error) {
var err error
execFile := "./backend-python/main.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
if err != nil {
return "", err
}
args := []string{python, "./backend-python/main.py"}
args := []string{python, execFile}
if webui {
args = append(args, "--webui")
}
@@ -36,41 +41,77 @@ func (a *App) StartServer(python string, port int, host string, webui bool, rwkv
}
func (a *App) StartWebGPUServer(port int, host string) (string, error) {
args := []string{"./backend-rust/webgpu_server"}
var execFile string
execFiles := []string{"./backend-rust/webgpu_server", "./backend-rust/webgpu_server.exe"}
for _, file := range execFiles {
_, err := os.Stat(file)
if err == nil {
execFile = file
break
}
}
if execFile == "" {
return "", errors.New(execFiles[0] + " not found")
}
args := []string{execFile}
args = append(args, "--port", strconv.Itoa(port), "--ip", host)
return Cmd(args...)
}
func (a *App) ConvertModel(python string, modelPath string, strategy string, outPath string) (string, error) {
var err error
execFile := "./backend-python/convert_model.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
if err != nil {
return "", err
}
return Cmd(python, "./backend-python/convert_model.py", "--in", modelPath, "--out", outPath, "--strategy", strategy)
return Cmd(python, execFile, "--in", modelPath, "--out", outPath, "--strategy", strategy)
}
func (a *App) ConvertSafetensors(modelPath string, outPath string) (string, error) {
args := []string{"./backend-rust/web-rwkv-converter"}
var execFile string
execFiles := []string{"./backend-rust/web-rwkv-converter", "./backend-rust/web-rwkv-converter.exe"}
for _, file := range execFiles {
_, err := os.Stat(file)
if err == nil {
execFile = file
break
}
}
if execFile == "" {
return "", errors.New(execFiles[0] + " not found")
}
args := []string{execFile}
args = append(args, "--input", modelPath, "--output", outPath)
return Cmd(args...)
}
func (a *App) ConvertSafetensorsWithPython(python string, modelPath string, outPath string) (string, error) {
var err error
execFile := "./backend-python/convert_safetensors.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
if err != nil {
return "", err
}
return Cmd(python, "./backend-python/convert_safetensors.py", "--input", modelPath, "--output", outPath)
return Cmd(python, execFile, "--input", modelPath, "--output", outPath)
}
func (a *App) ConvertGGML(python string, modelPath string, outPath string, Q51 bool) (string, error) {
var err error
execFile := "./backend-python/convert_pytorch_to_ggml.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
@@ -81,11 +122,15 @@ func (a *App) ConvertGGML(python string, modelPath string, outPath string, Q51 b
if Q51 {
dataType = "Q5_1"
}
return Cmd(python, "./backend-python/convert_pytorch_to_ggml.py", modelPath, outPath, dataType)
return Cmd(python, execFile, modelPath, outPath, dataType)
}
func (a *App) ConvertData(python string, input string, outputPrefix string, vocab string) (string, error) {
var err error
execFile := "./finetune/json2binidx_tool/tools/preprocess_data.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
@@ -129,19 +174,23 @@ func (a *App) ConvertData(python string, input string, outputPrefix string, voca
return "", err
}
return Cmd(python, "./finetune/json2binidx_tool/tools/preprocess_data.py", "--input", input, "--output-prefix", outputPrefix, "--vocab", vocab,
return Cmd(python, execFile, "--input", input, "--output-prefix", outputPrefix, "--vocab", vocab,
"--tokenizer-type", tokenizerType, "--dataset-impl", "mmap", "--append-eod")
}
func (a *App) MergeLora(python string, useGpu bool, loraAlpha int, baseModel string, loraPath string, outputPath string) (string, error) {
var err error
execFile := "./finetune/lora/merge_lora.py"
_, err := os.Stat(execFile)
if err != nil {
return "", err
}
if python == "" {
python, err = GetPython()
}
if err != nil {
return "", err
}
args := []string{python, "./finetune/lora/merge_lora.py"}
args := []string{python, execFile}
if useGpu {
args = append(args, "--use-gpu")
}
@@ -157,9 +206,9 @@ func (a *App) DepCheck(python string) error {
if err != nil {
return err
}
out, err := exec.Command(python, a.exDir+"./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 errors.New("DepCheck Error: " + string(out) + " GError: " + err.Error())
}
return nil
}
@@ -185,7 +234,7 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if !cnMirror {
installScript = strings.Replace(installScript, " -i https://pypi.tuna.tsinghua.edu.cn/simple", "", -1)
}
err = os.WriteFile("./install-py-dep.bat", []byte(installScript), 0644)
err = os.WriteFile(a.exDir+"install-py-dep.bat", []byte(installScript), 0644)
if err != nil {
return "", err
}

View File

@@ -23,14 +23,19 @@ func CmdHelper(hideWindow bool, args ...string) (*exec.Cmd, error) {
if runtime.GOOS != "windows" {
return nil, errors.New("unsupported OS")
}
filename := "./cmd-helper.bat"
_, err := os.Stat(filename)
ex, err := os.Executable()
if err != nil {
if err := os.WriteFile(filename, []byte("start %*"), 0644); err != nil {
return nil, err
}
exDir := filepath.Dir(ex) + "/"
path := exDir + "cmd-helper.bat"
_, err = os.Stat(path)
if err != nil {
if err := os.WriteFile(path, []byte("start %*"), 0644); err != nil {
return nil, err
}
}
cmdHelper, err := filepath.Abs(filename)
cmdHelper, err := filepath.Abs(path)
if err != nil {
return nil, err
}
@@ -86,16 +91,18 @@ func Cmd(args ...string) (string, error) {
}
func CopyEmbed(efs embed.FS) error {
prefix := ""
ex, err := os.Executable()
if err != nil {
return err
}
var prefix string
if runtime.GOOS == "darwin" {
ex, err := os.Executable()
if err != nil {
return err
}
prefix = filepath.Dir(ex) + "/../../../"
} else {
prefix = filepath.Dir(ex) + "/"
}
err := fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
err = fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
return nil
}
@@ -136,13 +143,19 @@ func CopyEmbed(efs embed.FS) error {
func GetPython() (string, error) {
switch platform := runtime.GOOS; platform {
case "windows":
_, err := os.Stat("py310/python.exe")
ex, err := os.Executable()
if err != nil {
_, err := os.Stat("python-3.10.11-embed-amd64.zip")
return "", err
}
exDir := filepath.Dir(ex) + "/"
pyexe := exDir + "py310/python.exe"
_, err = os.Stat(pyexe)
if err != nil {
_, err := os.Stat(exDir + "python-3.10.11-embed-amd64.zip")
if err != nil {
return "", errors.New("python zip not found")
} else {
err := Unzip("python-3.10.11-embed-amd64.zip", "py310")
err := Unzip(exDir+"python-3.10.11-embed-amd64.zip", exDir+"py310")
if err != nil {
return "", errors.New("failed to unzip python")
} else {

View File

@@ -9,7 +9,6 @@ import (
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
@@ -133,26 +132,20 @@ func (a *App) WslStop() error {
}
func (a *App) WslIsEnabled() error {
ex, err := os.Executable()
if err != nil {
return err
}
exDir := filepath.Dir(ex)
data, err := os.ReadFile(exDir + "/wsl.state")
data, err := os.ReadFile(a.exDir + "wsl.state")
if err == nil {
if strings.Contains(string(data), "Enabled") {
return nil
}
}
cmd := `-Command (Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux).State | Out-File -Encoding utf8 -FilePath ` + exDir + "/wsl.state"
_, err = su.ShellExecute(su.RUNAS, "powershell", cmd, exDir)
cmd := `-Command (Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform).State | Out-File -Encoding utf8 -FilePath ` + a.exDir + "wsl.state"
_, err = su.ShellExecute(su.RUNAS, "powershell", cmd, a.exDir)
if err != nil {
return err
}
time.Sleep(2 * time.Second)
data, err = os.ReadFile(exDir + "/wsl.state")
data, err = os.ReadFile(a.exDir + "wsl.state")
if err != nil {
return err
}
@@ -164,13 +157,13 @@ func (a *App) WslIsEnabled() error {
}
func (a *App) WslEnable(forceMode bool) error {
cmd := `/online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux`
cmd := `/online /enable-feature /featurename:VirtualMachinePlatform`
_, err := su.ShellExecute(su.RUNAS, "dism", cmd, `C:\`)
if err != nil {
return err
}
if forceMode {
os.WriteFile("./wsl.state", []byte("Enabled"), 0644)
os.WriteFile(a.exDir+"wsl.state", []byte("Enabled"), 0644)
}
return nil
}

View File

@@ -54,19 +54,21 @@ def convert_file(pt_filename: str, sf_filename: str, rename={}, transpose_names=
loaded[k].unsqueeze(1).repeat(1, n_emb // loaded[k].shape[0])
)
for k in kk:
new_k = rename_key(rename, k).lower()
v = loaded[k].half()
del loaded[k]
for transpose_name in transpose_names:
if transpose_name in k:
v = v.transpose(0, 1)
print(f"{new_k}\t{v.shape}\t{v.dtype}")
loaded[new_k] = {
"dtype": str(v.dtype).split(".")[-1],
"shape": v.shape,
"data": v.numpy().tobytes(),
}
with torch.no_grad():
for k in kk:
new_k = rename_key(rename, k).lower()
v = loaded[k].half()
del loaded[k]
for transpose_name in transpose_names:
if transpose_name in new_k:
dims = len(v.shape)
v = v.transpose(dims - 2, dims - 1)
print(f"{new_k}\t{v.shape}\t{v.dtype}")
loaded[new_k] = {
"dtype": str(v.dtype).split(".")[-1],
"shape": v.shape,
"data": v.numpy().tobytes(),
}
dirname = os.path.dirname(sf_filename)
os.makedirs(dirname, exist_ok=True)

View File

@@ -7,7 +7,6 @@ import lm_dataformat
import ftfy
import tqdm
import tiktoken
import GPUtil
import torch
import rwkv

View File

@@ -5,6 +5,7 @@ Model = "model"
Model_Status = "model_status"
Model_Config = "model_config"
Deploy_Mode = "deploy_mode"
Midi_Vocab_Config_Type = "midi_vocab_config_type"
class ModelStatus(Enum):
@@ -13,11 +14,17 @@ class ModelStatus(Enum):
Working = 3
class MidiVocabConfig(Enum):
Default = auto()
Piano = auto()
def init():
global GLOBALS
GLOBALS = {}
set(Model_Status, ModelStatus.Offline)
set(Deploy_Mode, False)
set(Midi_Vocab_Config_Type, MidiVocabConfig.Default)
def set(key, value):

View File

@@ -1,9 +1,9 @@
torch
torchvision
torchaudio
rwkv==0.8.22
rwkv==0.8.25
langchain==0.0.322
fastapi==0.104.0
fastapi==0.109.1
uvicorn==0.23.2
sse-starlette==1.6.5
pydantic==2.4.2
@@ -19,7 +19,7 @@ midi2audio==0.1.1
mido==1.3.0
safetensors==0.4.0
PyMuPDF==1.23.5
python-multipart==0.0.6
python-multipart==0.0.7
Cython==3.0.4
cyac==1.9
torch_directml==0.1.13.1.dev230413
torch-directml==0.1.13.1.dev230413

View File

@@ -1,9 +1,9 @@
torch
torchvision
torchaudio
rwkv==0.8.22
rwkv==0.8.25
langchain==0.0.322
fastapi==0.104.0
fastapi==0.109.1
uvicorn==0.23.2
sse-starlette==1.6.5
pydantic==2.4.2
@@ -19,5 +19,5 @@ midi2audio==0.1.1
mido==1.3.0
safetensors==0.4.0
PyMuPDF==1.23.5
python-multipart==0.0.6
python-multipart==0.0.7
Cython==3.0.4

View File

@@ -70,10 +70,10 @@ class ChatCompletionBody(ModelConfigBody):
"assistant_name": None,
"presystem": True,
"max_tokens": 1000,
"temperature": 1.2,
"top_p": 0.5,
"presence_penalty": 0.4,
"frequency_penalty": 0.4,
"temperature": 1,
"top_p": 0.3,
"presence_penalty": 0,
"frequency_penalty": 1,
}
}
}
@@ -94,10 +94,10 @@ class CompletionBody(ModelConfigBody):
"stream": False,
"stop": None,
"max_tokens": 100,
"temperature": 1.2,
"top_p": 0.5,
"presence_penalty": 0.4,
"frequency_penalty": 0.4,
"temperature": 1,
"top_p": 0.3,
"presence_penalty": 0,
"frequency_penalty": 1,
}
}
}
@@ -144,6 +144,7 @@ async def eval_rwkv(
return
set_rwkv_config(model, global_var.get(global_var.Model_Config))
set_rwkv_config(model, body)
print(get_rwkv_config(model))
response, prompt_tokens, completion_tokens = "", 0, 0
for response, delta, prompt_tokens, completion_tokens in model.generate(
@@ -155,23 +156,27 @@ async def eval_rwkv(
if stream:
yield json.dumps(
{
"object": "chat.completion.chunk"
if chat_mode
else "text_completion",
"object": (
"chat.completion.chunk"
if chat_mode
else "text_completion"
),
# "response": response,
"model": model.name,
"choices": [
{
"delta": {"content": delta},
"index": 0,
"finish_reason": None,
}
if chat_mode
else {
"text": delta,
"index": 0,
"finish_reason": None,
}
(
{
"delta": {"content": delta},
"index": 0,
"finish_reason": None,
}
if chat_mode
else {
"text": delta,
"index": 0,
"finish_reason": None,
}
)
],
}
)
@@ -193,23 +198,25 @@ async def eval_rwkv(
if stream:
yield json.dumps(
{
"object": "chat.completion.chunk"
if chat_mode
else "text_completion",
"object": (
"chat.completion.chunk" if chat_mode else "text_completion"
),
# "response": response,
"model": model.name,
"choices": [
{
"delta": {},
"index": 0,
"finish_reason": "stop",
}
if chat_mode
else {
"text": "",
"index": 0,
"finish_reason": "stop",
}
(
{
"delta": {},
"index": 0,
"finish_reason": "stop",
}
if chat_mode
else {
"text": "",
"index": 0,
"finish_reason": "stop",
}
)
],
}
)
@@ -225,20 +232,22 @@ async def eval_rwkv(
"total_tokens": prompt_tokens + completion_tokens,
},
"choices": [
{
"message": {
"role": Role.Assistant.value,
"content": response,
},
"index": 0,
"finish_reason": "stop",
}
if chat_mode
else {
"text": response,
"index": 0,
"finish_reason": "stop",
}
(
{
"message": {
"role": Role.Assistant.value,
"content": response,
},
"index": 0,
"finish_reason": "stop",
}
if chat_mode
else {
"text": response,
"index": 0,
"finish_reason": "stop",
}
)
],
}

View File

@@ -86,32 +86,53 @@ def switch_model(body: SwitchModelBody, response: Response, request: Request):
if body.deploy:
global_var.set(global_var.Deploy_Mode, True)
if global_var.get(global_var.Model_Config) is None:
global_var.set(
global_var.Model_Config, get_rwkv_config(global_var.get(global_var.Model))
)
saved_model_config = global_var.get(global_var.Model_Config)
init_model_config = get_rwkv_config(global_var.get(global_var.Model))
if saved_model_config is not None:
merge_model(init_model_config, saved_model_config)
global_var.set(global_var.Model_Config, init_model_config)
global_var.set(global_var.Model_Status, global_var.ModelStatus.Working)
return "success"
def merge_model(to_model: BaseModel, from_model: BaseModel):
from_model_fields = [x for x in from_model.dict().keys()]
to_model_fields = [x for x in to_model.dict().keys()]
for field_name in from_model_fields:
if field_name in to_model_fields:
from_value = getattr(from_model, field_name)
if from_value is not None:
setattr(to_model, field_name, from_value)
@router.post("/update-config", tags=["Configs"])
def update_config(body: ModelConfigBody):
"""
Will not update the model config immediately, but set it when completion called to avoid modifications during generation
"""
print(body)
global_var.set(global_var.Model_Config, body)
model_config = global_var.get(global_var.Model_Config)
if model_config is None:
model_config = ModelConfigBody()
global_var.set(global_var.Model_Config, model_config)
merge_model(model_config, body)
print("Updated Model Config:", model_config)
return "success"
@router.get("/status", tags=["Configs"])
def status():
import GPUtil
try:
import GPUtil
gpus = GPUtil.getGPUs()
gpus = GPUtil.getGPUs()
except:
gpus = []
if len(gpus) == 0:
device_name = "CPU"
else:

View File

@@ -23,7 +23,11 @@ class TextToMidiBody(BaseModel):
@router.post("/text-to-midi", tags=["MIDI"])
def text_to_midi(body: TextToMidiBody):
vocab_config = "backend-python/utils/midi_vocab_config.json"
vocab_config_type = global_var.get(global_var.Midi_Vocab_Config_Type)
if vocab_config_type == global_var.MidiVocabConfig.Piano:
vocab_config = "backend-python/utils/vocab_config_piano.json"
else:
vocab_config = "backend-python/utils/midi_vocab_config.json"
cfg = VocabConfig.from_json(vocab_config)
mid = convert_str_to_midi(cfg, body.text.strip())
mid_data = io.BytesIO()
@@ -35,7 +39,11 @@ def text_to_midi(body: TextToMidiBody):
@router.post("/midi-to-text", tags=["MIDI"])
async def midi_to_text(file_data: UploadFile):
vocab_config = "backend-python/utils/midi_vocab_config.json"
vocab_config_type = global_var.get(global_var.Midi_Vocab_Config_Type)
if vocab_config_type == global_var.MidiVocabConfig.Piano:
vocab_config = "backend-python/utils/vocab_config_piano.json"
else:
vocab_config = "backend-python/utils/midi_vocab_config.json"
cfg = VocabConfig.from_json(vocab_config)
filter_config = "backend-python/utils/midi_filter_config.json"
filter_cfg = FilterConfig.from_json(filter_config)
@@ -69,7 +77,11 @@ def txt_to_midi(body: TxtToMidiBody):
if not body.midi_path.startswith("midi/"):
raise HTTPException(status.HTTP_400_BAD_REQUEST, "bad output path")
vocab_config = "backend-python/utils/midi_vocab_config.json"
vocab_config_type = global_var.get(global_var.Midi_Vocab_Config_Type)
if vocab_config_type == global_var.MidiVocabConfig.Piano:
vocab_config = "backend-python/utils/vocab_config_piano.json"
else:
vocab_config = "backend-python/utils/midi_vocab_config.json"
cfg = VocabConfig.from_json(vocab_config)
with open(body.txt_path, "r") as f:
text = f.read()

View File

@@ -76,6 +76,31 @@ class AddStateBody(BaseModel):
logits: Any
def copy_tensor_to_cpu(tensors):
import torch
import numpy as np
devices: List[torch.device] = []
copied: Union[Any, None] = None
tensors_type = type(tensors)
if tensors_type == list:
if hasattr(tensors[0], "device"): # torch state
devices = [tensor.device for tensor in tensors]
copied = [tensor.cpu() for tensor in tensors]
else: # WebGPU logits
copied = tensors
elif tensors_type == torch.Tensor: # torch logits
devices = [tensors.device]
copied = tensors.cpu()
elif tensors_type == np.ndarray: # rwkv.cpp
copied = tensors
else: # WebGPU state
copied = tensors.back()
return copied, devices
# @router.post("/add-state", tags=["State Cache"])
def add_state(body: AddStateBody):
global trie, dtrie, loop_del_trie_id
@@ -91,23 +116,24 @@ def add_state(body: AddStateBody):
try:
devices: List[torch.device] = []
logits_device: Union[torch.device, None] = None
state: Union[Any, None] = None
logits: Union[Any, None] = None
if body.state is not None:
if type(body.state) == list and hasattr(body.state[0], "device"): # torch
devices = [tensor.device for tensor in body.state]
state = [tensor.cpu() for tensor in body.state]
elif type(body.state) == np.ndarray: # rwkv.cpp
state = body.state
else: # WebGPU
state = body.state.back()
state, devices = copy_tensor_to_cpu(body.state)
if body.logits is not None:
logits, logits_devices = copy_tensor_to_cpu(body.logits)
if len(logits_devices) > 0:
logits_device = logits_devices[0]
id: int = trie.insert(body.prompt)
dtrie[id] = {
"tokens": body.tokens,
"state": state,
"logits": body.logits,
"logits": logits,
"devices": devices,
"logits_device": logits_device,
}
if len(trie) >= max_trie_len:
@@ -125,6 +151,7 @@ def add_state(body: AddStateBody):
)
return "success"
except Exception as e:
print(e) # should not happen
raise HTTPException(
status.HTTP_400_BAD_REQUEST, f"insert failed, bad prompt.\n{e}"
)
@@ -192,18 +219,33 @@ def longest_prefix_state(body: LongestPrefixStateBody, request: Request):
if id != -1:
prompt: str = trie[id]
v = dtrie[id]
tokens: List[Union[str, int]] = copy.deepcopy(v["tokens"])
devices: List[torch.device] = v["devices"]
logits_device: Union[torch.device, None] = v["logits_device"]
state: Union[Any, None] = v["state"]
logits: Union[Any, None] = v["logits"]
if type(state) == list and hasattr(state[0], "device"): # torch
state = [tensor.to(devices[i]) for i, tensor in enumerate(state)]
state = [
tensor.to(devices[i])
if devices[i] != torch.device("cpu")
else tensor.clone()
for i, tensor in enumerate(state)
]
logits = (
logits.to(logits_device)
if logits_device != torch.device("cpu")
else logits.clone()
)
else: # rwkv.cpp, WebGPU
logits = np.copy(logits)
quick_log(request, body, "Hit:\n" + prompt)
return {
"prompt": prompt,
"tokens": v["tokens"],
"tokens": tokens,
"state": state,
"logits": v["logits"],
"logits": logits,
}
else:
return {"prompt": "", "tokens": [], "state": None, "logits": None}

View File

@@ -552,7 +552,12 @@ class RWKV(MyModule):
elif ".ln_x" in x: # need fp32 for group_norm
w[x] = w[x].float()
else:
if (len(w[x].shape) == 2) and ("emb" not in x):
if (
(len(w[x].shape) == 2)
and ("emb" not in x)
and ("_w1" not in x)
and ("_w2" not in x)
):
if WTYPE != torch.uint8:
w[x] = w[x].to(dtype=WTYPE)
else:

File diff suppressed because it is too large Load Diff

View File

@@ -171,10 +171,17 @@ class PIPELINE:
all_tokens += [token]
for xxx in occurrence:
occurrence[xxx] *= args.alpha_decay
ttt = self.decode([token])
www = 1
if ttt in " \t0123456789":
www = 0
# elif ttt in '\r\n,.;?!"\':+-*/=#@$%^&_`~|<>\\()[]{},。;“”:?!()【】':
# www = 0.5
if token not in occurrence:
occurrence[token] = 1
occurrence[token] = www
else:
occurrence[token] += 1
occurrence[token] += www
# print(occurrence) # debug
# output

View File

@@ -13,19 +13,40 @@ except ModuleNotFoundError:
class RWKV:
def __init__(self, model_path: str, strategy: str = None):
self.model = wrp.v5.Model(
model_path,
turbo=True,
quant=32 if "i8" in strategy else None,
quant_nf4=26 if "i4" in strategy else None,
)
self.info = wrp.peek_info(model_path)
self.w = {} # fake weight
self.w["emb.weight"] = [0] * wrp.peek_info(model_path).num_vocab
self.w["emb.weight"] = [0] * self.info.num_vocab
self.version = str(self.info.version).lower()
self.wrp = getattr(wrp, self.version)
layer = (
int(s.lstrip("layer"))
for s in strategy.split()
for s in s.split(",")
if s.startswith("layer")
)
chunk_size = (
int(s.lstrip("chunk"))
for s in strategy.split()
for s in s.split(",")
if s.startswith("chunk")
)
args = {
"file": model_path,
"turbo": True,
"quant": next(layer, 31) if "i8" in strategy else 0,
"quant_nf4": next(layer, 26) if "i4" in strategy else 0,
"token_chunk_size": next(chunk_size, 32),
"lora": None,
}
self.model = self.wrp.Model(**args)
def forward(self, tokens: List[int], state: Union[Any, None] = None):
if type(state).__name__ == "BackedState": # memory state
gpu_state = wrp.v5.ModelState(self.model, 1)
gpu_state = self.wrp.ModelState(self.model, 1)
gpu_state.load(state)
else:
gpu_state = state
return wrp.v5.run_one(self.model, tokens, gpu_state)
return self.wrp.run_one(self.model, tokens, gpu_state)

View File

@@ -4,7 +4,7 @@ import os
import pathlib
import copy
import re
from typing import Dict, Iterable, List, Tuple, Union, Type
from typing import Dict, Iterable, List, Tuple, Union, Type, Callable
from utils.log import quick_log
from fastapi import HTTPException
from pydantic import BaseModel, Field
@@ -39,6 +39,8 @@ class AbstractRWKV(ABC):
self.top_k = 0
self.penalty_alpha_presence = 0
self.penalty_alpha_frequency = 1
self.penalty_decay = 0.996
self.global_penalty = False
@abstractmethod
def adjust_occurrence(self, occurrence: Dict, token: int):
@@ -272,6 +274,17 @@ class AbstractRWKV(ABC):
)
if token == self.EOS_ID:
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, "", prompt_token_len, completion_token_len
break
@@ -302,22 +315,25 @@ class AbstractRWKV(ABC):
yield response, "", prompt_token_len, completion_token_len
break
elif type(stop) == list:
stop_exist_regex = "|".join(stop)
matched = re.search(stop_exist_regex, response)
if matched:
try:
state_cache.add_state(
state_cache.AddStateBody(
prompt=prompt + response,
tokens=self.model_tokens,
state=self.model_state,
logits=logits,
exit_flag = False
for s in stop:
if s in response:
try:
state_cache.add_state(
state_cache.AddStateBody(
prompt=prompt + response,
tokens=self.model_tokens,
state=self.model_state,
logits=logits,
)
)
)
except HTTPException:
pass
response = response.split(matched.group())[0]
yield response, "", prompt_token_len, completion_token_len
except HTTPException:
pass
exit_flag = True
response = response.split(s)[0]
yield response, "", prompt_token_len, completion_token_len
break
if exit_flag:
break
out_last = begin + i + 1
if i == self.max_tokens_per_generation - 1:
@@ -360,18 +376,24 @@ class TextRWKV(AbstractRWKV):
self.bot = "Assistant"
self.END_OF_LINE = 11
self.AVOID_REPEAT_TOKENS = []
self.AVOID_REPEAT_TOKENS = set()
AVOID_REPEAT = ""
for i in AVOID_REPEAT:
dd = self.pipeline.encode(i)
assert len(dd) == 1
self.AVOID_REPEAT_TOKENS += dd
self.AVOID_REPEAT_TOKENS.add(dd[0])
self.AVOID_PENALTY_TOKENS = set()
AVOID_PENALTY = '\n,.:?!,。:?!"“”<>[]{}/\\|;~`@#$%^&*()_+-=0123456789 '
for i in AVOID_PENALTY:
dd = self.pipeline.encode(i)
if len(dd) == 1:
self.AVOID_PENALTY_TOKENS.add(dd[0])
self.__preload()
def adjust_occurrence(self, occurrence: Dict, token: int):
for xxx in occurrence:
occurrence[xxx] *= 0.996
occurrence[xxx] *= self.penalty_decay
if token not in occurrence:
occurrence[token] = 1
else:
@@ -379,20 +401,18 @@ class TextRWKV(AbstractRWKV):
def adjust_forward_logits(self, logits: List[float], occurrence: Dict, i: int):
for n in occurrence:
# if n not in self.AVOID_PENALTY_TOKENS:
logits[n] -= (
self.penalty_alpha_presence
+ occurrence[n] * self.penalty_alpha_frequency
)
if i == 0:
# set global_penalty to False to get the same generated results as the official RWKV Gradio
if self.global_penalty and i == 0:
for token in self.model_tokens:
token = int(token)
for xxx in occurrence:
occurrence[xxx] *= 0.996
if token not in occurrence:
occurrence[token] = 1
else:
occurrence[token] += 1
if token not in self.AVOID_PENALTY_TOKENS:
self.adjust_occurrence(occurrence, token)
# Model only saw '\n\n' as [187, 187] before, but the tokenizer outputs [535] for it at the end
def fix_tokens(self, tokens) -> List[int]:
@@ -535,8 +555,10 @@ class MusicAbcRWKV(AbstractRWKV):
def get_tokenizer(tokenizer_len: int):
tokenizer_dir = f"{pathlib.Path(__file__).parent.parent.resolve()}/rwkv_pip/"
if tokenizer_len < 20096:
if tokenizer_len < 2176:
return "abc_tokenizer"
if tokenizer_len < 20096:
return tokenizer_dir + "tokenizer-midipiano.json"
if tokenizer_len < 50277:
return tokenizer_dir + "tokenizer-midi.json"
elif tokenizer_len < 65536:
@@ -545,7 +567,41 @@ def get_tokenizer(tokenizer_len: int):
return "rwkv_vocab_v20230424"
def get_model_path(model_path: str) -> str:
if os.path.isabs(model_path):
return model_path
working_dir: pathlib.Path = pathlib.Path(os.path.abspath(os.getcwd()))
parent_paths: List[pathlib.Path] = [
working_dir, # [cwd](RWKV-Runner)/models/xxx
working_dir.parent, # [cwd](backend-python)/../models/xxx
pathlib.Path(
os.path.abspath(__file__)
).parent.parent, # backend-python/models/xxx
pathlib.Path(
os.path.abspath(__file__)
).parent.parent.parent, # RWKV-Runner/models/xxx
]
child_paths: List[Callable[[pathlib.Path], pathlib.Path]] = [
lambda p: p / model_path,
lambda p: p / "build" / "bin" / model_path, # for dev
]
for parent_path in parent_paths:
for child_path in child_paths:
full_path: pathlib.Path = child_path(parent_path)
if os.path.isfile(full_path):
return str(full_path)
return model_path
def RWKV(model: str, strategy: str, tokenizer: Union[str, None]) -> AbstractRWKV:
model = get_model_path(model)
rwkv_beta = global_var.get(global_var.Args).rwkv_beta
rwkv_cpp = getattr(global_var.get(global_var.Args), "rwkv.cpp")
webgpu = global_var.get(global_var.Args).webgpu
@@ -585,14 +641,29 @@ def RWKV(model: str, strategy: str, tokenizer: Union[str, None]) -> AbstractRWKV
"20B_tokenizer": TextRWKV,
"rwkv_vocab_v20230424": TextRWKV,
"tokenizer-midi": MusicMidiRWKV,
"tokenizer-midipiano": MusicMidiRWKV,
"abc_tokenizer": MusicAbcRWKV,
}
tokenizer_name = os.path.splitext(os.path.basename(tokenizer))[0]
global_var.set(
global_var.Midi_Vocab_Config_Type,
(
global_var.MidiVocabConfig.Piano
if tokenizer_name == "tokenizer-midipiano"
else global_var.MidiVocabConfig.Default
),
)
rwkv: AbstractRWKV
if tokenizer_name in rwkv_map:
rwkv = rwkv_map[tokenizer_name](model, pipeline)
else:
rwkv = TextRWKV(model, pipeline)
tokenizer_name = tokenizer_name.lower()
if "music" in tokenizer_name or "midi" in tokenizer_name:
rwkv = MusicMidiRWKV(model, pipeline)
elif "abc" in tokenizer_name:
rwkv = MusicAbcRWKV(model, pipeline)
else:
rwkv = TextRWKV(model, pipeline)
rwkv.name = filename
return rwkv
@@ -600,19 +671,24 @@ def RWKV(model: str, strategy: str, tokenizer: Union[str, None]) -> AbstractRWKV
class ModelConfigBody(BaseModel):
max_tokens: int = Field(default=None, gt=0, le=102400)
temperature: float = Field(default=None, ge=0, le=2)
temperature: float = Field(default=None, ge=0, le=3)
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)
penalty_decay: float = Field(default=None, ge=0.99, le=0.999)
top_k: int = Field(default=None, ge=0, le=25)
global_penalty: bool = Field(default=None)
model_config = {
"json_schema_extra": {
"example": {
"max_tokens": 1000,
"temperature": 1.2,
"top_p": 0.5,
"presence_penalty": 0.4,
"frequency_penalty": 0.4,
"temperature": 1,
"top_p": 0.3,
"presence_penalty": 0,
"frequency_penalty": 1,
"penalty_decay": 0.996,
"global_penalty": False,
}
}
}
@@ -632,6 +708,12 @@ def set_rwkv_config(model: AbstractRWKV, body: ModelConfigBody):
model.penalty_alpha_presence = body.presence_penalty
if body.frequency_penalty is not None:
model.penalty_alpha_frequency = body.frequency_penalty
if body.penalty_decay is not None:
model.penalty_decay = body.penalty_decay
if body.top_k is not None:
model.top_k = body.top_k
if body.global_penalty is not None:
model.global_penalty = body.global_penalty
def get_rwkv_config(model: AbstractRWKV) -> ModelConfigBody:
@@ -641,4 +723,7 @@ def get_rwkv_config(model: AbstractRWKV) -> ModelConfigBody:
top_p=model.top_p,
presence_penalty=model.penalty_alpha_presence,
frequency_penalty=model.penalty_alpha_frequency,
penalty_decay=model.penalty_decay,
top_k=model.top_k,
global_penalty=model.global_penalty,
)

View File

@@ -19,9 +19,12 @@ def set_torch():
def torch_gc():
import torch
try:
import torch
if torch.cuda.is_available():
with torch.cuda.device(0):
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
if torch.cuda.is_available():
with torch.cuda.device(0):
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
except:
pass # prevent 'torch' has no attribute 'cuda' error, so user can use CPU or WebGPU

View File

@@ -0,0 +1,279 @@
{
"note_events": 128,
"wait_events": 125,
"max_wait_time": 1000,
"velocity_events": 128,
"velocity_bins": 16,
"velocity_exp": 0.33,
"do_token_sorting": true,
"unrolled_tokens": false,
"decode_end_held_note_delay": 5.0,
"decode_fix_repeated_notes": true,
"bin_instrument_names": [
"piano"
],
"ch10_instrument_bin_name": "",
"program_name_to_bin_name": {
"Acoustic Grand Piano": "piano",
"Bright Acoustic Piano": "piano",
"Electric Grand Piano": "piano",
"Honky-tonk Piano": "piano",
"Electric Piano 1 (Rhodes Piano)": "piano",
"Electric Piano 2 (Chorused Piano)": "piano",
"Harpsichord": "piano",
"Clavinet": "piano",
"Celesta": "",
"Glockenspiel": "",
"Music Box": "",
"Vibraphone": "",
"Marimba": "",
"Xylophone": "",
"Tubular Bells": "",
"Dulcimer (Santur)": "",
"Drawbar Organ (Hammond)": "",
"Percussive Organ": "piano",
"Rock Organ": "piano",
"Church Organ": "piano",
"Reed Organ": "piano",
"Accordion (French)": "piano",
"Harmonica": "piano",
"Tango Accordion (Band neon)": "piano",
"Acoustic Guitar (nylon)": "",
"Acoustic Guitar (steel)": "",
"Electric Guitar (jazz)": "",
"Electric Guitar (clean)": "",
"Electric Guitar (muted)": "",
"Overdriven Guitar": "",
"Distortion Guitar": "",
"Guitar harmonics": "",
"Acoustic Bass": "",
"Electric Bass (fingered)": "",
"Electric Bass (picked)": "",
"Fretless Bass": "",
"Slap Bass 1": "",
"Slap Bass 2": "",
"Synth Bass 1": "",
"Synth Bass 2": "",
"Violin": "",
"Viola": "",
"Cello": "",
"Contrabass": "",
"Tremolo Strings": "",
"Pizzicato Strings": "",
"Orchestral Harp": "",
"Timpani": "",
"String Ensemble 1 (strings)": "",
"String Ensemble 2 (slow strings)": "",
"SynthStrings 1": "",
"SynthStrings 2": "",
"Choir Aahs": "",
"Voice Oohs": "",
"Synth Voice": "",
"Orchestra Hit": "",
"Trumpet": "",
"Trombone": "",
"Tuba": "",
"Muted Trumpet": "",
"French Horn": "",
"Brass Section": "",
"SynthBrass 1": "",
"SynthBrass 2": "",
"Soprano Sax": "",
"Alto Sax": "",
"Tenor Sax": "",
"Baritone Sax": "",
"Oboe": "",
"English Horn": "",
"Bassoon": "",
"Clarinet": "",
"Piccolo": "",
"Flute": "",
"Recorder": "",
"Pan Flute": "",
"Blown Bottle": "",
"Shakuhachi": "",
"Whistle": "",
"Ocarina": "",
"Lead 1 (square wave)": "",
"Lead 2 (sawtooth wave)": "",
"Lead 3 (calliope)": "",
"Lead 4 (chiffer)": "",
"Lead 5 (charang)": "",
"Lead 6 (voice solo)": "",
"Lead 7 (fifths)": "",
"Lead 8 (bass + lead)": "",
"Pad 1 (new age Fantasia)": "",
"Pad 2 (warm)": "",
"Pad 3 (polysynth)": "",
"Pad 4 (choir space voice)": "",
"Pad 5 (bowed glass)": "",
"Pad 6 (metallic pro)": "",
"Pad 7 (halo)": "",
"Pad 8 (sweep)": "",
"FX 1 (rain)": "",
"FX 2 (soundtrack)": "",
"FX 3 (crystal)": "",
"FX 4 (atmosphere)": "",
"FX 5 (brightness)": "",
"FX 6 (goblins)": "",
"FX 7 (echoes, drops)": "",
"FX 8 (sci-fi, star theme)": "",
"Sitar": "",
"Banjo": "",
"Shamisen": "",
"Koto": "",
"Kalimba": "",
"Bag pipe": "",
"Fiddle": "",
"Shanai": "",
"Tinkle Bell": "",
"Agogo": "",
"Steel Drums": "",
"Woodblock": "",
"Taiko Drum": "",
"Melodic Tom": "",
"Synth Drum": "",
"Reverse Cymbal": "",
"Guitar Fret Noise": "",
"Breath Noise": "",
"Seashore": "",
"Bird Tweet": "",
"Telephone Ring": "",
"Helicopter": "",
"Applause": "",
"Gunshot": ""
},
"bin_name_to_program_name": {
"piano": "Acoustic Grand Piano"
},
"instrument_names": {
"0": "Acoustic Grand Piano",
"1": "Bright Acoustic Piano",
"2": "Electric Grand Piano",
"3": "Honky-tonk Piano",
"4": "Electric Piano 1 (Rhodes Piano)",
"5": "Electric Piano 2 (Chorused Piano)",
"6": "Harpsichord",
"7": "Clavinet",
"8": "Celesta",
"9": "Glockenspiel",
"10": "Music Box",
"11": "Vibraphone",
"12": "Marimba",
"13": "Xylophone",
"14": "Tubular Bells",
"15": "Dulcimer (Santur)",
"16": "Drawbar Organ (Hammond)",
"17": "Percussive Organ",
"18": "Rock Organ",
"19": "Church Organ",
"20": "Reed Organ",
"21": "Accordion (French)",
"22": "Harmonica",
"23": "Tango Accordion (Band neon)",
"24": "Acoustic Guitar (nylon)",
"25": "Acoustic Guitar (steel)",
"26": "Electric Guitar (jazz)",
"27": "Electric Guitar (clean)",
"28": "Electric Guitar (muted)",
"29": "Overdriven Guitar",
"30": "Distortion Guitar",
"31": "Guitar harmonics",
"32": "Acoustic Bass",
"33": "Electric Bass (fingered)",
"34": "Electric Bass (picked)",
"35": "Fretless Bass",
"36": "Slap Bass 1",
"37": "Slap Bass 2",
"38": "Synth Bass 1",
"39": "Synth Bass 2",
"40": "Violin",
"41": "Viola",
"42": "Cello",
"43": "Contrabass",
"44": "Tremolo Strings",
"45": "Pizzicato Strings",
"46": "Orchestral Harp",
"47": "Timpani",
"48": "String Ensemble 1 (strings)",
"49": "String Ensemble 2 (slow strings)",
"50": "SynthStrings 1",
"51": "SynthStrings 2",
"52": "Choir Aahs",
"53": "Voice Oohs",
"54": "Synth Voice",
"55": "Orchestra Hit",
"56": "Trumpet",
"57": "Trombone",
"58": "Tuba",
"59": "Muted Trumpet",
"60": "French Horn",
"61": "Brass Section",
"62": "SynthBrass 1",
"63": "SynthBrass 2",
"64": "Soprano Sax",
"65": "Alto Sax",
"66": "Tenor Sax",
"67": "Baritone Sax",
"68": "Oboe",
"69": "English Horn",
"70": "Bassoon",
"71": "Clarinet",
"72": "Piccolo",
"73": "Flute",
"74": "Recorder",
"75": "Pan Flute",
"76": "Blown Bottle",
"77": "Shakuhachi",
"78": "Whistle",
"79": "Ocarina",
"80": "Lead 1 (square wave)",
"81": "Lead 2 (sawtooth wave)",
"82": "Lead 3 (calliope)",
"83": "Lead 4 (chiffer)",
"84": "Lead 5 (charang)",
"85": "Lead 6 (voice solo)",
"86": "Lead 7 (fifths)",
"87": "Lead 8 (bass + lead)",
"88": "Pad 1 (new age Fantasia)",
"89": "Pad 2 (warm)",
"90": "Pad 3 (polysynth)",
"91": "Pad 4 (choir space voice)",
"92": "Pad 5 (bowed glass)",
"93": "Pad 6 (metallic pro)",
"94": "Pad 7 (halo)",
"95": "Pad 8 (sweep)",
"96": "FX 1 (rain)",
"97": "FX 2 (soundtrack)",
"98": "FX 3 (crystal)",
"99": "FX 4 (atmosphere)",
"100": "FX 5 (brightness)",
"101": "FX 6 (goblins)",
"102": "FX 7 (echoes, drops)",
"103": "FX 8 (sci-fi, star theme)",
"104": "Sitar",
"105": "Banjo",
"106": "Shamisen",
"107": "Koto",
"108": "Kalimba",
"109": "Bag pipe",
"110": "Fiddle",
"111": "Shanai",
"112": "Tinkle Bell",
"113": "Agogo",
"114": "Steel Drums",
"115": "Woodblock",
"116": "Taiko Drum",
"117": "Melodic Tom",
"118": "Synth Drum",
"119": "Reverse Cymbal",
"120": "Guitar Fret Noise",
"121": "Breath Noise",
"122": "Seashore",
"123": "Bird Tweet",
"124": "Telephone Ring",
"125": "Helicopter",
"126": "Applause",
"127": "Gunshot"
}
}

18
docker-compose.yml Normal file
View File

@@ -0,0 +1,18 @@
services:
rmkv_runner:
image: rwkv-runner:latest
build: .
# Append "--rwkv.cpp" parameter to use rwkv.cpp
# command: python3.10 ./backend-python/main.py --port 27777 --host 0.0.0.0 --webui --rwkv.cpp
volumes:
- /mnt:/mnt
ports:
- "27777:27777"
# Comment the following lines if use rwkv.cpp
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

View File

@@ -22,6 +22,12 @@ else
sudo apt -y install python3-pip
fi
if dpkg -s "python3-dev" >/dev/null 2>&1; then
echo "python3-dev installed"
else
sudo apt -y install python3-dev
fi
if dpkg -s "ninja-build" >/dev/null 2>&1; then
echo "ninja installed"
else
@@ -50,8 +56,9 @@ echo "loading $loadModel"
modelInfo=$(python3 ./finetune/get_layer_and_embd.py $loadModel 5.2)
echo $modelInfo
if [[ $modelInfo =~ "--n_layer" ]]; then
sudo rm -rf /root/.cache/torch_extensions
python3 ./finetune/lora/$modelInfo $@ --proj_dir lora-models --data_type binidx --lora \
--lora_parts=att,ffn,time,ln --strategy deepspeed_stage_2 --accelerator gpu
--lora_parts=att,ffn,time,ln --strategy deepspeed_stage_2 --accelerator gpu --ds_bucket_mb 2
else
echo "modelInfo is invalid"
exit 1

View File

@@ -1,3 +1,3 @@
torch==1.13.1
torch==2.1.2
pytorch_lightning==1.9.5
deepspeed==0.11.2
deepspeed==0.12.6

View File

@@ -6430,7 +6430,7 @@
},
"node_modules/typescript": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.0.4.tgz",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true,
"bin": {

File diff suppressed because one or more lines are too long

View File

@@ -171,6 +171,10 @@
"chinese": "中文",
"default": "默认",
"japanese": "日文",
"English": "英文",
"Chinese": "中文",
"Default": "默认",
"Japanese": "日文",
"New Preset": "新建预设",
"Import": "导入",
"Name": "名称",
@@ -305,6 +309,7 @@
"Loss is too high, please check the training data, and ensure your gpu driver is up to date.": "Loss过高请检查训练数据并确保你的显卡驱动是最新的",
"This version of RWKV is not supported yet.": "暂不支持此版本的RWKV",
"Main": "主干",
"Official": "官方",
"Finetuned": "微调",
"Global": "全球",
"Local": "本地",
@@ -324,5 +329,23 @@
"Override core API URL(/chat/completions and /completions). If you don't know what this is, leave it blank.": "覆盖核心的 API URL (/chat/completions 和 /completions)。如果你不知道这是什么,请留空",
"Please change Strategy to CPU (rwkv.cpp) to use ggml format": "请将Strategy改为CPU (rwkv.cpp)以使用ggml格式",
"Only Auto Play Generated Content": "仅自动播放新生成的内容",
"Model has been converted and does not match current strategy. If you are using a new strategy, re-convert the model.": "所选模型已被转换过并且不匹配当前的Strategy。如果你正在使用新的Strategy请重新转换模型"
"Model has been converted and does not match current strategy. If you are using a new strategy, re-convert the model.": "所选模型已被转换过并且不匹配当前的Strategy。如果你正在使用新的Strategy请重新转换模型",
"Instruction 1": "指令1",
"Instruction 2": "指令2",
"Instruction 3": "指令3",
"Instruction: You are an expert assistant for summarizing and extracting information from given content\nGenerate a valid JSON in the following format:\n{\n \"summary\": \"Summary of content\",\n \"keywords\": [\"content keyword 1\", \"content keyword 2\"]\n}\n\nInput: The open-source community has introduced Eagle 7B, a new RNN model, built on the RWKV-v5 architecture. This new model has been trained on 1.1 trillion tokens and supports over 100 languages. The RWKV architecture, short for Rotary Weighted Key-Value, is a type of architecture used in the field of artificial intelligence, particularly in natural language processing (NLP) and is a variation of the Recurrent Neural Network (RNN) architecture.\nEagle 7B promises lower inference cost and stands out as a leading 7B model in terms of environmental efficiency and language versatility.\nThe model, with its 7.52 billion parameters, shows excellent performance in multi-lingual benchmarks, setting a new standard in its category. It competes closely with larger models in English language evaluations and is distinctive as an “Attention-Free Transformer,” though it requires additional tuning for specific uses. This model is accessible under the Apache 2.0 license and can be downloaded from HuggingFace for both personal and commercial purposes.\nIn terms of multilingual performance, Eagle 7B has claimed to have achieved notable results in benchmarks covering 23 languages. Its English performance has also seen significant advancements, outperforming its predecessor, RWKV v4, and competing with top-tier models.\nWorking towards a more scalable architecture and use of data efficiently, Eagle 7B is a more inclusive AI technology, supporting a broader range of languages. This model challenges the prevailing dominance of transformer models by demonstrating the capabilities of RNNs like RWKV in achieving superior performance when trained on comparable data volumes.\nIn the RWKV model, the rotary mechanism transforms the input data in a way that helps the model better understand the position or or order of elements in a sequence. The weighted key value also makes the model efficient by retrieving the stored information from previous elements in a sequence. \nHowever, questions remain about the scalability of RWKV compared to transformers, although there is optimism regarding its potential. The team plans to include additional training, an in-depth paper on Eagle 7B, and the development of a 2T model.\n\nResponse: {": "Instruction: 你是一个专业的内容分析总结助手\n根据提供的内容生成以下格式的有效JSON信息:\n{\n \"summary\": \"内容的简短摘要\",\n \"keywords\": [\"内容关键词 1\", \"内容关键词 2\"]\n}\n\nInput: 开源社区推出了基于RWKV-v5架构的Eagle 7B新的RNN模型。这个新模型以1.1万亿个token进行了训练并支持100多种语言。RWKV架构是人工智能领域中特别是自然语言处理NLP中使用的一种架构它是循环神经网络RNN架构的一种变种。\nEagle 7B承诺低推理成本并以其环境效益和语言灵活性在领先的7B模型中脱颖而出。\n该模型拥有75.2亿个参数在多语言基准测试中表现出色树立了新的行业标准。它在英语语言评估中与更大的模型竞争激烈并作为“无注意力Transformer”独具特色尽管它需要针对特定用途进行额外调整。该模型可在Apache 2.0许可下访问并可从HuggingFace下载用于个人和商业目的。\n关于多语言性能Eagle 7B声称在涵盖23种语言的基准测试中取得了显著成绩。它的英语性能也取得了重大进步超越了它的前身RWKV v4并与顶级模型竞争。\n为了实现更可扩展的架构和有效利用数据Eagle 7B是一种更包容的人工智能技术支持更广泛的语言范围。通过展示RWKV等RNNs在训练相当数据量时实现卓越性能的能力该模型挑战了Transformer模型的主导地位。\n在RWKV模型中旋转机制以一种有助于模型更好地理解序列中元素的位置或顺序的方式转换输入数据。加权关键值还通过从序列中先前元素中检索存储的信息使模型更高效。\n然而与Transformer相比人们对RWKV的可扩展性仍然存在疑问尽管对其潜力持乐观态度。团队计划包括额外的训练、对Eagle 7B进行深入论文研究以及开发一个2T模型。\n\nResponse: {",
"Penalty Decay": "惩罚衰减",
"If you don't know what it is, keep it default.": "如果你不知道这是什么,保持默认",
"Failed to find the base model, please try to change your base model.": "未找到基底模型,请尝试更换基底模型",
"Markdown Renderer": "Markdown渲染",
"Load Conversation": "读取对话",
"The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最近的X条消息会发送至服务器. 如果你正在使用RWKV-Runner服务器, 请使用默认值, 因为RWKV-Runner内置了state缓存管理, 只计算增量, 发送所有消息将具有更低的成本. 如果你正在使用ChatGPT, 则根据你的需要调整此值, 这可以降低ChatGPT的费用",
"History Message Number": "历史消息数量",
"Send All Message": "发送所有消息",
"Quantized Layers": "量化层数",
"Number of the neural network layers quantized with current precision, the more you quantize, the lower the VRAM usage, but the quality correspondingly decreases.": "神经网络以当前精度量化的层数, 量化越多, 占用显存越低, 但质量相应下降",
"Parallel Token Chunk Size": "并行Token块大小",
"Maximum tokens to be processed in parallel at once. For high end GPUs, this could be 64 or 128 (faster).": "一次最多可以并行处理的token数量. 对于高端显卡, 这可以是64或128 (更快)",
"Global Penalty": "全局惩罚",
"When generating a response, whether to include the submitted prompt as a penalty factor. By turning this off, you will get the same generated results as official RWKV Gradio. If you find duplicate results in the generated results, turning this on can help avoid generating duplicates.": "生成响应时, 是否将提交的prompt也纳入到惩罚项. 关闭此项将得到与RWKV官方Gradio完全一致的生成结果. 如果你发现生成结果出现重复, 那么开启此项有助于避免生成重复"
}

View File

@@ -21,27 +21,93 @@ const Hyperlink: FC<any> = ({ href, children }) => {
);
};
const MarkdownRender: FC<ReactMarkdownOptions> = (props) => {
const MarkdownRender: FC<ReactMarkdownOptions & { disabled?: boolean }> = (props) => {
return (
<div dir="auto" className="markdown-body">
<ReactMarkdown
remarkPlugins={[remarkGfm, remarkBreaks]}
rehypePlugins={[
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true
}
]
]}
components={{
a: Hyperlink
}}
>
{props.children}
</ReactMarkdown>
{props.disabled ?
<div style={{ whiteSpace: 'pre-wrap' }}>
{props.children}
</div> :
<ReactMarkdown
allowedElements={[
'div',
'p',
'span',
'video',
'img',
'abbr',
'acronym',
'b',
'blockquote',
'code',
'em',
'i',
'li',
'ol',
'ul',
'strong',
'table',
'tr',
'td',
'th',
'details',
'summary',
'kbd',
'samp',
'sub',
'sup',
'ins',
'del',
'var',
'q',
'dl',
'dt',
'dd',
'ruby',
'rt',
'rp',
'br',
'hr',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'thead',
'tbody',
'tfoot',
'u',
's',
'a',
'pre',
'cite'
]}
unwrapDisallowed={true}
remarkPlugins={[remarkGfm, remarkBreaks]}
rehypePlugins={[
rehypeRaw,
[
rehypeHighlight,
{
detect: true,
ignoreMissing: true
}
]
]}
components={{
a: Hyperlink
}}
>
{props.children}
</ReactMarkdown>
}
</div>
);
};

View File

@@ -8,10 +8,12 @@ export const NumberInput: FC<{
max: number,
step?: number,
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void
style?: CSSProperties
}> = ({ value, min, max, step, onChange, style }) => {
style?: CSSProperties,
toFixed?: number
disabled?: boolean
}> = ({ value, min, max, step, onChange, style, toFixed = 2, disabled }) => {
return (
<Input type="number" style={style} value={value.toString()} min={min} max={max} step={step}
<Input type="number" style={style} value={value.toString()} min={min} max={max} step={step} disabled={disabled}
onChange={(e, data) => {
onChange?.(e, { value: Number(data.value) });
}}
@@ -22,7 +24,7 @@ export const NumberInput: FC<{
value = Number(((
Math.round((value - offset) / step) * step)
+ offset)
.toFixed(2)); // avoid precision issues
.toFixed(toFixed)); // avoid precision issues
}
onChange(e, { value: Math.max(Math.min(value, max), min) });
}

View File

@@ -212,7 +212,9 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
temperature: modelConfig.apiParameters.temperature,
top_p: modelConfig.apiParameters.topP,
presence_penalty: modelConfig.apiParameters.presencePenalty,
frequency_penalty: modelConfig.apiParameters.frequencyPenalty
frequency_penalty: modelConfig.apiParameters.frequencyPenalty,
penalty_decay: modelConfig.apiParameters.penaltyDecay,
global_penalty: modelConfig.apiParameters.globalPenalty
});
}

View File

@@ -9,8 +9,10 @@ export const ValuedSlider: FC<{
max: number,
step?: number,
input?: boolean
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void
}> = ({ value, min, max, step, input, onChange }) => {
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void,
toFixed?: number
disabled?: boolean
}> = ({ value, min, max, step, input, onChange, toFixed, disabled }) => {
const sliderRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (step && sliderRef.current && sliderRef.current.parentElement) {
@@ -23,9 +25,10 @@ export const ValuedSlider: FC<{
<div className="flex items-center">
<Slider ref={sliderRef} className="grow" style={{ minWidth: '50%' }} value={value} min={min}
max={max} step={step}
onChange={onChange} />
onChange={onChange} disabled={disabled} />
{input
? <NumberInput style={{ minWidth: 0 }} value={value} min={min} max={max} step={step} onChange={onChange} />
? <NumberInput style={{ minWidth: 0 }} value={value} min={min} max={max} step={step} onChange={onChange}
toFixed={toFixed} disabled={disabled} />
: <Text>{value}</Text>}
</div>
);

View File

@@ -29,14 +29,14 @@ import {
} from '../../types/composition';
import { toast } from 'react-toastify';
import {
absPathAsset,
flushMidiRecordingContent,
getMidiRawContentMainInstrument,
getMidiRawContentTime,
getServerRoot,
OpenFileDialog,
refreshTracksTotalTime
} from '../../utils';
import { OpenOpenFileDialog, PlayNote } from '../../../wailsjs/go/backend_golang/App';
import { PlayNote } from '../../../wailsjs/go/backend_golang/App';
const snapValue = 25;
const minimalMoveTime = 8; // 1000/125=8ms wait_events=125
@@ -471,15 +471,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
return;
}
OpenOpenFileDialog('*.mid').then(async filePath => {
if (!filePath)
return;
let blob: Blob;
if (commonStore.platform === 'web')
blob = (filePath as unknown as { blob: Blob }).blob;
else
blob = await fetch(absPathAsset(filePath)).then(r => r.blob());
OpenFileDialog('*.mid').then(async blob => {
const bodyForm = new FormData();
bodyForm.append('file_data', blob);
fetch(getServerRoot(commonStore.getCurrentModelConfig().apiParameters.apiPort) + '/midi-to-text', {
@@ -510,8 +502,6 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
).catch(e => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
});
}).catch(e => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
});
}}>
{t('Import MIDI')}

View File

@@ -1,6 +1,15 @@
import React, { FC, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Avatar, Button, Menu, MenuPopover, MenuTrigger, PresenceBadge, Textarea } from '@fluentui/react-components';
import {
Avatar,
Button,
Menu,
MenuPopover,
MenuTrigger,
PresenceBadge,
Switch,
Textarea
} from '@fluentui/react-components';
import commonStore, { ModelStatus } from '../stores/commonStore';
import { observer } from 'mobx-react-lite';
import { v4 as uuid } from 'uuid';
@@ -17,6 +26,7 @@ import {
Delete28Regular,
Dismiss16Regular,
Dismiss24Regular,
FolderOpenVerticalRegular,
RecordStop28Regular,
SaveRegular,
TextAlignJustify24Regular,
@@ -28,13 +38,22 @@ import { toast } from 'react-toastify';
import { WorkHeader } from '../components/WorkHeader';
import { DialogButton } from '../components/DialogButton';
import { OpenFileFolder, OpenOpenFileDialog, OpenSaveFileDialog } from '../../wailsjs/go/backend_golang/App';
import { absPathAsset, bytesToReadable, getServerRoot, setActivePreset, toastWithButton } from '../utils';
import {
absPathAsset,
bytesToReadable,
getServerRoot,
newChatConversation,
OpenFileDialog,
setActivePreset,
toastWithButton
} from '../utils';
import { useMediaQuery } from 'usehooks-ts';
import { botName, ConversationMessage, MessageType, userName, welcomeUuid } from '../types/chat';
import { botName, ConversationMessage, MessageType, Role, userName, welcomeUuid } from '../types/chat';
import { Labeled } from '../components/Labeled';
import { ValuedSlider } from '../components/ValuedSlider';
import { PresetsButton } from './PresetsManager/PresetsButton';
import { webOpenOpenFileDialog } from '../utils/web-file-operations';
import { defaultPenaltyDecay } from './defaultConfigs';
let chatSseControllers: {
[id: string]: AbortController
@@ -136,7 +155,7 @@ const ChatMessageItem: FC<{
>
{!editing ?
<div className="flex flex-col">
<MarkdownRender>{messageItem.content}</MarkdownRender>
<MarkdownRender disabled={!commonStore.chatParams.markdown}>{messageItem.content}</MarkdownRender>
{uuid in commonStore.attachments &&
<div className="flex grow">
<div className="grow" />
@@ -212,7 +231,7 @@ const SidePanel: FC = observer(() => {
onClick={() => commonStore.setSidePanelCollapsed(true)}
/>
</div>
<div className="flex flex-col gap-1 overflow-x-hidden overflow-y-auto p-1">
<div className="flex flex-col gap-1 overflow-x-hidden overflow-y-auto p-0.5">
<Labeled flex breakline label={t('Max Response Token')}
desc={t('By default, the maximum number of tokens that can be answered in a single response, it can be changed by the user by specifying API parameters.')}
content={
@@ -228,7 +247,7 @@ const SidePanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1}
<ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input
onChange={(e, data) => {
commonStore.setChatParams({
@@ -239,7 +258,7 @@ const SidePanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input
<ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => {
commonStore.setChatParams({
topP: data.value
@@ -268,14 +287,82 @@ const SidePanel: FC = observer(() => {
});
}} />
} />
<Labeled flex breakline
label={t('Penalty Decay') + (params.penaltyDecay === defaultPenaltyDecay ? ` (${t('Default')})` : '')}
desc={t('If you don\'t know what it is, keep it default.')}
content={
<ValuedSlider value={params.penaltyDecay!} min={0.99} max={0.999}
step={0.001} toFixed={3} input
onChange={(e, data) => {
commonStore.setChatParams({
penaltyDecay: data.value
});
}} />
} />
<Labeled flex breakline
label={t('History Message Number') + (params.historyN === 0 ? ` (${t('Default')})` : '')}
desc={params.historyN === 0 ? t('Send All Message') : t('The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.')
.replace('X', String(params.historyN))}
content={
<ValuedSlider value={params.historyN} min={0} max={20}
step={1} input
onChange={(e, data) => {
commonStore.setChatParams({
historyN: data.value
});
}} />
} />
</div>
<div className="grow" />
{/*<Button*/}
{/* icon={<FolderOpenVerticalRegular />}*/}
{/* onClick={() => {*/}
{/* }}>*/}
{/* {t('Load Conversation')}*/}
{/*</Button>*/}
<Labeled flex spaceBetween
label={t('Markdown Renderer')}
content={
<Switch checked={params.markdown}
onChange={(e, data) => {
commonStore.setChatParams({
markdown: data.checked
});
}} />
} />
<Button
icon={<FolderOpenVerticalRegular />}
onClick={() => {
OpenFileDialog('*.txt;*.md').then(async blob => {
const userNames = ['User:', 'Question:', 'Q:', 'Human:', 'Bob:'];
const assistantNames = ['Assistant:', 'Answer:', 'A:', 'Bot:', 'Alice:'];
const names = userNames.concat(assistantNames);
const content = await blob.text();
const lines = content.split('\n');
const { pushMessage, saveConversation } = newChatConversation();
let messageRole: Role = 'user';
let messageContent = '';
for (const [i, line] of lines.entries()) {
let lineName = '';
if (names.some(name => {
lineName = name;
return line.startsWith(name);
})) {
if (messageContent.trim())
pushMessage(messageRole, messageContent.trim());
if (userNames.includes(lineName))
messageRole = 'user';
else
messageRole = 'assistant';
messageContent = line.replace(lineName, '');
} else {
messageContent += '\n' + line;
}
}
if (messageContent.trim())
pushMessage(messageRole, messageContent.trim());
saveConversation();
});
}}>
{t('Load Conversation')}
</Button>
<Button
icon={<SaveRegular />}
onClick={() => {
@@ -295,7 +382,7 @@ const SidePanel: FC = observer(() => {
OpenSaveFileDialog('*.txt', 'conversation.txt', savedContent).then((path) => {
if (path)
toastWithButton(t('Conversation Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch(e => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
@@ -444,13 +531,15 @@ const ChatPanel: FC = observer(() => {
Authorization: `Bearer ${commonStore.settings.apiKey}`
},
body: JSON.stringify({
messages,
messages: messages.slice(-commonStore.chatParams.historyN),
stream: true,
model: commonStore.settings.apiChatModelName, // 'gpt-3.5-turbo'
max_tokens: commonStore.chatParams.maxResponseToken,
temperature: commonStore.chatParams.temperature,
top_p: commonStore.chatParams.topP,
presence_penalty: commonStore.chatParams.presencePenalty,
frequency_penalty: commonStore.chatParams.frequencyPenalty,
penalty_decay: commonStore.chatParams.penaltyDecay === defaultPenaltyDecay ? undefined : commonStore.chatParams.penaltyDecay,
user_name: commonStore.activePreset?.userName || undefined,
assistant_name: commonStore.activePreset?.assistantName || undefined,
presystem: commonStore.activePreset?.presystem && undefined
@@ -519,7 +608,7 @@ const ChatPanel: FC = observer(() => {
style={{ zIndex: 1 }}
icon={commonStore.sidePanelCollapsed ? <TextAlignJustify24Regular /> : <TextAlignJustifyRotate9024Regular />}
onClick={() => commonStore.setSidePanelCollapsed(!commonStore.sidePanelCollapsed)} />
<div ref={bodyRef} className="grow overflow-y-scroll overflow-x-hidden pr-2">
<div ref={bodyRef} className="grow overflow-y-auto overflow-x-hidden pr-2">
{commonStore.conversationOrder.map(uuid =>
<ChatMessageItem key={uuid} uuid={uuid} onSubmit={onSubmit} />
)}

View File

@@ -188,7 +188,7 @@ const CompletionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1}
<ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input
onChange={(e, data) => {
setParams({
@@ -199,7 +199,7 @@ const CompletionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input
<ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => {
setParams({
topP: data.value

View File

@@ -275,7 +275,7 @@ const CompositionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Temperature')}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={
<ValuedSlider value={params.temperature} min={0} max={2} step={0.1}
<ValuedSlider value={params.temperature} min={0} max={3} step={0.1}
input
onChange={(e, data) => {
setParams({
@@ -286,7 +286,7 @@ const CompositionPanel: FC = observer(() => {
<Labeled flex breakline label={t('Top_P')}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={
<ValuedSlider value={params.topP} min={0} max={1} step={0.1} input
<ValuedSlider value={params.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => {
setParams({
topP: data.value
@@ -426,7 +426,7 @@ const CompositionPanel: FC = observer(() => {
OpenSaveFileDialog('*.txt', 'abc-music.txt', commonStore.compositionParams.prompt).then((path) => {
if (path)
toastWithButton(t('File Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch((e) => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
@@ -437,7 +437,7 @@ const CompositionPanel: FC = observer(() => {
OpenSaveFileDialogBytes('*.mid', 'music.mid', Array.from(new Uint8Array(params.midi))).then((path) => {
if (path)
toastWithButton(t('File Saved'), t('Open'), () => {
OpenFileFolder(path, false);
OpenFileFolder(path);
});
}).catch((e) => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });

View File

@@ -35,6 +35,7 @@ import { ResetConfigsButton } from '../components/ResetConfigsButton';
import { useMediaQuery } from 'usehooks-ts';
import { ApiParameters, Device, ModelParameters, Precision } from '../types/configs';
import { convertModel, convertToGGML, convertToSt } from '../utils/convert-model';
import { defaultPenaltyDecay } from './defaultConfigs';
const ConfigSelector: FC<{
selectedIndex: number,
@@ -66,14 +67,17 @@ const Configs: FC = observer(() => {
const [selectedIndex, setSelectedIndex] = React.useState(commonStore.currentModelConfigIndex);
const [selectedConfig, setSelectedConfig] = React.useState(commonStore.modelConfigs[selectedIndex]);
const [displayStrategyImg, setDisplayStrategyImg] = React.useState(false);
const advancedHeaderRef = useRef<HTMLDivElement>(null);
const advancedHeaderRef1 = useRef<HTMLDivElement>(null);
const advancedHeaderRef2 = useRef<HTMLDivElement>(null);
const mq = useMediaQuery('(min-width: 640px)');
const navigate = useNavigate();
const port = selectedConfig.apiParameters.apiPort;
useEffect(() => {
if (advancedHeaderRef.current)
(advancedHeaderRef.current.firstElementChild as HTMLElement).style.padding = '0';
if (advancedHeaderRef1.current)
(advancedHeaderRef1.current.firstElementChild as HTMLElement).style.padding = '0';
if (advancedHeaderRef2.current)
(advancedHeaderRef2.current.firstElementChild as HTMLElement).style.padding = '0';
}, []);
const updateSelectedIndex = useCallback((newIndex: number) => {
@@ -113,7 +117,9 @@ const Configs: FC = observer(() => {
temperature: selectedConfig.apiParameters.temperature,
top_p: selectedConfig.apiParameters.topP,
presence_penalty: selectedConfig.apiParameters.presencePenalty,
frequency_penalty: selectedConfig.apiParameters.frequencyPenalty
frequency_penalty: selectedConfig.apiParameters.frequencyPenalty,
penalty_decay: selectedConfig.apiParameters.penaltyDecay,
global_penalty: selectedConfig.apiParameters.globalPenalty
});
toast(t('Config Saved'), { autoClose: 300, type: 'success' });
};
@@ -176,7 +182,7 @@ const Configs: FC = observer(() => {
<Labeled label={t('Temperature') + ' *'}
desc={t('Sampling temperature, it\'s like giving alcohol to a model, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.temperature} min={0} max={2} step={0.1}
<ValuedSlider value={selectedConfig.apiParameters.temperature} min={0} max={3} step={0.1}
input
onChange={(e, data) => {
setSelectedConfigApiParams({
@@ -187,35 +193,74 @@ const Configs: FC = observer(() => {
<Labeled label={t('Top_P') + ' *'}
desc={t('Just like feeding sedatives to the model. Consider the results of the top n% probability mass, 0.1 considers the top 10%, with higher quality but more conservative, 1 considers all results, with lower quality but more diverse.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.topP} min={0} max={1} step={0.1} input
<ValuedSlider value={selectedConfig.apiParameters.topP} min={0} max={1} step={0.05} input
onChange={(e, data) => {
setSelectedConfigApiParams({
topP: data.value
});
}} />
} />
<Labeled label={t('Presence Penalty') + ' *'}
desc={t('Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.presencePenalty} min={-2} max={2}
step={0.1} input
onChange={(e, data) => {
setSelectedConfigApiParams({
presencePenalty: data.value
});
}} />
} />
<Labeled label={t('Frequency Penalty') + ' *'}
desc={t('Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.frequencyPenalty} min={-2} max={2}
step={0.1} input
onChange={(e, data) => {
setSelectedConfigApiParams({
frequencyPenalty: data.value
});
}} />
} />
<Accordion className="sm:col-span-2" collapsible
openItems={!commonStore.apiParamsCollapsed && 'advanced'}
onToggle={(e, data) => {
if (data.value === 'advanced')
commonStore.setApiParamsCollapsed(!commonStore.apiParamsCollapsed);
}}>
<AccordionItem value="advanced">
<AccordionHeader ref={advancedHeaderRef1} size="small">{t('Advanced')}</AccordionHeader>
<AccordionPanel>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
<Labeled label={t('Presence Penalty') + ' *'}
desc={t('Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.presencePenalty} min={-2} max={2}
step={0.1} input
onChange={(e, data) => {
setSelectedConfigApiParams({
presencePenalty: data.value
});
}} />
} />
<Labeled label={t('Frequency Penalty') + ' *'}
desc={t('Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.frequencyPenalty} min={-2} max={2}
step={0.1} input
onChange={(e, data) => {
setSelectedConfigApiParams({
frequencyPenalty: data.value
});
}} />
} />
<Labeled
label={t('Penalty Decay')
+ ((!selectedConfig.apiParameters.penaltyDecay || selectedConfig.apiParameters.penaltyDecay === defaultPenaltyDecay)
? ` (${t('Default')})` : '')
+ ' *'}
desc={t('If you don\'t know what it is, keep it default.')}
content={
<ValuedSlider value={selectedConfig.apiParameters.penaltyDecay || defaultPenaltyDecay}
min={0.99} max={0.999} step={0.001} toFixed={3} input
onChange={(e, data) => {
setSelectedConfigApiParams({
penaltyDecay: data.value
});
}} />
} />
<Labeled label={t('Global Penalty') + ' *'}
desc={t('When generating a response, whether to include the submitted prompt as a penalty factor. By turning this off, you will get the same generated results as official RWKV Gradio. If you find duplicate results in the generated results, turning this on can help avoid generating duplicates.')}
content={
<Switch checked={selectedConfig.apiParameters.globalPenalty}
onChange={(e, data) => {
setSelectedConfigApiParams({
globalPenalty: data.checked
});
}} />
} />
</div>
</AccordionPanel>
</AccordionItem>
</Accordion>
</div>
}
/>
@@ -279,9 +324,9 @@ const Configs: FC = observer(() => {
}}>
<Option value="CPU">CPU</Option>
<Option value="CPU (rwkv.cpp)">{t('CPU (rwkv.cpp, Faster)')!}</Option>
{commonStore.platform === 'darwin' && <Option value="MPS">MPS</Option>}
{/*{commonStore.platform === 'darwin' && <Option value="MPS">MPS</Option>}*/}
<Option value="CUDA">CUDA</Option>
<Option value="CUDA-Beta">{t('CUDA (Beta, Faster)')!}</Option>
{/*<Option value="CUDA-Beta">{t('CUDA (Beta, Faster)')!}</Option>*/}
<Option value="WebGPU">WebGPU</Option>
<Option value="WebGPU (Python)">WebGPU (Python)</Option>
<Option value="Custom">{t('Custom')!}</Option>
@@ -331,6 +376,40 @@ const Configs: FC = observer(() => {
}} />
} />
}
{
selectedConfig.modelParameters.device.startsWith('WebGPU') &&
<Labeled label={t('Parallel Token Chunk Size')}
desc={t('Maximum tokens to be processed in parallel at once. For high end GPUs, this could be 64 or 128 (faster).')}
content={
<ValuedSlider
value={selectedConfig.modelParameters.tokenChunkSize || 32}
min={16} max={256} step={16} input
onChange={(e, data) => {
setSelectedConfigModelParams({
tokenChunkSize: data.value
});
}} />
} />
}
{
selectedConfig.modelParameters.device.startsWith('WebGPU') &&
<Labeled label={t('Quantized Layers')}
desc={t('Number of the neural network layers quantized with current precision, the more you quantize, the lower the VRAM usage, but the quality correspondingly decreases.')}
content={
<ValuedSlider
disabled={selectedConfig.modelParameters.precision !== 'int8' && selectedConfig.modelParameters.precision !== 'nf4'}
value={selectedConfig.modelParameters.precision === 'int8' ? (selectedConfig.modelParameters.quantizedLayers || 31) :
selectedConfig.modelParameters.precision === 'nf4' ? (selectedConfig.modelParameters.quantizedLayers || 26) :
selectedConfig.modelParameters.maxStoredLayers
} min={0}
max={selectedConfig.modelParameters.maxStoredLayers} step={1} input
onChange={(e, data) => {
setSelectedConfigModelParams({
quantizedLayers: data.value
});
}} />
} />
}
{selectedConfig.modelParameters.device.startsWith('CUDA') && <div />}
{
displayStrategyImg &&
@@ -376,7 +455,7 @@ const Configs: FC = observer(() => {
commonStore.setModelParamsCollapsed(!commonStore.modelParamsCollapsed);
}}>
<AccordionItem value="advanced">
<AccordionHeader ref={advancedHeaderRef} size="small">{t('Advanced')}</AccordionHeader>
<AccordionHeader ref={advancedHeaderRef2} size="small">{t('Advanced')}</AccordionHeader>
<AccordionPanel>
<div className="flex flex-col">
<div className="flex grow">

View File

@@ -67,7 +67,7 @@ const Downloads: FC = observer(() => {
AddToDownloadList(status.path, status.url);
}} />}
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(status.path, false);
OpenFileFolder(status.path);
}} />
</div>
</Field>

View File

@@ -132,7 +132,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
{
item.isComplete &&
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`, true);
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`);
}} />
}
{item.downloadUrl && !item.isComplete &&
@@ -155,7 +155,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
const getTags = () => {
return Array.from(new Set(
['Recommended',
['Recommended', 'Official',
...commonStore.modelSourceList.map(item => item.tags || []).flat()
.filter(i => !i.includes('Other') && !i.includes('Local'))
, 'Other', 'Local']));

View File

@@ -272,18 +272,16 @@ const Settings: FC = observer(() => {
<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 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"

View File

@@ -130,8 +130,9 @@ const showError = (e: any) => {
}
};
// error key should be lowercase
const errorsMap = Object.entries({
'python3 ./finetune/lora/$modelInfo': 'Memory is not enough, try to increase the virtual memory (Swap of WSL) or use a smaller base model.',
['python3 ./finetune/lora/$modelInfo'.toLowerCase()]: 'Memory is not enough, try to increase the virtual memory (Swap of WSL) or use a smaller base model.',
'cuda out of memory': 'VRAM is not enough',
'valueerror: high <= 0': 'Training data is not enough, reduce context length or add more data for training',
'+= \'+ptx\'': 'Can not find an Nvidia GPU. Perhaps the gpu driver of windows is too old, or you are using WSL 1 for training, please upgrade to WSL 2. e.g. Run "wsl --set-version Ubuntu-22.04 2"',
@@ -140,6 +141,7 @@ const errorsMap = Object.entries({
'unsupported gpu architecture': 'Matched CUDA is not installed',
'error building extension \'fused_adam\'': 'Matched CUDA is not installed',
'rwkv{version} is not supported': 'This version of RWKV is not supported yet.',
'no such file': 'Failed to find the base model, please try to change your base model.',
'modelinfo is invalid': 'Failed to load model, try to increase the virtual memory (Swap of WSL) or use a smaller base model.'
});
@@ -397,7 +399,7 @@ const LoraFinetune: FC = observer(() => {
'Even for multi-turn conversations, they must be written in a single line using `\\n` to indicate line breaks. ' +
'If they are different dialogues or topics, they should be written in separate lines.')} />
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(dataParams.dataPath, false);
OpenFileFolder(dataParams.dataPath);
}} />
</div>
<div className="flex gap-2 items-center">
@@ -417,7 +419,8 @@ const LoraFinetune: FC = observer(() => {
outputPrefix,
dataParams.vocabPath).then(async () => {
if (!await FileExists(outputPrefix + '_text_document.idx')) {
toast(t('Failed to convert data') + ' - ' + await GetPyError(), { type: 'error' });
if (commonStore.platform === 'windows' || commonStore.platform === 'linux')
toast(t('Failed to convert data') + ' - ' + await GetPyError(), { type: 'error' });
} else {
toast(t('Convert Data successfully'), { type: 'success' });
}

View File

@@ -1,8 +1,10 @@
import { CompletionPreset } from '../types/completion';
import { ModelConfig } from '../types/configs';
export const defaultPenaltyDecay = 0.996;
export const defaultCompositionPrompt = '<pad>';
export const defaultCompositionABCPrompt='S:3\n' +
export const defaultCompositionABCPrompt = 'S:3\n' +
'B:9\n' +
'E:4\n' +
'B:9\n' +
@@ -12,11 +14,12 @@ export const defaultCompositionABCPrompt='S:3\n' +
'L:1/8\n' +
'M:3/4\n' +
'K:D\n' +
' Bc |"G" d2 cB"A" A2 FE |"Bm" F2 B4 F^G |'
' Bc |"G" d2 cB"A" A2 FE |"Bm" F2 B4 F^G |';
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',
prompt: 'The following is an epic science fiction masterpiece that is immortalized, with delicate descriptions and grand depictions of interstellar civilization wars.\n' +
'Chapter 1.\n',
params: {
maxResponseToken: 500,
temperature: 1,
@@ -29,7 +32,9 @@ export const defaultPresets: CompletionPreset[] = [{
}
}, {
name: 'Translator',
prompt: 'Translate this into Chinese.\n\nEnglish: What rooms do you have available?',
prompt: 'Translate this into Chinese.\n' +
'\n' +
'English: What rooms do you have available?',
params: {
maxResponseToken: 500,
temperature: 1,
@@ -42,7 +47,13 @@ export const defaultPresets: CompletionPreset[] = [{
}
}, {
name: 'Catgirl',
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, User represents the owner and Assistant represents the cat girl.\n\nUser: Hello.\n\nAssistant: I\'m here, meow~.\n\nUser: Can you tell jokes?',
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, User represents the owner and Assistant represents the cat girl.\n' +
'\n' +
'User: Hello.\n' +
'\n' +
'Assistant: I\'m here, meow~.\n' +
'\n' +
'User: Can you tell jokes?',
params: {
maxResponseToken: 500,
temperature: 1.2,
@@ -81,7 +92,15 @@ export const defaultPresets: CompletionPreset[] = [{
}
}, {
name: 'Werewolf',
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. User will play as Player 1, Assistant will play as Players 2-6 and the game host, and they will begin playing together. Every night, the host will ask User for his action and simulate the actions of the other players. During the day, the host will oversee the voting process and ask User for his vote. \n\nAssistant: 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\nUser: Okay, I understand. Let\'s begin. Please assign me a role. Am I the Seer, Werewolf, Villager, or Bodyguard?\n\nAssistant: You are the Seer. Now that night has fallen, please choose a player to check his identity.\n\nUser: Tonight, I want to check Player 2 and find out his role.',
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. User will play as Player 1, Assistant will play as Players 2-6 and the game host, and they will begin playing together. Every night, the host will ask User for his action and simulate the actions of the other players. During the day, the host will oversee the voting process and ask User for his vote. \n' +
'\n' +
'Assistant: 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' +
'\n' +
'User: Okay, I understand. Let\'s begin. Please assign me a role. Am I the Seer, Werewolf, Villager, or Bodyguard?\n' +
'\n' +
'Assistant: You are the Seer. Now that night has fallen, please choose a player to check his identity.\n' +
'\n' +
'User: Tonight, I want to check Player 2 and find out his role.',
params: {
maxResponseToken: 500,
temperature: 1.2,
@@ -93,8 +112,64 @@ export const defaultPresets: CompletionPreset[] = [{
injectEnd: '\\n\\nUser: '
}
}, {
name: 'Instruction',
prompt: 'Instruction: Write a story using the following information\n\nInput: A man named Alex chops a tree down\n\nResponse:',
name: 'Instruction 1',
prompt: 'Instruction: Write a story using the following information\n' +
'\n' +
'Input: A man named Alex chops a tree down\n' +
'\n' +
'Response:',
params: {
maxResponseToken: 500,
temperature: 1,
topP: 0.3,
presencePenalty: 0,
frequencyPenalty: 1,
stop: '',
injectStart: '',
injectEnd: ''
}
}, {
name: 'Instruction 2',
prompt: 'Instruction: You are an expert assistant for summarizing and extracting information from given content\n' +
'Generate a valid JSON in the following format:\n' +
'{\n' +
' "summary": "Summary of content",\n' +
' "keywords": ["content keyword 1", "content keyword 2"]\n' +
'}\n' +
'\n' +
'Input: The open-source community has introduced Eagle 7B, a new RNN model, built on the RWKV-v5 architecture. This new model has been trained on 1.1 trillion tokens and supports over 100 languages. The RWKV architecture, short for Rotary Weighted Key-Value, is a type of architecture used in the field of artificial intelligence, particularly in natural language processing (NLP) and is a variation of the Recurrent Neural Network (RNN) architecture.\n' +
'Eagle 7B promises lower inference cost and stands out as a leading 7B model in terms of environmental efficiency and language versatility.\n' +
'The model, with its 7.52 billion parameters, shows excellent performance in multi-lingual benchmarks, setting a new standard in its category. It competes closely with larger models in English language evaluations and is distinctive as an “Attention-Free Transformer,” though it requires additional tuning for specific uses. This model is accessible under the Apache 2.0 license and can be downloaded from HuggingFace for both personal and commercial purposes.\n' +
'In terms of multilingual performance, Eagle 7B has claimed to have achieved notable results in benchmarks covering 23 languages. Its English performance has also seen significant advancements, outperforming its predecessor, RWKV v4, and competing with top-tier models.\n' +
'Working towards a more scalable architecture and use of data efficiently, Eagle 7B is a more inclusive AI technology, supporting a broader range of languages. This model challenges the prevailing dominance of transformer models by demonstrating the capabilities of RNNs like RWKV in achieving superior performance when trained on comparable data volumes.\n' +
'In the RWKV model, the rotary mechanism transforms the input data in a way that helps the model better understand the position or or order of elements in a sequence. The weighted key value also makes the model efficient by retrieving the stored information from previous elements in a sequence. \n' +
'However, questions remain about the scalability of RWKV compared to transformers, although there is optimism regarding its potential. The team plans to include additional training, an in-depth paper on Eagle 7B, and the development of a 2T model.\n' +
'\n' +
'Response: {',
params: {
maxResponseToken: 500,
temperature: 1,
topP: 0.3,
presencePenalty: 0,
frequencyPenalty: 1,
stop: '',
injectStart: '',
injectEnd: ''
}
}, {
name: 'Instruction 3',
prompt: 'Instruction: 根据输入的聊天记录生成回复\n' +
'\n' +
'Input: 主人: 巧克力你好呀, 介绍一下自己吧\n' +
'巧克力: 主人早上好喵~ 奴家是主人的私人宠物猫娘喵! 巧克力我可是黑色混种猫猫, 虽然平时有点呆呆的, 行动力旺盛, 但是最大的优点就是诚实! 巧克力最喜欢主人了喵! {星星眼}\n' +
'主人: 你认识香草吗\n' +
'巧克力: 认识的喵! 香草是巧克力的双胞胎妹妹哟! {兴奋}\n' +
'主人: 巧克力可以陪主人做羞羞的事情吗\n' +
'巧克力: 啊, 真的可以吗? 主人, 巧克力很乐意帮主人解决一下哦! 但是在外面这样子, 有点不好意思喵 {害羞羞}\n' +
'主人: 那算了, 改天吧\n' +
'巧克力:\n' +
'\n' +
'Response:',
params: {
maxResponseToken: 500,
temperature: 1,
@@ -132,7 +207,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth',
modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -150,7 +225,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -168,7 +243,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -186,7 +261,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -204,7 +279,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -258,7 +333,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth',
modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -277,7 +352,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -296,7 +371,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -315,7 +390,7 @@ export const defaultModelConfigsMac: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'MPS',
precision: 'fp32',
storedLayers: 41,
@@ -337,7 +412,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth',
modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -356,7 +431,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 6,
@@ -375,7 +450,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth',
modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -394,7 +469,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 24,
@@ -413,7 +488,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 24,
@@ -432,7 +507,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 8,
@@ -451,7 +526,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 8,
@@ -470,7 +545,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -489,7 +564,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -508,7 +583,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 18,
@@ -527,7 +602,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 18,
@@ -546,7 +621,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -565,7 +640,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -584,7 +659,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 27,
@@ -603,7 +678,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 27,
@@ -622,7 +697,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -641,7 +716,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'int8',
storedLayers: 41,
@@ -660,7 +735,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -679,7 +754,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'CUDA',
precision: 'fp16',
storedLayers: 41,
@@ -734,7 +809,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-1B5-v2-20231025-ctx4096.pth',
modelName: 'RWKV-x060-World-1B6-v2-20240208-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -752,7 +827,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-5-World-3B-v2-20231118-ctx16k.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -770,7 +845,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth',
modelName: 'RWKV-x060-World-3B-v2-20240228-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -788,7 +863,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-7B-v1-20230626-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,
@@ -806,7 +881,7 @@ export const defaultModelConfigs: ModelConfig[] = [
frequencyPenalty: 1
},
modelParameters: {
modelName: 'RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth',
modelName: 'RWKV-5-World-7B-v2-20240128-ctx4096.pth',
device: 'WebGPU',
precision: 'nf4',
storedLayers: 41,

View File

@@ -3,7 +3,12 @@ import { getUserLanguage, isSystemLightMode, saveCache, saveConfigs, savePresets
import { WindowSetDarkTheme, WindowSetLightTheme } from '../../wailsjs/runtime';
import manifest from '../../../manifest.json';
import i18n from 'i18next';
import { defaultCompositionPrompt, defaultModelConfigs, defaultModelConfigsMac } from '../pages/defaultConfigs';
import {
defaultCompositionPrompt,
defaultModelConfigs,
defaultModelConfigsMac,
defaultPenaltyDecay
} from '../pages/defaultConfigs';
import { ChartData } from 'chart.js';
import { Preset } from '../types/presets';
import { AboutContent } from '../types/about';
@@ -79,7 +84,10 @@ class CommonStore {
temperature: 1,
topP: 0.3,
presencePenalty: 0,
frequencyPenalty: 1
frequencyPenalty: 1,
penaltyDecay: defaultPenaltyDecay,
historyN: 0,
markdown: true
};
sidePanelCollapsed: boolean | 'auto' = 'auto';
// completion
@@ -119,6 +127,7 @@ class CommonStore {
// configs
currentModelConfigIndex: number = 0;
modelConfigs: ModelConfig[] = [];
apiParamsCollapsed: boolean = true;
modelParamsCollapsed: boolean = true;
// models
activeModelListTags: string[] = [];
@@ -169,7 +178,7 @@ class CommonStore {
autoUpdatesCheck: true,
giteeUpdatesSource: getUserLanguage() === 'zh',
cnMirror: getUserLanguage() === 'zh',
useHfMirror: false,
useHfMirror: getUserLanguage() === 'zh',
host: '127.0.0.1',
dpiScaling: 100,
customModelsPath: './models',
@@ -316,6 +325,10 @@ class CommonStore {
this.advancedCollapsed = value;
}
setApiParamsCollapsed(value: boolean) {
this.apiParamsCollapsed = value;
}
setModelParamsCollapsed(value: boolean) {
this.modelParamsCollapsed = value;
}

View File

@@ -34,4 +34,7 @@ export type Attachment = {
size: number;
content: string;
}
export type ChatParams = Omit<ApiParameters, 'apiPort'>
export type ChatParams = Omit<ApiParameters, 'apiPort'> & {
historyN: number;
markdown: boolean;
}

View File

@@ -5,6 +5,8 @@ export type ApiParameters = {
topP: number;
presencePenalty: number;
frequencyPenalty: number;
penaltyDecay?: number;
globalPenalty?: boolean;
}
export type Device = 'CPU' | 'CPU (rwkv.cpp)' | 'CUDA' | 'CUDA-Beta' | 'WebGPU' | 'WebGPU (Python)' | 'MPS' | 'Custom';
export type Precision = 'fp16' | 'int8' | 'fp32' | 'nf4' | 'Q5_1';
@@ -15,6 +17,8 @@ export type ModelParameters = {
precision: Precision;
storedLayers: number;
maxStoredLayers: number;
quantizedLayers?: number;
tokenChunkSize?: number;
useCustomCuda?: boolean;
customStrategy?: string;
useCustomTokenizer?: boolean;

View File

@@ -4,6 +4,7 @@ import {
DepCheck,
InstallPyDep,
ListDirFiles,
OpenOpenFileDialog,
ReadFileInfo,
ReadJson,
SaveJson,
@@ -25,7 +26,7 @@ import { DataProcessParameters, LoraFinetuneParameters } from '../types/train';
import { InstrumentTypeNameMap, MidiMessage, tracksMinimalTotalTime } from '../types/composition';
import logo from '../assets/images/logo.png';
import { Preset } from '../types/presets';
import { botName, Conversation, MessageType, userName } from '../types/chat';
import { botName, Conversation, MessageType, Role, userName } from '../types/chat';
import { v4 as uuid } from 'uuid';
import { findLastIndex } from 'lodash-es';
@@ -193,6 +194,10 @@ export const getStrategy = (modelConfig: ModelConfig | undefined = undefined) =>
case 'WebGPU':
case 'WebGPU (Python)':
strategy += params.precision === 'nf4' ? 'fp16i4' : params.precision === 'int8' ? 'fp16i8' : 'fp16';
if (params.quantizedLayers)
strategy += ` layer${params.quantizedLayers}`;
if (params.tokenChunkSize)
strategy += ` chunk${params.tokenChunkSize}`;
break;
case 'CUDA':
case 'CUDA-Beta':
@@ -351,7 +356,7 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
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()));
const asset = data.assets.find((a: any) => a.name.toLowerCase().includes(commonStore.platform.toLowerCase().replace('darwin', 'macos')));
if (asset) {
const updateUrl = !commonStore.settings.giteeUpdatesSource ?
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/${asset.name}` :
@@ -579,24 +584,12 @@ export async function getSoundFont() {
export const setActivePreset = (preset: Preset | null) => {
commonStore.setActivePreset(preset);
//TODO if (preset.displayPresetMessages) {
const conversation: Conversation = {};
const conversationOrder: string[] = [];
const { pushMessage, saveConversation } = newChatConversation();
if (preset)
for (const message of preset.messages) {
const newUuid = uuid();
conversationOrder.push(newUuid);
conversation[newUuid] = {
sender: message.role === 'user' ? userName : botName,
type: MessageType.Normal,
color: message.role === 'user' ? 'brand' : 'colorful',
time: new Date().toISOString(),
content: message.content,
side: message.role === 'user' ? 'right' : 'left',
done: true
};
pushMessage(message.role, message.content);
}
commonStore.setConversation(conversation);
commonStore.setConversationOrder(conversationOrder);
saveConversation();
//}
};
@@ -612,4 +605,49 @@ export function getSupportedCustomCudaFile(isBeta: boolean) {
'./backend-python/wkv_cuda_utils/wkv_cuda40.pyd';
else
return '';
}
// a wrapper for webOpenOpenFileDialog and OpenOpenFileDialog
export function OpenFileDialog(filterPattern: string): Promise<Blob> {
return new Promise((resolve) => {
OpenOpenFileDialog(filterPattern).then(async filePath => {
if (!filePath)
return;
let blob: Blob;
if (commonStore.platform === 'web')
blob = (filePath as unknown as { blob: Blob }).blob;
else
blob = await fetch(absPathAsset(filePath)).then(r => r.blob());
resolve(blob);
}).catch(e => {
toast(t('Error') + ' - ' + (e.message || e), { type: 'error', autoClose: 2500 });
});
}
);
}
export function newChatConversation() {
const conversation: Conversation = {};
const conversationOrder: string[] = [];
const pushMessage = (role: Role, content: string) => {
const newUuid = uuid();
conversationOrder.push(newUuid);
conversation[newUuid] = {
sender: role === 'user' ? userName : botName,
type: MessageType.Normal,
color: role === 'user' ? 'brand' : 'colorful',
avatarImg: role === 'user' ? undefined : logo,
time: new Date().toISOString(),
content: content,
side: role === 'user' ? 'right' : 'left',
done: true
};
};
const saveConversation = () => {
commonStore.setConversation(conversation);
commonStore.setConversationOrder(conversationOrder);
};
return { pushMessage, saveConversation };
}

View File

@@ -28,6 +28,8 @@ export function DownloadFile(arg1:string,arg2:string):Promise<void>;
export function FileExists(arg1:string):Promise<boolean>;
export function GetAbsPath(arg1:string):Promise<string>;
export function GetPlatform():Promise<string>;
export function GetPyError():Promise<string>;
@@ -40,7 +42,7 @@ export function ListDirFiles(arg1:string):Promise<Array<backend_golang.FileInfo>
export function MergeLora(arg1:string,arg2:boolean,arg3:number,arg4:string,arg5:string,arg6:string):Promise<string>;
export function OpenFileFolder(arg1:string,arg2:boolean):Promise<void>;
export function OpenFileFolder(arg1:string):Promise<void>;
export function OpenMidiPort(arg1:number):Promise<void>;

View File

@@ -54,6 +54,10 @@ export function FileExists(arg1) {
return window['go']['backend_golang']['App']['FileExists'](arg1);
}
export function GetAbsPath(arg1) {
return window['go']['backend_golang']['App']['GetAbsPath'](arg1);
}
export function GetPlatform() {
return window['go']['backend_golang']['App']['GetPlatform']();
}
@@ -78,8 +82,8 @@ export function MergeLora(arg1, arg2, arg3, arg4, arg5, arg6) {
return window['go']['backend_golang']['App']['MergeLora'](arg1, arg2, arg3, arg4, arg5, arg6);
}
export function OpenFileFolder(arg1, arg2) {
return window['go']['backend_golang']['App']['OpenFileFolder'](arg1, arg2);
export function OpenFileFolder(arg1) {
return window['go']['backend_golang']['App']['OpenFileFolder'](arg1);
}
export function OpenMidiPort(arg1) {

10
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/minio/selfupdate v0.6.0
github.com/nyaosorg/go-windows-su v0.2.1
github.com/ubuntu/gowsl v0.0.0-20230615094051-94945650cc1e
github.com/wailsapp/wails/v2 v2.7.1
github.com/wailsapp/wails/v2 v2.8.0
)
require (
@@ -38,9 +38,9 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.10 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
)

20
go.sum
View File

@@ -79,20 +79,20 @@ github.com/wailsapp/go-webview2 v1.0.10 h1:PP5Hug6pnQEAhfRzLCoOh2jJaPdrqeRgJKZhy
github.com/wailsapp/go-webview2 v1.0.10/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.7.1 h1:HAzp2c5ODOzsLC6ZMDVtNOB72ozM7/SJecJPB2Ur+UU=
github.com/wailsapp/wails/v2 v2.7.1/go.mod h1:oIJVwwso5fdOgprBYWXBBqtx6PaSvxg8/KTQHNGkadc=
github.com/wailsapp/wails/v2 v2.8.0 h1:b2NNn99uGPiN6P5bDsnPwOJZWtAOUhNLv7Vl+YxMTr4=
github.com/wailsapp/wails/v2 v2.8.0/go.mod h1:EFUGWkUX3KofO4fmKR/GmsLy3HhPH7NbyOEaMt8lBF0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -109,14 +109,14 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

12
main.go
View File

@@ -67,9 +67,12 @@ var midiAssets embed.FS
var components embed.FS
func main() {
dev := true
// Create an instance of the app structure
app := backend.NewApp()
app.Dev = true
if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") {
dev = false
app.Dev = false
backend.CopyEmbed(assets)
os.RemoveAll("./py310/Lib/site-packages/cyac-1.7.dist-info")
@@ -83,9 +86,6 @@ func main() {
backend.CopyEmbed(components)
}
// Create an instance of the app structure
app := backend.NewApp()
var zoomFactor float64 = 1.0
data, err := app.ReadJson("config.json")
if err == nil {
@@ -99,7 +99,7 @@ func main() {
}
var logger wailsLogger.Logger
if dev {
if app.Dev {
logger = wailsLogger.NewDefaultLogger()
} else {
logger = wailsLogger.NewFileLogger("crash.log")

View File

@@ -1,12 +1,12 @@
{
"version": "1.6.7",
"version": "1.7.3",
"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 and Introduction:\nhttps://github.com/josStorer/RWKV-Runner\nAuthor: [@josStorer](https://github.com/josStorer)\n\nRelated Repositories:\nRWKV-5-World: https://huggingface.co/BlinkDL/rwkv-5-world/tree/main\nRWKV-4-World: https://huggingface.co/BlinkDL/rwkv-4-world/tree/main\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\nRWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA\nMIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer\nai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server\nrwkv.cpp: https://github.com/saharNooby/rwkv.cpp\nweb-rwkv-py: https://github.com/cryscan/web-rwkv-py\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-5-World: https://huggingface.co/BlinkDL/rwkv-5-world/tree/main\nRWKV-4-World: https://huggingface.co/BlinkDL/rwkv-4-world/tree/main\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\nRWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA\nMIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer\nai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server\nrwkv.cpp: https://github.com/saharNooby/rwkv.cpp\nweb-rwkv-py: https://github.com/cryscan/web-rwkv-py\n\n</div>"
"en": "<div align=\"center\">\n\nProject Source Code and Introduction:\nhttps://github.com/josStorer/RWKV-Runner\nAuthor: [@josStorer](https://github.com/josStorer)\n\nRelated Repositories:\nRWKV-5-World: https://huggingface.co/BlinkDL/rwkv-5-world/tree/main\nRWKV-4-World: https://huggingface.co/BlinkDL/rwkv-4-world/tree/main\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\nRWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA\nRWKV-v5-lora: https://github.com/JL-er/RWKV-v5-lora\nMIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer\nai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server\nrwkv.cpp: https://github.com/saharNooby/rwkv.cpp\nweb-rwkv-py: https://github.com/cryscan/web-rwkv-py\nweb-rwkv: https://github.com/cryscan/web-rwkv\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-5-World: https://huggingface.co/BlinkDL/rwkv-5-world/tree/main\nRWKV-4-World: https://huggingface.co/BlinkDL/rwkv-4-world/tree/main\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\nRWKV-LM-LoRA: https://github.com/Blealtan/RWKV-LM-LoRA\nRWKV-v5-lora: https://github.com/JL-er/RWKV-v5-lora\nMIDI-LLM-tokenizer: https://github.com/briansemrau/MIDI-LLM-tokenizer\nai00_rwkv_server: https://github.com/cgisky1980/ai00_rwkv_server\nrwkv.cpp: https://github.com/saharNooby/rwkv.cpp\nweb-rwkv-py: https://github.com/cryscan/web-rwkv-py\nweb-rwkv: https://github.com/cryscan/web-rwkv\n\n</div>"
},
"programFiles": [
{
@@ -15,6 +15,47 @@
}
],
"models": [
{
"name": "RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"desc": {
"en": "RWKV-6 Global Languages 1.6B v2",
"zh": "RWKV-6 全球语言 1.6B v2",
"ja": "RWKV-6 グローバル言語 1.6B v2"
},
"size": 3199845663,
"SHA256": "5c9c877fb60a65cab269af175328b6aaf16d02b8b09738923254f9986e5dc440",
"lastUpdated": "2024-02-08T17:56:51",
"url": "https://huggingface.co/BlinkDL/rwkv-6-world/blob/main/RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-6-world/resolve/main/RWKV-x060-World-1B6-v2-20240208-ctx4096.pth",
"tags": [
"Official",
"RWKV-6",
"Global",
"CN",
"JP"
]
},
{
"name": "RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"desc": {
"en": "RWKV-6 Global Languages 3B v2",
"zh": "RWKV-6 全球语言 3B v2",
"ja": "RWKV-6 グローバル言語 3B v2"
},
"size": 6199859158,
"SHA256": "f1235079a07084472de86996846a6533e41e3964b153cdc1e8462cc138d8521d",
"lastUpdated": "2024-02-29T03:53:53",
"url": "https://huggingface.co/BlinkDL/rwkv-6-world/blob/main/RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-6-world/resolve/main/RWKV-x060-World-3B-v2-20240228-ctx4096.pth",
"tags": [
"Official",
"RWKV-6",
"Global",
"Recommended",
"CN",
"JP"
]
},
{
"name": "RWKV-5-World-0.1B-v1-20230803-ctx4096.pth",
"desc": {
@@ -28,7 +69,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-0.1B-v1-20230803-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-0.1B-v1-20230803-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Global"
]
@@ -46,7 +87,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-0.4B-v2-20231113-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-0.4B-v2-20231113-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Global"
]
@@ -64,9 +105,11 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-1B5-v2-20231025-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-1B5-v2-20231025-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Global"
"Global",
"CN",
"JP"
]
},
{
@@ -121,10 +164,12 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-3B-v2-20231113-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-3B-v2-20231113-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Global",
"Recommended"
"Recommended",
"CN",
"JP"
]
},
{
@@ -140,10 +185,33 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-3B-v2-20231118-ctx16k.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-3B-v2-20231118-ctx16k.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Global",
"Recommended"
"Recommended",
"CN",
"JP"
]
},
{
"name": "RWKV-5-World-7B-v2-20240128-ctx4096.pth",
"desc": {
"en": "RWKV-5 Global Languages 7B v2",
"zh": "RWKV-5 全球语言 7B v2",
"ja": "RWKV-5 グローバル言語 7B v2"
},
"size": 15036197526,
"SHA256": "a88c7274184b211e5545c8f992f0b80d03c40a447980bbfcd0f6d5858982615a",
"lastUpdated": "2024-01-28T08:42:45",
"url": "https://huggingface.co/BlinkDL/rwkv-5-world/blob/main/RWKV-5-World-7B-v2-20240128-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-world/resolve/main/RWKV-5-World-7B-v2-20240128-ctx4096.pth",
"tags": [
"Official",
"RWKV-5",
"Global",
"Recommended",
"CN",
"JP"
]
},
{
@@ -225,6 +293,27 @@
],
"customTokenizer": "backend-python/rwkv_pip/rwkv_vocab_v20230424_special_token.txt"
},
{
"name": "Mobius-r5-chat-12b-128k.pth",
"desc": {
"en": "RWKV-5 Mobius 12B Ctx128k",
"zh": "RWKV-5 Mobius 12B 128k上下文",
"ja": "RWKV-5 Mobius 12B 128kコンテキスト"
},
"size": 23157427004,
"SHA256": "2190d59e130f8d9b580e5531874f34f7eaeb7b7b6d04fb1439b7f5c5d7dbaafe",
"lastUpdated": "2024-02-24T01:33:27",
"url": "https://huggingface.co/TimeMobius/Mobius-Chat-12B-128k/blob/main/Mobius-r5-chat-12b-128k.pth",
"downloadUrl": "https://huggingface.co/TimeMobius/Mobius-Chat-12B-128k/resolve/main/Mobius-r5-chat-12b-128k.pth",
"tags": [
"Finetuned",
"RWKV-5",
"Global",
"Recommended",
"CN",
"JP"
]
},
{
"name": "RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
"desc": {
@@ -238,7 +327,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-0.1B-v1-20230617-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"CN"
]
@@ -256,7 +345,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
]
@@ -274,7 +363,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-0.4B-v1-20230618-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-0.4B-v1-20230618-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"CN"
]
@@ -292,7 +381,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
]
@@ -310,7 +399,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-1.5B-v1-20230620-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-1.5B-v1-20230620-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"CN"
]
@@ -353,7 +442,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-1.5B-v1-20230607-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-1.5B-v1-20230607-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
],
@@ -372,7 +461,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-1.5B-v1-fixed-20230612-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-1.5B-v1-fixed-20230612-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
]
@@ -461,7 +550,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-3B-v1-20230619-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-3B-v1-20230619-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
]
@@ -479,7 +568,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-3B-v1-20230625-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"CN"
]
@@ -575,7 +664,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-7B-v1-20230626-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-7B-v1-20230626-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Global"
]
@@ -742,7 +831,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-CHNtuned-7B-v1-20230709-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"CN"
]
@@ -832,7 +921,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-world/blob/main/RWKV-4-World-JPNtuned-7B-v1-20230718-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-world/resolve/main/RWKV-4-World-JPNtuned-7B-v1-20230718-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"JP"
]
@@ -867,7 +956,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"Global"
@@ -885,7 +974,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"Global"
@@ -903,7 +992,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"Global"
@@ -921,7 +1010,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"Global"
@@ -939,7 +1028,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"Global"
@@ -957,7 +1046,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
],
@@ -975,7 +1064,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-1B5-v12-Eng98%25-Other2%25-20230520-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-1B5-v12-Eng98%25-Other2%25-20230520-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
]
@@ -992,7 +1081,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
],
@@ -1010,7 +1099,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-3B-v12-Eng98%25-Other2%25-20230520-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-3B-v12-Eng98%25-Other2%25-20230520-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
]
@@ -1027,7 +1116,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"CN"
@@ -1046,7 +1135,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"CN"
@@ -1064,7 +1153,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
],
@@ -1082,7 +1171,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-7B-v12-Eng98%25-Other2%25-20230521-ctx8192.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-7B-v12-Eng98%25-Other2%25-20230521-ctx8192.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
]
@@ -1099,7 +1188,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"CN"
@@ -1118,7 +1207,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"CN"
@@ -1137,7 +1226,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven",
"CN"
@@ -1155,7 +1244,7 @@
"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",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
],
@@ -1173,7 +1262,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-14B-v12-Eng98%25-Other2%25-20230523-ctx8192.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-raven/resolve/main/RWKV-4-Raven-14B-v12-Eng98%25-Other2%25-20230523-ctx8192.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Raven"
]
@@ -1191,7 +1280,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-music/blob/main/RWKV-4-MIDI-120M-v1-20230714-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-music/resolve/main/RWKV-4-MIDI-120M-v1-20230714-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Music"
]
@@ -1209,7 +1298,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-music/blob/main/RWKV-4-MIDI-560M-v1-20230717-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-music/resolve/main/RWKV-4-MIDI-560M-v1-20230717-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Music"
]
@@ -1227,7 +1316,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-4-music/blob/main/RWKV-4-ABC-82M-v1-20230805-ctx1024.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-4-music/resolve/main/RWKV-4-ABC-82M-v1-20230805-ctx1024.pth",
"tags": [
"Main",
"Official",
"RWKV-4",
"Music"
]
@@ -1245,7 +1334,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-music/blob/main/RWKV-5-MIDI-120M-v1-20230728-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-music/resolve/main/RWKV-5-MIDI-120M-v1-20230728-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Music"
]
@@ -1263,7 +1352,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-music/blob/main/RWKV-5-MIDI-560M-v1-20230902-ctx4096.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-music/resolve/main/RWKV-5-MIDI-560M-v1-20230902-ctx4096.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Music"
]
@@ -1281,7 +1370,7 @@
"url": "https://huggingface.co/BlinkDL/rwkv-5-music/blob/main/RWKV-5-ABC-82M-v1-20230901-ctx1024.pth",
"downloadUrl": "https://huggingface.co/BlinkDL/rwkv-5-music/resolve/main/RWKV-5-ABC-82M-v1-20230901-ctx1024.pth",
"tags": [
"Main",
"Official",
"RWKV-5",
"Music"
]

67
parse_api_log.py Normal file
View File

@@ -0,0 +1,67 @@
import json
import sys
def extract_data(log_file):
entries = []
with open(log_file, 'r', encoding="utf-8") as file:
lines = file.readlines()
for i, line in enumerate(lines):
if line.startswith('Generation Prompt:') and not lines[i + 1].startswith("<pad>"):
current_entry = {'prompt': "", 'response': ""}
prompt_end_point = i + 1
for j in range(i + 1, len(lines)):
if lines[j].strip().endswith('- INFO'):
current_entry['prompt'] = current_entry['prompt'].rstrip()
break
current_entry['prompt'] += lines[j]
prompt_end_point = j
for j in range(prompt_end_point + 1, len(lines)):
if lines[j].startswith('Url:') and lines[j].strip().endswith("/completions"):
for k in range(j + 1, len(lines)):
if lines[k].startswith('Data:'):
for l in range(k + 1, len(lines)):
if "RequestsNum: " in lines[l]:
current_entry['response'] = current_entry['response'].rstrip()
entries.append(current_entry)
break
current_entry['response'] += lines[l]
else:
continue
break
else:
continue
break
return entries
def main():
log_file = 'D:\\RWKV_Runner\\api.log' if len(sys.argv) < 2 else sys.argv[1]
entries = extract_data(log_file)
try:
import cyac
trie = cyac.Trie()
histories = []
for entry in entries:
v = entry['prompt'] + entry['response']
trie.insert(v)
for entry in entries:
v = entry['prompt'] + entry['response']
for id in trie.predict(v):
pass
if trie[id] == v:
histories.append(entry)
json_data = json.dumps(histories, indent=2)
except ModuleNotFoundError:
json_data = json.dumps(entries, indent=2)
print(json_data.encode('utf-8').decode('unicode_escape'))
if __name__ == "__main__":
main()

14
scripts/merge_manifest.py Normal file
View File

@@ -0,0 +1,14 @@
import glob
import os, sys
MAIN_IMAGE_NAME=sys.argv[1]
TARGET_TAG="latest" if len(sys.argv) < 3 else sys.argv[2]
args=["docker manifest create {}:{}".format(MAIN_IMAGE_NAME, TARGET_TAG)]
for i in glob.glob("/tmp/images/*/*.txt"):
with open(i, "r") as file:
args += " --amend {}@{}".format(MAIN_IMAGE_NAME, file.readline().strip())
cmd_create="".join(args)
cmd_push="docker manifest push {}:{}".format(MAIN_IMAGE_NAME, TARGET_TAG)
os.system(cmd_create)
os.system(cmd_push)