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

特定のローカルLLMでの発言数制限における問題 #78

Open
JunzoKamahara opened this issue Jun 22, 2024 · 3 comments
Open

Comments

@JunzoKamahara
Copy link
Contributor

JunzoKamahara commented Jun 22, 2024

特定のローカルLLM(具体的にはCommand R PlusやMistral系?)では、ユーザroleがuser/assistant/user/assitant/user/...という順序になっていないとエラーになるものがありました。その場合Bad Request 405が返ってきます。
調べてみると、発言履歴を10個だけ使っていますが、この場合「assitant/user」の5回繰り返しになります。先頭がassistantoなら良さそうなんですが、実は最初にsystem promptが入っているので、systemはassistanto相当になり、assistant/assitantと続くのでエラーになるようです。
単純にエラーをなくすだけなら、slice(-11)とかにすればエラーは出なくなります。
あるいは、この系統のLLMでは、system promptをuser roleに変更するとか(すいません、確認できていません)もありそうですが、モデル毎の設定を追加するのはちょっと面倒ですね。
src/pages/index.tsx:484
const messages: Message[] = [
{
role: "system",
content: systemPrompt,
},
...messageLog.slice(-10),
];

@JunzoKamahara
Copy link
Contributor Author

あ、すいません、vllmのデフォルトチャットテンプレートを使用しているためかもしれません。vllm側で工夫すればいいのかな。

vllm-project/vllm#2112

@JunzoKamahara JunzoKamahara changed the title ローカル 特定のローカルLLMでの発言数制限における問題 Jun 22, 2024
@tegnike
Copy link
Owner

tegnike commented Jun 22, 2024

Issueありがとうございます!

おお、ローカルLLMにもAnthropic Claudeみたいな仕様のLLMがあるんですね👀

Claudeで下記のようなロジックを組んでるので転用できるかもしれません!
後ほど確認しておきます!

  • 必ず user から始まるようにする
  • 必ず user => assistant => user => ... の順番にする

ちなみにですが、エラーの出るLLMの名前おしえてもらってよいですか?

@JunzoKamahara
Copy link
Contributor Author

すいません、返事遅くなりました。CohereのCommand R Plus 70Bを量子化したものをvllmで動かしています。

@tegnike tegnike moved this to Todo in aituber-kit Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants