ソースからビルド
generate() APIをソースからビルドする
Section titled “generate() APIをソースからビルドする”cmake.NET6(C#をビルドする場合)
onnxruntime-genaiリポジトリをクローンする
Section titled “onnxruntime-genaiリポジトリをクローンする”git clone https://github.com/microsoft/onnxruntime-genaicd onnxruntime-genaigenerate() APIをビルドする
Section titled “generate() APIをビルドする”このステップは、onnxruntime-genaiリポジトリのルートにいることを前提としています。
以下のすべてのビルドコマンドには--config引数があり、次のオプションを取ります。
ReleaseリリースバイナリをビルドしますDebugデバッグシンボル付きのバイナリをビルドしますRelWithDebInfoデバッグ情報付きのリリースバイナリをビルドします
Python APIをビルドする
Section titled “Python APIをビルドする”Windows CPUビルド
Section titled “Windows CPUビルド”python build.py --config ReleaseWindows DirectMLビルド
Section titled “Windows DirectMLビルド”python build.py --use_dml --config ReleaseWindows NvTensorRtRtxビルド
Section titled “Windows NvTensorRtRtxビルド”python build.py --use_trt_rtx --config Release --cuda_home <cuda_path>Linuxビルド
Section titled “Linuxビルド”python build.py --config ReleaseLinux CUDAビルド
Section titled “Linux CUDAビルド”python build.py --use_cuda --config ReleaseMacビルド
Section titled “Macビルド”python build.py --config ReleaseJava APIをビルドする
Section titled “Java APIをビルドする”python build.py --build_java --config ReleaseAndroid用にビルドする
Section titled “Android用にビルドする”Windowsでビルドする場合は、ninjaをインストールします。
pip install ninjaビルドスクリプトを実行します。
python build.py --build_java --android --android_home <Android SDKへのパス> --android_ndk_path <NDKインストールへのパス> --android_abi [armeabi-v7a|arm64-v8a|x86|x86_64] --config Releaseアプリケーションにライブラリをインストールする
Section titled “アプリケーションにライブラリをインストールする”Pythonホイールをインストールする
Section titled “Pythonホイールをインストールする”# onnxruntime-genaiホイールを含むフォルダにディレクトリを変更します# Linuxの例:cd build/Linux/Release/wheel/pip install *.whlNuGetをインストールする
Section titled “NuGetをインストールする”近日公開
JARをインストールする
Section titled “JARをインストールする”build/Windows/Release/src/java/build/libs/*.jarをアプリケーションにコピーします。
AARをインストールする
Section titled “AARをインストールする”build/Android/Release/src/java/build/android/outputs/aar/onnxruntime-genai-release.aarをアプリケーションにコピーします。
C/C++ヘッダーファイルとライブラリをインストールする
Section titled “C/C++ヘッダーファイルとライブラリをインストールする”Windows
Section titled “Windows”src\ort_genai.hのヘッダーとbuild\Windows\Releaseのライブラリを使用します。
src/ort_genai.hのヘッダーとbuild/Linux/Releaseのライブラリを使用します。