Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rwkv support #158

Merged
merged 7 commits into from
May 3, 2023
Merged

feat: add rwkv support #158

merged 7 commits into from
May 3, 2023

Conversation

mudler
Copy link
Owner

@mudler mudler commented May 2, 2023

This PR adds initial support to LocalAI for https://github.com/BlinkDL/RWKV-LM with https://github.com/saharNooby/rwkv.cpp and https://github.com/donomii/go-rwkv.cpp. (acknowledgement goes to @BlinkDL, @saharNooby and @donomii for their respective projects ❤️ , and of course @ggerganov for ggml ) . RWKV's models are extremely fast on CPU!

The Makefile points to my fork just waiting for donomii/go-rwkv.cpp#1 to be merged.

It supports fully the endpoint already exposed, and also token stream. It also updates the README with relevant projects involved.

In a glance you can drop the ggml-quantized model in the models folder with a tokenizer file next to it:

36464540 -rw-r--r--  1 mudler mudler 1.2G May  3 10:51 rwkv_small
36464543 -rw-r--r--  1 mudler mudler 2.4M May  3 10:51 rwkv_small.tokenizer.json

and start to use it with the API. It is strongly adviced to configure it with a yaml file, as models needs specific prompts.

Update: as noted by discord by @saharNooby, we could cache prompts to for faster inference (https://gist.github.com/saharNooby/5a3dd5a6b4caf9b9b110b66a8f2a63a7): https://discordapp.com/channels/992359628979568762/1097928558309036042/1103249830207303741 . That's a good follow up to improve performance even more!

Signed-off-by: mudler <mudler@mocaccino.org>
@mudler mudler marked this pull request as ready for review May 3, 2023 09:17
@mudler
Copy link
Owner Author

mudler commented May 3, 2023

I'll have a round-up of PRs to update docs until we consolidate features on master, and then will cut a new release

@mudler mudler merged commit 751b7ec into master May 3, 2023
3 checks passed
@mudler mudler deleted the rwkv branch May 3, 2023 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant