Langchain-Chatchat icon indicating copy to clipboard operation
Langchain-Chatchat copied to clipboard

[FEATURE] 支持 RWKV 模型(目前已有 pip package & rwkv.cpp 等等)

Open BlinkDL opened this issue 2 years ago • 3 comments

您好,我是 RWKV 的作者,介绍见:https://zhuanlan.zhihu.com/p/626083366

RWKV也有langchain 能力,不过prompt的格式有点区别,欢迎大家一起合作加入 RWKV 的支持 :)

目前支持 RWKV 的中英文界面有:

  • 闻达:https://github.com/l15y/wenda
  • Gradio DEMO: https://huggingface.co/spaces/BlinkDL/Raven-RWKV-7B
  • ooba:https://github.com/oobabooga/text-generation-webui/issues/1401

使用方法:

  • pip package: https://pypi.org/project/rwkv/
  • 问答DEMO代码:https://github.com/BlinkDL/ChatRWKV/blob/main/v2/benchmark_more.py
  • 聊天代码:https://github.com/BlinkDL/ChatRWKV
  • CPU INT4/8 量化运行: https://github.com/saharNooby/rwkv.cpp

BlinkDL avatar May 01 '23 20:05 BlinkDL

您好,感谢您发来的邀约🙏

我们几位开发人员也很乐意支持各类模型,近期我们测试看看,如果有不顺利之处再跟您沟通。

imClumsyPanda avatar May 01 '23 23:05 imClumsyPanda

我们 也在期待着

Galaxy-Ding avatar May 15 '23 07:05 Galaxy-Ding

请问是否已支持rwkv?目前在LMsys.org RWKV模型排名超过ChatGLM-6b模型

在本机使用langchain可以运行成功,模型文件如下: 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 https://raw.githubusercontent.com/BlinkDL/ChatRWKV/main/20B_tokenizer.json

from langchain.llms import RWKV

Test the model

def generate_prompt(instruction, input=None): if input: return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

Instruction:

{instruction}

Input:

{input}

Response:

""" else: return f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.

Instruction:

{instruction}

Response:

"""

model = RWKV(model="/root/autodl-tmp/rwkv-4-raven/RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth", strategy="cuda fp16", tokens_path="/root/autodl-tmp/rwkv-4-raven/20B_tokenizer.json") response = model(generate_prompt("Once upon a time, "))

显存使用14GB

exceedzhang avatar May 22 '23 11:05 exceedzhang

已通过支持fastchat api调用的方式增加对RWKV模型的支持。

imClumsyPanda avatar May 31 '23 15:05 imClumsyPanda

已通过支持fastchat api调用的方式增加对RWKV模型的支持。

使用fastchat api调用时,RWKV模型的部署环境时什么呢(操作系统、显卡、CUDA版本、驱动的版本)

FlyForFun-S avatar Jun 26 '23 12:06 FlyForFun-S