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

Update generate() build from source #22136

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 8 additions & 45 deletions docs/genai/howto/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,9 @@ git clone https://github.com/microsoft/onnxruntime-genai
cd onnxruntime-genai
```

## Download ONNX Runtime binaries

By default, the onnxruntime-genai build expects to find the ONNX Runtime include and binaries in a folder called `ort` in the root directory of onnxruntime-genai. You can put the ONNX Runtime files in a different location and specify this location to the onnxruntime-genai build via the `--ort_home` command line argument.


These instructions assume you are in the `onnxruntime-genai` folder.

#### Windows

These instruction use `win-x64`. Replace this if you are using a different architecture.

```bash
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.19.2/onnxruntime-win-x64-1.19.2.zip -o onnxruntime-win-x64-1.19.2.zip
tar xvf onnxruntime-win-x64-1.19.2.zip
move onnxruntime-win-x64-1.19.2 ort
```

#### Linux and Mac

These instruction use `linux-x64-gpu`. Replace this if you are using a different architecture.

```bash
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.19.2/onnxruntime-linux-x64-gpu-1.19.2.tgz -o onnxruntime-linux-x64-gpu-1.19.2.tgz
tar xvzf onnxruntime-linux-x64-gpu-1.19.2.tgz
mv onnxruntime-linux-x64-gpu-1.19.2 ort
```

#### Android

If you do not already have an `ort` folder, create one.

```bash
mkdir ort
```

```bash
curl -L https://repo1.maven.org/maven2/com/microsoft/onnxruntime/onnxruntime-android/1.19.2/onnxruntime-android-1.19.2.aar -o ort/onnxruntime-android-1.19.2.aar
cd ort
tar xvf onnxruntime-android-1.19.2.aar
cd ..
```

## Build the generate() API

This step assumes that you are in the root of the onnxruntime-genai repo, and you have followed the previous steps to copy the onnxruntime headers and binaries into the folder specified by <ORT_HOME>, which defaults to `onnxruntime-genai/ort`.
This step assumes that you are in the root of the onnxruntime-genai repo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you can still keep the above instruction for case that user wants to build with their own downloaded ORT version. It is useful for case that user wants to build their own C/C++ binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but this will be a rare case (only when the ORT API changes). I can add a section at the end


All of the build commands below have a `--config` argument, which takes the following options:
- `Release` builds release binaries
Expand Down Expand Up @@ -128,6 +86,12 @@ Run the build script.
python build.py --build_java --android --android_home <path to your Android SDK> --android_ndk_path <path to your NDK installation> --android_abi [armeabi-v7a|arm64-v8a|x86|x86_64] --config Release
```

### Build C/C++ API only

```bash
python build.py --skip_wheel --config Release
```

## Install the library into your application

### Install Python wheel
Expand All @@ -154,11 +118,10 @@ Copy `build/Android/Release/src/java/build/android/outputs/aar/onnxruntime-genai

#### Windows

Use the header in `src\ort_genai.h` and the libraries in `build\Windows\Release`
Use the header in `src\ort_genai.h` and the libraries in `build\Windows\Release\Release`

#### Linux

Use the header in `src/ort_genai.h` and the libraries in `build/Linux/Release`



Loading