Skip to content

Commit

Permalink
Specify ARM64 arch to fix Java macOS CI build (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 authored Dec 17, 2024
1 parent 10932c1 commit d10bab7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mac-cpu-arm64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: |
set -e -x
source genai-macos-venv/bin/activate
python3 build.py --config=Release --build_dir build/cpu/osx-arm64 --build_java --parallel --cmake_generator "Unix Makefiles"
python3 build.py --config=Release --build_dir build/cpu/osx-arm64 --build_java --parallel --cmake_generator "Unix Makefiles" --macos MacOSX --osx_arch arm64 --apple_deploy_target 12.0 --apple_sysroot macosx
- name: Run tests
run: |
Expand Down
9 changes: 6 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,6 @@ def update(args: argparse.Namespace, env: dict[str, str]):
if args.ios or args.macos:
platform_name = "macabi" if args.macos == "Catalyst" else args.apple_sysroot
command += [
"-DENABLE_PYTHON=OFF",
"-DENABLE_TESTS=OFF",
"-DENABLE_MODEL_BENCHMARK=OFF",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=" + args.apple_deploy_target,
f"-DBUILD_APPLE_FRAMEWORK={'ON' if args.build_apple_framework else 'OFF'}",
"-DPLATFORM_NAME=" + platform_name,
Expand Down Expand Up @@ -534,6 +531,9 @@ def _get_opencv_toolchain_file():
f"-DIPHONEOS_DEPLOYMENT_TARGET={args.apple_deploy_target}",
# The following arguments are specific to the OpenCV toolchain file
f"-DCMAKE_TOOLCHAIN_FILE={_get_opencv_toolchain_file()}",
"-DENABLE_PYTHON=OFF",
"-DENABLE_TESTS=OFF",
"-DENABLE_MODEL_BENCHMARK=OFF",
]

if args.macos == "Catalyst":
Expand All @@ -552,6 +552,9 @@ def _get_opencv_toolchain_file():
f"-DCMAKE_CC_FLAGS=--target={macabi_target}",
f"-DCMAKE_CC_FLAGS_RELEASE=-O3 -DNDEBUG --target={macabi_target}",
"-DMAC_CATALYST=1",
"-DENABLE_PYTHON=OFF",
"-DENABLE_TESTS=OFF",
"-DENABLE_MODEL_BENCHMARK=OFF",
]

if args.arm64:
Expand Down
4 changes: 2 additions & 2 deletions src/java/src/main/java/ai/onnxruntime/genai/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package ai.onnxruntime.genai;

/**
* Use Config to set the ORT execution providers (EPs) and their options. The EPs are applied based on
* insertion order.
* Use Config to set the ORT execution providers (EPs) and their options. The EPs are applied based
* on insertion order.
*/
public final class Config implements AutoCloseable {
private long nativeHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
*/
package ai.onnxruntime.genai;

/**
* This class is a list of tensors with names that match up with model input names.
*/
/** This class is a list of tensors with names that match up with model input names. */
public class NamedTensors implements AutoCloseable {
private long nativeHandle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SimpleTest {
// the test model requires manual input as the token ids have to be < 1000 but the configured tokenizer
// has a larger vocab size and the input ids it generates are not valid.
val model = Model(newModelPath)
val params = model.createGeneratorParams()
val params = GeneratorParams(model)

val sequenceLength = 4
val batchSize = 2
Expand Down

0 comments on commit d10bab7

Please sign in to comment.