mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
ORT- OVEP 1.19 PR-follow up (#21546)
### Description Follow up PR for bug fixes on 1.19 ### Motivation and Context - Handles 1.19 docker file fixes. - Sets the default file naming of epctx onnx model with _ctx.onnx as suffix. - Create epctx model directories if it doesn't exist. --------- Co-authored-by: jatinwadhwa921 <110383850+jatinwadhwa921@users.noreply.github.com>
This commit is contained in:
parent
b03c9496aa
commit
c39f1c4fd8
4 changed files with 31 additions and 13 deletions
|
|
@ -3,11 +3,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
ARG OPENVINO_VERSION=2024.0.0
|
||||
ARG OPENVINO_VERSION=2024.2.0
|
||||
|
||||
|
||||
# Build stage
|
||||
FROM openvino/ubuntu20_runtime:${OPENVINO_VERSION} AS builder
|
||||
FROM openvino/ubuntu22_runtime:${OPENVINO_VERSION} AS builder
|
||||
|
||||
ENV WORKDIR_PATH=/home/openvino
|
||||
WORKDIR $WORKDIR_PATH
|
||||
|
|
@ -34,20 +34,18 @@ RUN cat /etc/apt/sources.list | sed 's/^# deb-src/deb-src/g' > ./temp; mv temp /
|
|||
RUN apt update; apt install dpkg-dev
|
||||
RUN mkdir /sources
|
||||
WORKDIR /sources
|
||||
RUN apt-get source cron iso-codes lsb-release powermgmt-base python-apt-common python3-apt python3-dbus python3-gi unattended-upgrades libapt-pkg6.0 libhogweed5 libnettle7
|
||||
RUN apt-get source cron iso-codes lsb-release powermgmt-base python-apt-common python3-apt python3-dbus python3-gi libapt-pkg6.0 libhogweed6 libnettle8
|
||||
WORKDIR /
|
||||
RUN tar cvf GPL_sources.tar.gz /sources
|
||||
|
||||
# Deploy stage
|
||||
FROM openvino/ubuntu20_runtime:${OPENVINO_VERSION}
|
||||
FROM openvino/ubuntu22_runtime:${OPENVINO_VERSION}
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
USER root
|
||||
COPY --from=builder /home/openvino/onnxruntime/build/Linux/Release/dist/*.whl ./
|
||||
COPY --from=builder /GPL_sources.tar.gz ./
|
||||
RUN python3 -m pip install ./*.whl && rm ./*.whl
|
||||
RUN apt update; apt install -y unattended-upgrades && \
|
||||
unattended-upgrade
|
||||
ARG BUILD_UID=1001
|
||||
ARG BUILD_USER=onnxruntimedev
|
||||
RUN adduser --uid $BUILD_UID $BUILD_USER
|
||||
|
|
|
|||
|
|
@ -128,6 +128,13 @@ BackendManager::BackendManager(const GlobalContext& global_context,
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if (global_context_.export_ep_ctx_blob && !ep_ctx_handle_.IsValidOVEPCtxGraph()) {
|
||||
auto status = onnxruntime::openvino_ep::BackendManager::ExportCompiledBlobAsEPCtxNode(subgraph,
|
||||
logger);
|
||||
if ((!status.IsOK())) {
|
||||
ORT_THROW(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call EPContext model exporter here if the provider option for exporting
|
||||
|
|
@ -158,7 +165,7 @@ Status BackendManager::ExportCompiledBlobAsEPCtxNode(const onnxruntime::GraphVie
|
|||
if (dot == std::string::npos) return graph_name;
|
||||
return graph_name.substr(0, dot);
|
||||
}();
|
||||
graph_name = graph_name + "-ov_" + GetGlobalContext().device_type + "_blob.onnx";
|
||||
graph_name = graph_name + "_ctx.onnx";
|
||||
}
|
||||
// If embed_mode, then pass on the serialized blob
|
||||
// If not embed_mode, dump the blob here and only pass on the path to the blob
|
||||
|
|
|
|||
|
|
@ -147,11 +147,6 @@ common::Status OpenVINOExecutionProvider::Compile(
|
|||
*GetLogger(),
|
||||
ep_ctx_handle_);
|
||||
|
||||
if (global_context_->export_ep_ctx_blob && !ep_ctx_handle_.IsValidOVEPCtxGraph()) {
|
||||
ORT_RETURN_IF_ERROR(backend_manager->ExportCompiledBlobAsEPCtxNode(graph_body_viewer,
|
||||
*GetLogger()));
|
||||
}
|
||||
|
||||
compute_info.create_state_func =
|
||||
[backend_manager](ComputeContext* context, FunctionState* state) {
|
||||
OpenVINOEPFunctionState* p = new OpenVINOEPFunctionState();
|
||||
|
|
|
|||
|
|
@ -192,6 +192,10 @@ struct OpenVINO_Provider : Provider {
|
|||
}
|
||||
|
||||
if (provider_options_map.find("num_of_threads") != provider_options_map.end()) {
|
||||
if (!std::all_of(provider_options_map.at("num_of_threads").begin(),
|
||||
provider_options_map.at("num_of_threads").end(), ::isdigit)) {
|
||||
ORT_THROW("[ERROR] [OpenVINO-EP] Number of threads should be a number. \n");
|
||||
}
|
||||
num_of_threads = std::stoi(provider_options_map.at("num_of_threads"));
|
||||
if (num_of_threads <= 0) {
|
||||
num_of_threads = 1;
|
||||
|
|
@ -298,7 +302,21 @@ struct OpenVINO_Provider : Provider {
|
|||
// The path to dump epctx model is valid only when epctx is enabled.
|
||||
// Overrides the cache_dir option to dump model cache files from OV.
|
||||
if (export_ep_ctx_blob) {
|
||||
cache_dir = provider_options_map.at("so_epctx_path").c_str();
|
||||
auto ep_context_file_path_ = provider_options_map.at("so_epctx_path");
|
||||
auto file_path = std::filesystem::path(ep_context_file_path_);
|
||||
// ep_context_file_path_ file extension must be .onnx
|
||||
if (!ep_context_file_path_.empty() &&
|
||||
file_path.extension().generic_string() == ".onnx") {
|
||||
// ep_context_file_path_ must be provided as a directory, create it if doesn't exist
|
||||
auto parent_path = file_path.parent_path();
|
||||
if (!std::filesystem::is_directory(parent_path) &&
|
||||
!std::filesystem::create_directory(parent_path)) {
|
||||
ORT_THROW("[ERROR] [OpenVINO] Failed to create directory : " + file_path.parent_path().generic_string() + " \n");
|
||||
}
|
||||
cache_dir = ep_context_file_path_.c_str();
|
||||
} else {
|
||||
ORT_THROW("[ERROR] [OpenVINO] Invalid ep_ctx_file_path" + ep_context_file_path_ + " \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue