Coder Social home page Coder Social logo

rwkv-light-api's Introduction

☁️RWKV-Light-API

A Lightweight and Extensible RWKV API for Inference

关于RWKV:

RWKV-Runner不可编辑?ChatRWKV功能太少?那么来尝试一下RWKV-Light-API吧。

提示:适合初步了解RWKV,并希望能在它的基础上进行一定的扩展或研究的人群。


它能做什么?

  • 花式聊天

  • 快速保存语料

  • QQ机器人

  • 实现滑窗推理

  • 自定义langchain

……


部署方法:

  1. 克隆仓库
git clone https://github.com/ssg-qwq/RWKV-Light-API
  1. 确保电脑上有torch和cuda开发环境,安装依赖。
pip install -r requirements.txt
  1. 在目录下创建models文件夹,并将已有的rwkv模型保存(在 https://huggingface.co/BlinkDL/rwkv-4-world 下载官方模型)
  2. 更改myprompt.py来自定义prompt
  3. 调整代码中的配置。
model_path = "./RWKV-My-API/models/your_model"
  1. 运行
python chatbot.py

然后根据帮助来进行对话即可。


关于扩展的若干tips

  1. 对话使用Conversation类来存储,便于修改
  2. 在chatbot类中,会用conversation_hist变量来存储历史的对话内容,并与state对齐

对话说明

        直接输入内容 --> 和机器人聊天,用\\n代表换行
        + --> 让机器人换个回答
        /reset --> 重置对话;/reset [角色名]--> 重置对话,并且换角色
        /char [角色名] [消息] --> 作为某个角色发起一轮对话。
        /listen [角色名] --> 让某个角色说一段话
        /sys [消息] --> 发送一个系统消息
        /save [存档名] --> 存档;/svlist 显示目前已有存档
        /load [存档名] --> 读档
        /set -[变量名] [变量值] --> 更改变量,可选:temp,top_p,alpha_presence,alpha_frequency
        /args --> 查看当前变量
        /cancel --> 取消上一轮对话; /hist --> 显示对话历史
        /ctx --> 计算当前token数
        /add --> [角色名] [消息] 增加一段对话(不触发回复)
        --> 任何对话请求的末尾(包含/char) --to [角色名] 可以选择回复你的角色
        /svhist --> 将对话历史保留为标准语料格式
        /setup --> 增加任意格式上下文

有时间的话,会把一些函数的说明补上(或者整理代码),如果着急,可以发PR

rwkv-light-api's People

Contributors

ssg-qwq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.