Llava15ChatHandler - Cache Image Encoding

オープン
#2,222 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
performance

調査の方向性

Llava15ChatHandlerのソースコードを調べ、現在、各ターンで画像のエンコードがどのように行われているかを理解してください。目標は、エンコード済みの結果をキャッシュすることです。まず画像処理のフローを調査し、キャッシュをどこに保存して再利用するかを特定してください。コードベースに既存のキャッシュ機構があるか確認してください。実装が成功すれば、複数ターンの会話で画像を再エンコードする必要がなくなり、特にCPU上での推論速度が向上します。

索引モデルが issue の本文から書いたものです。

説明

Is your feature request related to a problem? Please describe.
In multi-turn conversations that include images, the image encoding is performed on each turn. This slows down inference considerably, especially when running with pure CPU.

Describe the solution you'd like
Once an image has been encoded, the result can be reused, rather than re-encoding every turn.

Describe alternatives you've considered
Storing a detailed description of the image in the conversation history, and popping out the image_url part. This is not as flexible however, if wanting to query about something specfic later on that wasn't captured in the saved description.

Additional context
I have implemented a solution locally editing the source code (with some heavy AI assistance, as I am not an expert on low level LLM coding) and seem to have this feature working, by storing chunk signatures instead of immediately processing and manipulating the kv_cache_seq_rm, but not really sure if its a safe/sustainable approach.

I could share the source code or raise a draft PR if it'd be useful.

Thanks!

主要言語
Python
スター
10.7k
フォーク
1.5k
平均マージ
1時間 40分
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

abetlen/llama-cpp-python のほかの issue

abetlen/llama-cpp-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。