https://github.com/blinkdl/chatrwkv

ChatRWKV is like ChatGPT but powered by RWKV (100% RNN) language model, and open source.

https://github.com/blinkdl/chatrwkv

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    1 of 18 committers (5.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

chatbot chatgpt language-model pytorch rnn rwkv

Keywords from Contributors

transformer diffusers stable-diffusion
Last synced: 5 months ago · JSON representation

Repository

ChatRWKV is like ChatGPT but powered by RWKV (100% RNN) language model, and open source.

Basic Info
  • Host: GitHub
  • Owner: BlinkDL
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 29.8 MB
Statistics
  • Stars: 9,503
  • Watchers: 94
  • Forks: 703
  • Open Issues: 56
  • Releases: 0
Topics
chatbot chatgpt language-model pytorch rnn rwkv
Created about 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Funding License

README.md

ChatRWKV (pronounced as "RwaKuv" (rʌkuv in IPA), from 4 major params: R W K V)

RWKV homepage: https://www.rwkv.com

RWKV-7 code: https://github.com/BlinkDL/RWKV-LM/tree/main/RWKV-v7

ChatRWKV is like ChatGPT but powered by my RWKV (100% RNN) language model, which is the only RNN (as of now) that can match transformers in quality and scaling, while being faster and saves VRAM.

Our latest version is RWKV-7 https://arxiv.org/abs/2503.14456 (Preview models: https://huggingface.co/BlinkDL/temp )

Gradio Demo 1: https://huggingface.co/spaces/BlinkDL/RWKV-Gradio-1

Gradio Demo 2: https://huggingface.co/spaces/BlinkDL/RWKV-Gradio-2

RWKV-LM main repo: https://github.com/BlinkDL/RWKV-LM (explanation, fine-tuning, training, etc.)

Chat Demo for developers: https://github.com/BlinkDL/ChatRWKV/blob/main/APIDEMOCHAT.py

RWKV Discord: https://discord.gg/bDSBUMeFpc (7k+ members)

Twitter: https://twitter.com/BlinkDL_AI

Homepage: https://www.rwkv.com/

Raw cutting-edge RWKV weights: https://huggingface.co/BlinkDL

HF-compatible RWKV weights: https://huggingface.co/RWKV

Use v2/convert_model.py to convert a model for a strategy, for faster loading & saves CPU RAM.

Note RWKVCUDAON will build a CUDA kernel (much faster & saves VRAM). Here is how to build it ("pip install ninja" first): ```

How to build in Linux: set these and run v2/chat.py

export PATH=/usr/local/cuda/bin:$PATH export LDLIBRARYPATH=/usr/local/cuda/lib64:$LDLIBRARYPATH

How to build in win:

Install VS2022 build tools (https://aka.ms/vs/17/release/vs_BuildTools.exe select Desktop C++). Reinstall CUDA 11.7 (install VC++ extensions). Run v2/chat.py in "x64 native tools command prompt". ``` RWKV pip package: https://pypi.org/project/rwkv/ (please always check for latest version and upgrade)

https://github.com/cgisky1980/ai00rwkvserver Fastest GPU inference API with vulkan (good for nvidia/amd/intel)

https://github.com/cryscan/web-rwkv backend for ai00rwkvserver

https://github.com/saharNooby/rwkv.cpp Fast CPU/cuBLAS/CLBlast inference: int4/int8/fp16/fp32

https://github.com/JL-er/RWKV-PEFT lora/pissa/Qlora/Qpissa/state tuning

https://github.com/RWKV/RWKV-infctx-trainer Infctx trainer

World demo script: https://github.com/BlinkDL/ChatRWKV/blob/main/APIDEMOWORLD.py

Raven Q&A demo script: https://github.com/BlinkDL/ChatRWKV/blob/main/v2/benchmark_more.py

ChatRWKV-strategy

RWKV in 150 lines (model, inference, text generation): https://github.com/BlinkDL/ChatRWKV/blob/main/RWKVin150_lines.py

🔥 RWKV v5 in 250 lines 🔥 (with tokenizer too): https://github.com/BlinkDL/ChatRWKV/blob/main/RWKVv5demo.py

🔥 Building your own RWKV inference engine 🔥: begin with https://github.com/BlinkDL/ChatRWKV/blob/main/src/model_run.py which is easier to understand (used by https://github.com/BlinkDL/ChatRWKV/blob/main/chat.py).

RWKV preprint https://arxiv.org/abs/2305.13048

RWKV-paper

RWKV v6 illustrated:

RWKV-v6

Cool Community RWKV Projects:

https://github.com/saharNooby/rwkv.cpp fast i4 i8 fp16 fp32 CPU inference using ggml

https://github.com/harrisonvanderbyl/rwkv-cpp-cuda fast windows/linux & cuda/rocm/vulkan GPU inference (no need for python & pytorch)

https://github.com/Blealtan/RWKV-LM-LoRA LoRA fine-tuning

https://github.com/josStorer/RWKV-Runner cool GUI

More RWKV projects: https://github.com/search?o=desc&q=rwkv&s=updated&type=Repositories

ChatRWKV v2: with "stream" and "split" strategies, and INT8. 3G VRAM is enough to run RWKV 14B :) https://github.com/BlinkDL/ChatRWKV/tree/main/v2 ```python os.environ["RWKVJITON"] = '1' os.environ["RWKVCUDAON"] = '0' # if '1' then use CUDA kernel for seq mode (much faster) from rwkv.model import RWKV # pip install rwkv model = RWKV(model='/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-1b5/RWKV-4-Pile-1B5-20220903-8040', strategy='cuda fp16')

out, state = model.forward([187, 510, 1563, 310, 247], None) # use 20B_tokenizer.json print(out.detach().cpu().numpy()) # get logits out, state = model.forward([187, 510], None) out, state = model.forward([1563], state) # RNN has state (use deepcopy if you want to clone it) out, state = model.forward([310, 247], state) print(out.detach().cpu().numpy()) # same result as above ``` RWKV-eval

Here is https://huggingface.co/BlinkDL/rwkv-4-raven/blob/main/RWKV-4-Raven-14B-v7-Eng-20230404-ctx4096.pth in action: ChatRWKV

When you build a RWKV chatbot, always check the text corresponding to the state, in order to prevent bugs.

  1. Never call raw forward() directly. Instead, put it in a function that will record the text corresponding to the state.

(For v4-raven models, use Bob/Alice. For v4/v5/v6-world models, use User/Assistant)

  1. The best chat format (check whether your text is of this format): Bob: xxxxxxxxxxxxxxxxxx\n\nAlice: xxxxxxxxxxxxx\n\nBob: xxxxxxxxxxxxxxxx\n\nAlice:
  • There should not be any space after the final "Alice:". The generation result will have a space in the beginning, and you can simply strip it.
  • You can use \n in xxxxx, but avoid \n\n. So simply do xxxxx = xxxxx.strip().replace('\r\n','\n').replace('\n\n','\n')

If you are building your own RWKV inference engine, begin with https://github.com/BlinkDL/ChatRWKV/blob/main/src/model_run.py which is easier to understand (used by https://github.com/BlinkDL/ChatRWKV/blob/main/chat.py)

The lastest "Raven"-series Alpaca-style-tuned RWKV 14B & 7B models are very good (almost ChatGPT-like, good at multiround chat too). Download: https://huggingface.co/BlinkDL/rwkv-4-raven

Previous old model results: ChatRWKV ChatRWKV ChatRWKV ChatRWKV ChatRWKV ChatRWKV ChatRWKV

中文模型

QQ群 553456870(加入时请简单自我介绍)。有研发能力的朋友加群 325154699。

中文使用教程:https://zhuanlan.zhihu.com/p/618011122 https://zhuanlan.zhihu.com/p/616351661

推荐UI:https://github.com/l15y/wenda

Star History

Star History Chart

Owner

  • Name: PENG Bo
  • Login: BlinkDL
  • Kind: user

RWKV is all you need

GitHub Events

Total
  • Issues event: 5
  • Watch event: 185
  • Issue comment event: 3
  • Push event: 5
  • Pull request review event: 1
  • Pull request event: 5
  • Fork event: 22
Last Year
  • Issues event: 5
  • Watch event: 185
  • Issue comment event: 3
  • Push event: 5
  • Pull request review event: 1
  • Pull request event: 5
  • Fork event: 22

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 368
  • Total Committers: 18
  • Avg Commits per committer: 20.444
  • Development Distribution Score (DDS): 0.522
Past Year
  • Commits: 12
  • Committers: 3
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
BlinkDL a@a****m 176
PENG Bo 3****L 147
daquexian d****6@g****m 16
Blealtan Cao b****n@o****m 8
KerfuffleV2 k****e@k****e 3
cryscan c****n@u****u 3
oobabooga 1****a 3
EgrorBs 4****s 2
13401015321 k****s@q****m 1
Chui c****i@c****m 1
MasterYuan418 5****8 1
Pengan p****7@m****m 1
Zhiyuan Li u****7@g****m 1
harrisonvanderbyl 3****l 1
josc146 j****r@o****m 1
quantumliu l****0@s****m 1
tosiyuki b****n@g****m 1
zk-wz j****2@1****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 115
  • Total pull requests: 82
  • Average time to close issues: 11 days
  • Average time to close pull requests: 21 days
  • Total issue authors: 99
  • Total pull request authors: 43
  • Average comments per issue: 2.66
  • Average comments per pull request: 0.66
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 7
  • Pull requests: 6
  • Average time to close issues: 4 months
  • Average time to close pull requests: 7 minutes
  • Issue authors: 7
  • Pull request authors: 3
  • Average comments per issue: 0.29
  • Average comments per pull request: 0.17
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • djaffer (4)
  • ZTurboX (2)
  • bello7777 (2)
  • Maykeye (2)
  • FreeBlues (2)
  • fubincom (2)
  • malv-c (2)
  • jasonmhead (2)
  • jcl2023 (2)
  • lmsdscav (2)
  • KerfuffleV2 (2)
  • oobabooga (2)
  • bennmann (2)
  • dayu1979 (1)
  • zhanghui-china (1)
Pull Request Authors
  • daquexian (15)
  • BlinkDL (9)
  • cryscan (6)
  • Blealtan (4)
  • zhiyuan1i (3)
  • EgrorBs (3)
  • AGENDD (2)
  • elsatch (2)
  • Nintorac (2)
  • hypnopump (2)
  • kytimmylai (2)
  • beingPurple (2)
  • wannaphong (2)
  • digger-yu (1)
  • yynil (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 8,750 last-month
  • Total docker downloads: 1,758
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 44
    (may contain duplicates)
  • Total versions: 59
  • Total maintainers: 2
pypi.org: rwkv

The RWKV Language Model

  • Versions: 54
  • Dependent Packages: 1
  • Dependent Repositories: 44
  • Downloads: 8,722 Last month
  • Docker Downloads: 1,758
Rankings
Stargazers count: 0.3%
Forks count: 1.9%
Dependent repos count: 2.2%
Average: 2.7%
Docker downloads count: 3.4%
Downloads: 3.7%
Dependent packages count: 4.8%
Maintainers (1)
Last synced: 6 months ago
pypi.org: rwkv-beta

The RWKV Language Model

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 28 Last month
Rankings
Dependent packages count: 7.6%
Average: 38.6%
Dependent repos count: 69.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • prompt_toolkit *
  • tokenizers >=0.13.2
rwkv_pip_package/pyproject.toml pypi
  • tokenizers >= 0.13.2