免费且开源的国产大模型-RWKV / ai #23

Words
257
Reading
2 min
Listen
Play
3y

rwkv.jpg

https://www.rwkv.com/

RWKV是一种无需注意力机制的循环神经网络,因此速度更快且更省显存。它还支持 GPT 模式并行训练。还好,名字不再是啥驼啊马的,改成鸟了。看来这帮搞大模型的也就这点恶趣味。

目前它已经在Hugging Face上开源,还制作了免费的API接口。我试着调用了下,效果还是不错的。

下载与资源

huggingface |
官网 |
论文 |
github |
电脑使用安装包 |
手机使用安装包 |
RWKV的Chat模型 |
中文小说续写体验 |
微调教学 |
本地部署 |

API节点

https://better-chat-rwkv.ai-creator.net/
https://rwkv.ai-creator.net/jpntuned/v1/chat/completions
https://rwkv.ai-creator.net/chntuned/v1/chat/completions

python使用

import requests

def send_get_request(prompt):
    try:
        url= "https://rwkv.ai-creator.net/chntuned/v1/chat/completions"
        message=[{"role": "user", "content": prompt}]
        data = {
            "messages":message,
            "temperature":0.3,
            "max_tokens":1500
        }
        headers = {'content-type': 'application/json', 'Authorization': 'Bearer '}
        response = requests.post(url=url, json=data, headers=headers)
        result = eval(response.text)
        response_text = result["choices"][0]["message"]["content"]
        print("res:",response_text)
        return ""

    except requests.exceptions.HTTPError as e:
        print('HTTPError:', e.response.status_code, e.response.reason)
    except requests.exceptions.RequestException as e:
        print('RequestException:', e)

response_data = send_get_request("introduce youself")
print(response_data)

nodejs使用

import fetch from "node-fetch"

const url= "https://rwkv.ai-creator.net/chntuned/v1/chat/completions"
async function test(){
    const response = await fetch(url, {
      method: 'POST',
      headers: {
        'content-type': 'application/json'
      },
      body: JSON.stringify({
        messages: [
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "介绍一下你自己"}
        ],
        "temperature":0.3,
      })
    })
        const result = await response.text()
    const res = JSON.parse(result)
    console.log(566, res.choices[0].message.content)

}
test()

RWKV的参数和调用和 OpenAI API几乎一致,看来OpenAI事实成了行业标准了,后面的模型几乎都以它为标准啰。如果它的稳定性不错,过几天就接入AI·Joe, 大家多个免费地选择!

免费且开源的国产大模型-RWKV / ai #23 | Ecency