Skip to content

Commit

Permalink
Update onnxruntime-extension (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyline75489 authored Jan 6, 2025
1 parent 7b88a47 commit a715113
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
13 changes: 7 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,13 @@ def update(args: argparse.Namespace, env: dict[str, str]):
"-DPLATFORM_NAME=" + platform_name,
]

if args.ios or args.macos == "Catalyst" or args.build_apple_framework:
command += [
"-DENABLE_PYTHON=OFF",
"-DENABLE_TESTS=OFF",
"-DENABLE_MODEL_BENCHMARK=OFF",
]

if args.macos:
command += [
f"-DCMAKE_OSX_SYSROOT={args.apple_sysroot}",
Expand All @@ -531,9 +538,6 @@ 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,9 +556,6 @@ 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
2 changes: 1 addition & 1 deletion cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.10.1.zip;769b6a
googletest;https://github.com/google/googletest/archive/530d5c8c84abd2a46f38583ee817743c9b3a42b4.zip;5e3a61db2aa975cfd0f97ba92c818744e7fa7034
microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.zip;e4a542a323c070376f7c2d1973d0f7ddbc1d2fa5
directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e
onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;2c3e936cfc3401ba7ebb79d02b9e52a50439ffc3
onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;4e10ee046a2f035351f3fe88740bd8215a18fdb9
6 changes: 3 additions & 3 deletions src/models/audio_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ std::unique_ptr<Audios> LoadAudios(const std::span<const char* const>& audio_pat
}
}
ort_extensions::OrtxObjectPtr<OrtxRawAudios> audios;
CheckResult(OrtxLoadAudios(ort_extensions::ptr(audios), audio_paths.data(), audio_paths.size()));
CheckResult(OrtxLoadAudios(audios.ToBeAssigned(), audio_paths.data(), audio_paths.size()));

return std::make_unique<Audios>(std::move(audios), audio_paths.size());
}
Expand All @@ -68,10 +68,10 @@ std::unique_ptr<NamedTensors> AudioProcessor::Process(const Audios* audios) cons
auto named_tensors = std::make_unique<NamedTensors>();

ort_extensions::OrtxObjectPtr<OrtxTensorResult> result;
CheckResult(OrtxSpeechLogMel(processor_.get(), audios->audios_.get(), ort_extensions::ptr(result)));
CheckResult(OrtxSpeechLogMel(processor_.get(), audios->audios_.get(), result.ToBeAssigned()));

ort_extensions::OrtxObjectPtr<OrtxTensor> mel;
CheckResult(OrtxTensorResultGetAt(result.get(), 0, ort_extensions::ptr(mel)));
CheckResult(OrtxTensorResultGetAt(result.get(), 0, mel.ToBeAssigned()));

named_tensors->emplace(std::string(Config::Defaults::InputFeaturesName),
std::make_shared<Tensor>(ProcessMel(mel, input_features_type_, allocator)));
Expand Down

0 comments on commit a715113

Please sign in to comment.