Skip to content

Commit

Permalink
Update onnxruntime-extension to remove OpenCV (#891)
Browse files Browse the repository at this point in the history
Remove OpenCV to reduce the binary size and the overall compilation
time.

The following data is from the GHA pipeline.

| Build Time | Before | After   |
|------------|--------|---------|
| win-x64    | 9m 8s  | 5m 47s  |
| linux-x64  | 3m 30s | 1m 37s  |

Uncompressed CAPI Binary:

| Binary Size | Before   | After    |
|-------------|----------|----------|
| win-x64     | 2,276 KB | 1,321 KB |
| linux-x64   | 4,836 KB | 3,124 KB |
  • Loading branch information
skyline75489 committed Sep 26, 2024
1 parent d42f74b commit d1a882d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set_target_properties(onnxruntime-genai-static PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(onnxruntime-genai-static PRIVATE dl) # For dlopen & co
endif()


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;8d842d85e39aa36985cedf68f5d9e5dfef6f6d05
onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;e424838708c92a73bb2a467be63803513220282b
2 changes: 1 addition & 1 deletion src/models/audio_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::unique_ptr<OrtValue> ProcessMel(ort_extensions::OrtxObjectPtr<OrtxTensor>&
const float* mel_data{};
const int64_t* shape{};
size_t num_dims;
CheckResult(OrtxGetTensorDataFloat(mel.get(), &mel_data, &shape, &num_dims));
CheckResult(OrtxGetTensorData(mel.get(), reinterpret_cast<const void**>(&mel_data), &shape, &num_dims));
std::span<const int64_t> shape_span(shape, num_dims);
auto input_features_value = expected_type == ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT
? OrtValue::CreateTensor<float>(allocator, shape_span)
Expand Down

0 comments on commit d1a882d

Please sign in to comment.