bge-reranker-v2-m3 GGUF (f16)
BAAI/bge-reranker-v2-m3 を、llama.cpp の
convert_hf_to_gguf.py で GGUF 形式(f16)に変換したものです。
配布元の BAAI は公式の GGUF を出していないため、llama.cpp の --reranking でそのまま使える
形式に変換して置いています。変換以外の加工はしていません。
ファイル
| ファイル | サイズ | 精度 |
|---|---|---|
bge-reranker-v2-m3-f16.gguf | 約1GB | f16 |
使い方
llama.cpp のサーバーを --reranking で起動します。埋め込み用の --embedding とは同じ
サーバーインスタンスで併用できないため、別プロセスで起動してください。
llama-server.exe -m models\bge-reranker-v2-m3-f16.gguf --reranking --pooling rank --host 127.0.0.1 --port 8082
/v1/rerank に問い合わせると、候補の並び替え結果が返ります。
動作を確認する
変換した GGUF は、分類ヘッドが正しく取り込まれていないとエラーを出さないままスコアだけが 意味を失うことがあります。関連度がはっきり違う文章をいくつか用意して、正しい順番で並ぶかを 確認してから使ってください。
変換の手順
git clone https://github.com/ggml-org/llama.cpp.git llama.cpp-src
cd llama.cpp-src
uv venv --python 3.12
uv pip install -r requirements/requirements-convert_hf_to_gguf.txt
uv run hf download BAAI/bge-reranker-v2-m3 --local-dir bge-reranker-v2-m3
uv run python convert_hf_to_gguf.py bge-reranker-v2-m3 --outfile bge-reranker-v2-m3-f16.gguf --outtype f16
Python のバージョンを指定しないと最新版が選ばれ、依存パッケージの非互換で変換が止まります。
--python 3.12 は省略しないでください。
ライセンス
元モデルと同じ MIT License です。著作権は配布元の北京智源人工知能研究院(BAAI)にあります。
MIT License
Copyright (c) 2023 BAAI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.