Add runtime LoRA adapter swapping

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp

調査の方向性

まず、提案されている3ファイルのパッチと関連する issue #2046 を確認し、既存の StorageView および Python binding のエントリポイントを追跡します。意図されたスコープ、実験的な build-flag の動作、および binding を WhisperWrapper、Encoder/Generator、ベースの Model のいずれに配置すべきかを確認します。完了条件は、API の配置とスコープについて合意し、言及されているモデルパスでの実行時の切り替えを検証することです。

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

説明

Hi,
I've built a working patch for runtime LoRA swapping and want to confirm it's within scope before opening a PR.

What it does: writes W ← W + scale × (B @ A) in-place on an existing StorageView buffer. This allows swapping LoRA adapters at runtime without reloading the model.

Motivation: serving N language-specific adapters on a single base model. Measured on L4 GPU (Whisper-large-v3 float16): cross-adapter swap ~54 ms vs ~1,520 ms for full model reload.

Patch size: 142 lines across 3 files. No existing API changed.

Questions:

Is this within scope for CTranslate2?
Should it be guarded by an experimental build flag?
Where should the Python binding live — currently on WhisperWrapper, but we've verified it works on OmniASR (Encoder/Generator) with the same pattern. Should it be on the base Model instead?
Happy to open a PR if the direction looks good.

Related: #2046

主要言語
C++
スター
4.8k
フォーク
557
平均マージ
1日 6時間
マージ済み PR(30日)
24

環境構築

はじめの一歩

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

OpenNMT/CTranslate2 のほかの issue

OpenNMT/CTranslate2 の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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