<img src="https://github.com/josStorer/RWKV-Runner/assets/13366013/65c46133-7506-4b54-b64f-fe49f188afa7">
このプロジェクトは、すべてを自動化することで、大規模な言語モデルを使用する際の障壁をなくすことを目的としています。必要なのは、 わずか数メガバイトの軽量な実行プログラムだけです。さらに、このプロジェクトは OpenAI API と互換性のあるインターフェイスを提供しており、 すべての ChatGPT クライアントは RWKV クライアントであることを意味します。
FAQs | プレビュー | ダウンロード | シンプルなデプロイの例 | サーバーデプロイ例 | MIDIハードウェア入力
サーバーに backend-python
をデプロイし、このプログラムをクライアントとして使用することができます。設定されたAPI URLにサーバーアドレスを入力してください。
もし、あなたがデプロイし、外部に公開するサービスを提供している場合、APIゲートウェイを使用してリクエストのサイズを制限し、 長すぎるプロンプトの提出がリソースを占有しないようにしてください。さらに、実際の状況に応じて、リクエストの max_tokens の上限を制限してください:https://github.com/josStorer/RWKV-Runner/blob/master/backend-python/utils/rwkv.py#L567 、デフォルトは le=102400 ですが、極端な場合には単一の応答が大量のリソースを消費する可能性があります。
デフォルトの設定はカスタム CUDA カーネルアクセラレーションを有効にしています。互換性の問題 (文字化けを出力する)
が発生する可能性がある場合は、コンフィグページに移動し、Use Custom CUDA kernel to Accelerate
をオフにしてください、あるいは、GPUドライバーをアップグレードしてみてください。
Windows Defender
がこれをウイルスだと主張する場合は、v1.3.7_win.zip
をダウンロードして最新版に自動更新させるか、信頼済みリストに追加してみてください (Windows Security -> Virus & threat protection -> Manage settings -> Exclusions -> Add or remove exclusions -> Add an exclusion -> Folder -> RWKV-Runner)。
異なるタスクについては、API パラメータを調整することで、より良い結果を得ることができます。例えば、翻訳タスクの場合、Temperature を 1 に、Top_P を 0.3 に設定してみてください。
API URL
と API Key を入力してください)git clone https://github.com/josStorer/RWKV-Runner
# Then
cd RWKV-Runner
python ./backend-python/main.py #The backend inference service has been started, request /switch-model API to load the model, refer to the API documentation: http://127.0.0.1:8000/docs
# Or
cd RWKV-Runner/frontend
npm ci
npm run build #Compile the frontend
cd ..
python ./backend-python/webui_server.py #Start the frontend service separately
# Or
python ./backend-python/main.py --webui #Start the frontend and backend service at the same time
# Help Info
python ./backend-python/main.py -h
ab -p body.json -T application/json -c 20 -n 100 -l http://127.0.0.1:8000/chat/completions
body.json:
{
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
注意: v1.4.0 では、埋め込み API の品質が向上しました。生成される結果は、以前のバージョンとは互換性がありません。 もし、embeddings API を使って知識ベースなどを生成している場合は、再生成してください。
LangChain を使用している場合は、OpenAIEmbeddings(openai_api_base="http://127.0.0.1:8000", openai_api_key="sk-")
を使用してください
import numpy as np
import requests
def cosine_similarity(a, b):
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
values = [
"I am a girl",
"我是个女孩",
"私は女の子です",
"广东人爱吃福建人",
"我是个人类",
"I am a human",
"that dog is so cute",
"私はねこむすめです、にゃん♪",
"宇宙级特大事件!号外号外!"
]
embeddings = []
for v in values:
r = requests.post("http://127.0.0.1:8000/embeddings", json={"input": v})
embedding = r.json()["data"][0]["embedding"]
embeddings.append(embedding)
compared_embedding = embeddings[0]
embeddings_cos_sim = [cosine_similarity(compared_embedding, e) for e in embeddings]
for i in np.argsort(embeddings_cos_sim)[::-1]:
print(f"{embeddings_cos_sim[i]:.10f} - {values[i]}")
Tip: You can download https://github.com/josStorer/sgm_plus and unzip it to the program's assets/sound-font directory
to use it as an offline sound source. Please note that if you are compiling the program from source code, do not place
it in the source code directory.
MIDIキーボードをお持ちでない場合、Virtual Midi Controller 3 LE
などの仮想MIDI入力ソフトウェアを使用することができます。loopMIDI
を組み合わせて、通常のコンピュータキーボードをMIDI入力として使用できます。
Tip: You can download https://github.com/josStorer/sgm_plus and unzip it to the program's assets/sound-font directory
to use it as an offline sound source. Please note that if you are compiling the program from source code, do not place
it in the source code directory.
$ claude mcp add RWKV-Runner \
-- python -m otcore.mcp_server <graph>